X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_parser.mly;h=42470a450d3565a7875c3dea47bf248f21e212b0;hb=HEAD;hp=1bb9388b7a3f5ac509bce3226a7a3fa3a16fcaad;hpb=cda83e5ec171672a59966d2bd9cd28bd7a8fe083;p=tiger.ml.git diff --git a/compiler/src/lib/tiger/tiger_parser.mly b/compiler/src/lib/tiger/tiger_parser.mly index 1bb9388..42470a4 100644 --- a/compiler/src/lib/tiger/tiger_parser.mly +++ b/compiler/src/lib/tiger/tiger_parser.mly @@ -1,5 +1,6 @@ %{ module Ast = Tiger_absyn + module Err = Tiger_error module Sym = Tiger_symbol let pos () = @@ -73,7 +74,10 @@ %% -program: exp EOF { $1 }; +program: + | exp EOF { $1 } + | error {Err.raise (Err.Invalid_syntax (pos ()))} + ; exp: | NIL @@ -308,6 +312,7 @@ exps: ; rec_fields_bind: + | { [] } | ID EQ exp { (Sym.of_string $1, $3, pos ()) :: [] } | ID EQ exp COMMA rec_fields_bind { (Sym.of_string $1, $3, pos ()) :: $5 } ;