From c8e8d4abd22391431f8d63456d0e64eabb136f93 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Fri, 9 Feb 2018 18:11:37 +0000 Subject: 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. --- src/Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Makefile') 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 -- cgit v1.2.3