summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-02-09 18:11:37 +0000
committerAlasdair Armstrong2018-02-09 18:16:17 +0000
commitc8e8d4abd22391431f8d63456d0e64eabb136f93 (patch)
treea554583e23c72088fb474e569da751f09f5daed2 /src/Makefile
parent92813dc4c9c0cf1f86d34b09423ef6ce873b5f1c (diff)
Formalize C backend intermediate representation in Ott
Describes precisely the intermediate representation used in the C backend in an ott grammar, and also removes several C-isms where raw C code was inserted into the IR, so in theory this IR could be interpreted by a small VM/interpreter or compiled to LLVM bytecode etc. Currently the I_raw constructor for inserting C code is just used for inserting GCC attributes, so it can safely be ignored. Also augment and refactor the instruction type with an aux constructor so location information can be propagated down to this level.
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index 2a9fcc32..924cfb1c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -60,17 +60,24 @@ full: sail lib power doc test
ast.lem: ../language/l2.ott
ott -sort false -generate_aux_rules true -o ast.lem -picky_multiple_parses true ../language/l2.ott
+bytecode.lem: ../language/bytecode.ott ast.lem
+ ott -sort false -generate_aux_rules true -o bytecode.lem -picky_multiple_parses true ../language/bytecode.ott
+
ast.ml: ast.lem
lem -ocaml ast.lem
sed -i -f ast.sed ast.ml
+bytecode.ml: bytecode.lem
+ lem -ocaml bytecode.lem
+ sed -i -f ast.sed bytecode.ml
+
lem_interp/interp_ast.lem: ../language/l2.ott
ott -sort false -generate_aux_rules true -o lem_interp/interp_ast.lem -picky_multiple_parses true ../language/l2.ott
-sail: ast.ml
+sail: ast.ml bytecode.ml
ocamlbuild -use-ocamlfind sail.native
-isail: ast.ml
+isail: ast.ml bytecode.ml
ocamlbuild -use-ocamlfind isail.native
sail.native: sail
@@ -265,6 +272,8 @@ clean:
-rm -rf sail.docdir
-rm -f ast.ml
-rm -f ast.lem
+ -rm -f bytecode.ml
+ -rm -f bytecode.lem
doc:
ocamlbuild -use-ocamlfind sail.docdir/index.html