mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-28 01:28:48 +00:00
Intermediate
This commit is contained in:
parent
f4ee6c5c5e
commit
4847ee60fb
3 changed files with 8 additions and 8 deletions
10
src/SM.ml
10
src/SM.ml
|
|
@ -1,5 +1,5 @@
|
|||
open GT
|
||||
open Syntax
|
||||
open Language
|
||||
|
||||
(* The type for the stack machine instructions *)
|
||||
@type insn =
|
||||
|
|
@ -39,11 +39,11 @@ let rec eval ((stack, ((st, i, o) as c)) as conf) = function
|
|||
|
||||
(* Top-level evaluation
|
||||
|
||||
val run : int list -> prg -> int list
|
||||
val run : prg -> int list -> int list
|
||||
|
||||
Takes an input stream, a program, and returns an output stream this program calculates
|
||||
*)
|
||||
let run i p = let (_, (_, _, o)) = eval ([], (Expr.empty, i, [])) p in o
|
||||
*)
|
||||
let run p i = let (_, (_, _, o)) = eval ([], (Expr.empty, i, [])) p in o
|
||||
|
||||
(* Stack machine compiler
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ let run i p = let (_, (_, _, o)) = eval ([], (Expr.empty, i, [])) p in o
|
|||
|
||||
Takes a program in the source language and returns an equivalent program for the
|
||||
stack machine
|
||||
*)
|
||||
*)
|
||||
|
||||
let rec compile =
|
||||
let rec expr = function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue