[antlr-interest] for grammar tail recursion

Gavin Lambert antlr at mirality.co.nz
Thu Apr 5 04:00:10 PDT 2007


At 22:44 5/04/2007, femto gary wrote:
 >Hi John, yes I also tried adding a start rule,
 >start:slist; to the grammar file,
 >and it's ok now (both in antlrWorks and outside it).
 >
 >but it's weird, shouldn't antlr3 just recognize the grammar 
slist?
 >why doesn't it need a seperate start rule (maybe it's a bug?).
 >because I'm reading the antlr beta book now and didn't find
 >that it says special handling must be treated for start rule.
 >weird.

The normal trick is to make your top-level rule have EOF at the 
end, which forces ANTLR to match end-of-file after the rest of the 
text or fail.



More information about the antlr-interest mailing list