[parser] ajout de fby (proposition alternative) + type checker (sera factorisé)

This commit is contained in:
Arnaud DABY-SEESARAM
2022-12-09 23:18:13 +01:00
parent a29666f673
commit 347cb3a11d
5 changed files with 189 additions and 35 deletions

View File

@@ -70,8 +70,15 @@ let _ =
let res = Parser.main Lexer.token (Lexing.from_channel inchan) in
close_in inchan; res
end
with Lexer.Lexing_error s ->
exit_error (Format.sprintf "Code d'erreur:\n\t%s\n\n" s); exit 0 in
with
| Lexer.Lexing_error s ->
(exit_error (Format.sprintf "Code d'erreur:\n\t%s\n\n" s); exit 0)
| Utils.MyParsingError (s, l) ->
begin
Format.printf "Syntax error at %a: %s\n\n"
Pp.pp_loc l s;
exit 0
end in
if !ppast then Format.printf "%a" Pp.pp_ast ast
else