mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-09 16:28:47 +00:00
Removed embedding
This commit is contained in:
parent
337a5d1a67
commit
1996d0e0cb
2 changed files with 1 additions and 42 deletions
|
|
@ -1,41 +0,0 @@
|
||||||
(* A deep embedding of simple expressions in OCaml. *)
|
|
||||||
|
|
||||||
(* Opening GT yet again. *)
|
|
||||||
open GT
|
|
||||||
|
|
||||||
(* Opening the substrate module for convenience. *)
|
|
||||||
open Syntax
|
|
||||||
|
|
||||||
(* Shortcuts for leaf constructors *)
|
|
||||||
let ( ! ) x = Expr.Var x
|
|
||||||
let ( !? ) n = Expr.Const n
|
|
||||||
|
|
||||||
(* Implementation of operators *)
|
|
||||||
let binop op x y = Expr.Binop (op, x, y)
|
|
||||||
|
|
||||||
let ( + ) = binop "+"
|
|
||||||
let ( - ) = binop "-"
|
|
||||||
let ( * ) = binop "*"
|
|
||||||
let ( / ) = binop "/"
|
|
||||||
let ( % ) = binop "%"
|
|
||||||
let ( < ) = binop "<"
|
|
||||||
let ( <= ) = binop "<="
|
|
||||||
let ( > ) = binop ">"
|
|
||||||
let ( >= ) = binop ">="
|
|
||||||
let ( == ) = binop "=="
|
|
||||||
let ( != ) = binop "!="
|
|
||||||
let ( && ) = binop "&&"
|
|
||||||
let ( || ) = binop "!!"
|
|
||||||
|
|
||||||
let ( =:= ) x e = Stmt.Assign (x, e)
|
|
||||||
let read x = Stmt.Read x
|
|
||||||
let write e = Stmt.Write e
|
|
||||||
let (|>) x y = Stmt.Seq (x, y)
|
|
||||||
|
|
||||||
(* Some predefined names for variables *)
|
|
||||||
let x = !"x"
|
|
||||||
let y = !"y"
|
|
||||||
let z = !"z"
|
|
||||||
let t = !"t"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@ TOPFILE = rc
|
||||||
OCAMLC = ocamlc
|
OCAMLC = ocamlc
|
||||||
OCAMLOPT = ocamlopt
|
OCAMLOPT = ocamlopt
|
||||||
OCAMLDEP = ocamldep
|
OCAMLDEP = ocamldep
|
||||||
SOURCES = Language.ml Embedding.ml SM.ml Driver.ml
|
SOURCES = Language.ml SM.ml Driver.ml
|
||||||
LIBS = GT.cma unix.cma re.cma re_emacs.cma re_str.cma
|
LIBS = GT.cma unix.cma re.cma re_emacs.cma re_str.cma
|
||||||
CAMLP5 = -pp "camlp5o -I `ocamlfind -query GT.syntax` -I `ocamlfind -query ostap.syntax` pa_ostap.cmo pa_gt.cmo -L `ocamlfind -query GT.syntax`"
|
CAMLP5 = -pp "camlp5o -I `ocamlfind -query GT.syntax` -I `ocamlfind -query ostap.syntax` pa_ostap.cmo pa_gt.cmo -L `ocamlfind -query GT.syntax`"
|
||||||
PXFLAGS = $(CAMLP5)
|
PXFLAGS = $(CAMLP5)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue