summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-27 19:02:14 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-27 19:02:14 +0100
commitf4a7c3a1aa4190c277865a345b3766c09a39fb2f (patch)
treeb13c0d280533de98f241333906199908d0e6eec1
parentc493781bfc4c3c35e536d337e1cbb14c93623733 (diff)
downloadLPC-Projet-f4a7c3a1aa4190c277865a345b3766c09a39fb2f.tar.gz
LPC-Projet-f4a7c3a1aa4190c277865a345b3766c09a39fb2f.zip
Conform to specification
-rw-r--r--src/Makefile12
-rw-r--r--src/main.ml13
2 files changed, 20 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..4f15695
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,12 @@
+BIN=minic++
+
+all: $(BIN)
+
+$(BIN): main.byte
+ cp main.byte minic++
+
+main.byte: main.ml ast.ml parser.mly lexer.mll pretty.ml
+ ocamlbuild main.byte
+
+clean:
+ rm -r _build
diff --git a/src/main.ml b/src/main.ml
index 4ebcbb3..c64381c 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -17,8 +17,8 @@ let localisation pos =
!ifile l (c-1) c
let options = [
- "-parse-only", Arg.Set parse_only, "Stops after parsing of the input file.";
- "-dump", Arg.Set dump, "Dump the AST after parsing."
+ "--parse-only", Arg.Set parse_only, "Stops after parsing of the input file.";
+ "--dump", Arg.Set dump, "Dump the AST after parsing."
]
let localisation pos =
@@ -52,6 +52,9 @@ let () =
eprintf "Lexical analysis error: %s@." s;
exit 1
| Parser.Error ->
- localisation (Lexing.lexeme_start_p buf);
- eprintf "Parsing error.@.";
- exit 1
+ localisation (Lexing.lexeme_start_p buf);
+ eprintf "Parsing error.@.";
+ exit 1
+ | _ ->
+ eprintf "Unexpected error...@.";
+ exit 2