diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f6364cf --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +SOURCES = scanner.mll \ + parser.mly \ + sast.ml \ + ast.ml \ + semant.ml \ + parser.ml \ + scanner.ml \ + test2.ml + + +OCAMLBUILD = ocamlbuild test2.native + +all: + $(OCAMLBUILD) test2.native parser semant + +clean: + $(OCAMLBUILD) -clean + rm -rf *.cmi *.cmo parser.ml parser.mli scanner.ml + + + + diff --git a/build.mk b/build.mk new file mode 100644 index 0000000..6b41fb5 --- /dev/null +++ b/build.mk @@ -0,0 +1,65 @@ + #For those machine doesn't have ocamlbuild, build the project with this makefile + +OBJ=ast.cmo \ + sast.cmo \ + semant.cmo \ + scanner.cmo \ + parser.cmo \ + test2.cmo \ + printer.cmo + +PythonPlusPlus=pythonpp + +FLAGS:=-g + +$(PythonPlusPlus): $(OBJ) + ocamlc -g -o parser parser.cmo scanner.cmo ast.cmo + ocamlc -g -o semant parser.cmo scanner.cmo ast.cmo sast.cmo + ocamlc -g -o test2 parser.cmo scanner.cmo ast.cmo sast.cmo semant.cmo test2.cmo + +printer: $(OBJ) + ocamlc -o printer.cma -a ast.cmo sast.cmo printer.cmo + +.SUFFIXES: .ml .cmo .cmi .mll .mly .mli +.PRECIOUS: %.ml %.mli %.cmo + +.ml.cmo: + ocamlc -c $(FLAGS) $< + +.mli.cmi: + ocamlc -c $(FLAGS) $< + +.mll.ml: + ocamllex $< + +.mly.ml: + ocamlyacc -v $< + +.mly.mli: + ocamlyacc -v $< + +clean: + rm -f *.cmi *.cmo parser.ml scanner.ml *.output parser.mli parser_test semant test2 + + +# Generated by ocamldep +ast.cmo: +ast.cmx: +parser.cmo: util.cmo ast.cmo parser.cmi +parser.cmx: util.cmx ast.cmx parser.cmi +parser.cmi: ast.cmo +sast.cmo: util.cmo ast.cmo +sast.cmx: util.cmx ast.cmx +scanner.cmo: parser.cmi +scanner.cmx: parser.cmx +semant.cmo: sast.cmo ast.cmo +semant.cmx: sast.cmx ast.cmx +parser.cmo: scanner.cmo parser.cmi ast.cmo +parser.cmx: scanner.cmx parser.cmx ast.cmx +test2.cmo: scanner.cmo parser.cmi \ + output.cmo interpreter.cmo +test2.cmx: semant.cmx scanner.cmx parser.cmx \ + output.cmx interpreter.cmx + +printer.cmo: ast.cmo sast.cmo +printer.cmx: ast.cmx sast.cmx