[antlr-interest] RFE: warn if root rule is missing (no EOF)

Olivier Lefevre lefevrol at yahoo.com
Thu Feb 21 06:54:29 PST 2008


> 2.  Not adding EOF is a common beginner mistake and generates many,
> similar messages to the email list.  Something should be done so that
> beginners are aware that (almost always) you want to end your base rule
> with EOF.

There is a FAQ entry for this (sort of) but it is (IMO) poorly worded: "Why
the generated parser code tolerates illegal expression?" To begin with it
should read "Why does etc" and then EOF is not just an issue with illegal
input: without it, parsing (also of perfectly valid input) may simply
terminate early.

Speaking of which, it is quite inconvenient that you can't (apparently) get
the whole FAQ on one page: that makes it hard to read it in one go (way too
much licking back and forth), which ideally one should do before starting
to use ANTLR but which I did not do for this reason. That is how I missed
the entry in question: I just scanned the entry names and didn't see
anything that seemed to match my problem.

-- O.L.



More information about the antlr-interest mailing list