let parse channel name =
let get_ast lexbuf =
let _ = Parsing.set_trace false in
try Parser.program Lexer.main lexbuf
with
| RuntimeError.LexerException (msg, line, col) ->
(print_string
(msg ^
(" at line " ^
((string_of_int line) ^
(" col " ^ ((string_of_int col) ^ "\n")))));
exit 2)
in let lexbuf = Lexing.from_channel channel in
let pos = lexbuf.Lexing.lex_curr_p in
let _ =
lexbuf.Lexing.lex_curr_p <-
{ (pos) with Lexing.pos_lnum = 1; Lexing.pos_fname = name; }
in get_ast lexbuf