From ec7d5bcc03e4bad22b6cc790aa69cb310ec452e4 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Sat, 16 Nov 2013 11:59:42 +0100 Subject: Functionning parser with no conflicts! No support for classes and OOP yet. --- src/main.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main.ml') 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); -- cgit v1.2.3