grammars-v4
grammars-v4 copied to clipboard
Aterm
@kaby76 I seem to have something not quite right in this commit. I see errors like "
Test.java:187: error: <identifier> expected
ParseTree tree = parser.();
Trgen tries to find a start rule but it cannot because it is not an EOF-terminated start rule. The grammar should be augmented with a rule like start_ : term_ EOF ;. Not only does this help trgen find the start rule in the grammar but it forces the parser to read all input to the end of file instead of prematurely stopping at an error, backing up, and reporting success. For an example, see https://github.com/antlr/grammars-v4/issues/2405 and specifically the exercise of modifying the "calculator" grammar and parsing input "1 2". In other words, even if one sets the start symbol in the pom.xml, it may not always parse correctly.