diff --git a/Makefile b/Makefile index 7482d77..61eae0f 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ EXTENSION=native all: eval `opam config env` ocamlbuild -use-ocamlfind \ + -I src/ \ -pkgs '$(PACKAGES)' \ -use-menhir \ -cflags '$(CFLAGS)' $(NAME).$(EXTENSION) @@ -17,9 +18,10 @@ deps: opam install $(PACKAGES) # For giving out to student prefer giving an url to the git project. -archiveLastest: +archiveLatest: git archive -o cmicrojsML-${shell git rev-parse HEAD}.zip HEAD clean: ocamlbuild -clean +.PHONY: all deps archiveLatests clean diff --git a/README.md b/README.md index fcda00d..0fa04a5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # kitty-lang -An other toy compiler in Ocaml, made with Menhir and Ocamlex for 3I018 compilation course at university +An other toy compiler in OCaml, made with Menhir and Ocamlex for 3I018 compilation course at university ## Build ```shell -ocamlbuild -use-ocamlfind -use-menhir 'main.native' +make ``` diff --git a/add.ky b/samples/add.ky similarity index 100% rename from add.ky rename to samples/add.ky diff --git a/ast.ml b/src/ast.ml similarity index 98% rename from ast.ml rename to src/ast.ml index 36b2b0b..50d48e1 100644 --- a/ast.ml +++ b/src/ast.ml @@ -87,7 +87,7 @@ let rec string_of_expr = function (string_of_expr init) (string_of_expr body)) | Seq (left, right) -> - (Printf.sprintf "%s ; %s" + (Printf.sprintf "%s;\n%s" (string_of_expr left) (string_of_expr right)) | Fun (id, args, body) -> diff --git a/kittylang.ml b/src/kittylang.ml similarity index 98% rename from kittylang.ml rename to src/kittylang.ml index 51c9c81..d045b13 100644 --- a/kittylang.ml +++ b/src/kittylang.ml @@ -70,7 +70,7 @@ let select_action parse compile expand = |> result_string |> Printf.sprintf "Parsed program:%s") else if expand then - failwith "-expand Not implemented" + failwith "--expand Not implemented" (* (fun prog -> Expander.expand_prog prog @@ -79,7 +79,7 @@ let select_action parse compile expand = |> P.sprintf "Kernal Abstract Syntax Tree:%s") *) else if compile then - failwith "-compile Not implemented" + failwith "--compile Not implemented" (* (fun prog -> compile_prog prog diff --git a/lexer.mll b/src/lexer.mll similarity index 100% rename from lexer.mll rename to src/lexer.mll diff --git a/parser.mly b/src/parser.mly similarity index 100% rename from parser.mly rename to src/parser.mly