summaryrefslogtreecommitdiff
path: root/src/main.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-16 11:59:42 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-16 11:59:42 +0100
commitec7d5bcc03e4bad22b6cc790aa69cb310ec452e4 (patch)
tree915d0a738cb3bbd0e81a98b00eab03415678a152 /src/main.ml
parentdeb235f3045138908339cec56f0ce34dbb4e936b (diff)
downloadLPC-Projet-ec7d5bcc03e4bad22b6cc790aa69cb310ec452e4.tar.gz
LPC-Projet-ec7d5bcc03e4bad22b6cc790aa69cb310ec452e4.zip
Functionning parser with no conflicts! No support for classes and OOP yet.
Diffstat (limited to 'src/main.ml')
-rw-r--r--src/main.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.ml b/src/main.ml
index 719dcae..4ebcbb3 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -2,6 +2,7 @@ open Format
open Lexing
let parse_only = ref false
+let dump = ref false
let ifile = ref ""
@@ -16,7 +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."
+ "-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 =
@@ -43,7 +45,7 @@ let () =
let p = Parser.prog Lexer.token buf in
close_in f;
- Pretty.print_prog p;
+ if !dump then Pretty.print_prog p;
with
| Lexer.Lexing_error s ->
localisation (Lexing.lexeme_start_p buf);