Fix - check number of arguments in function calls
[tiger.ml.git] / compiler / src / exe / tigerc.ml
CommitLineData
7c14a966 1let lexbuf_set_filename lb filename : unit =
ef79993b 2 let Lexing.({lex_start_p; lex_curr_p; _}) = lb in
7c14a966
SK
3 lb.Lexing.lex_start_p <- {lex_start_p with Lexing.pos_fname = filename};
4 lb.Lexing.lex_curr_p <- {lex_curr_p with Lexing.pos_fname = filename}
5
78c9eca5
SK
6let () =
7 let path_to_program_file = Sys.argv.(1) in
8 let ic = open_in path_to_program_file in
9 let lexbuf = Lexing.from_channel ic in
7c14a966 10 lexbuf_set_filename lexbuf path_to_program_file;
543d3420 11 (match Tiger.Parser.program Tiger.Lexer.token lexbuf with
c16dd441
SK
12 | exception Tiger.Error.T error ->
13 Printf.eprintf "%s\n" (Tiger.Error.to_string error);
7c14a966 14 exit 1;
28875fec 15 | absyn ->
b197ea75 16 Tiger.Semant.transProg absyn;
28875fec 17 print_endline (Tiger.Absyn.to_string absyn)
543d3420 18 );
78c9eca5 19 close_in ic;
This page took 0.028817 seconds and 4 git commands to generate.