diff --git a/parser.y b/parser.y index bad5f7d2..f74ae21e 100644 --- a/parser.y +++ b/parser.y @@ -38,6 +38,12 @@ extern std::unique_ptr program; %define api.value.automove // This guarantees that headers do not conflict when included together. %define api.token.prefix {TOK_} +// Have messages report the unexpected token, and possibly the expected ones. +// Without this, the error message is always only "syntax error". +%define parse.error verbose +// Improve syntax error handling, as LALR parser might perform additional +// parser stack reductions before discovering the syntax error. +%define parse.lac full %token NUM %token ID