[antlr-interest] ANTLRWorks "synpredNN_MyGrammar" labels
Terence Parr
parrt at cs.usfca.edu
Sat Nov 1 14:31:43 PDT 2008
On Nov 1, 2008, at 2:25 PM, Ben Gillis wrote:
> ...but, this is the exact-same rules, same order in the grammar
> file; just a subset of the grammar where these same rules do display
> the synpred.
> Why ANTLR needs to backtrack in one and not the other I'm not clear
> on.
different grammars have different lookahead requirements.
a : A | B ; is LL(1)
a : A B | A C ; is LL(2)
a : A+ B | A+ C; is LL(*)
a : e '.' | e ';' ; // requires backtracking
e : '(' e ')' | INT ;
Change e to
e : INT ;
and you don't need backtracking anymore
> (So, back to the Definitive Guide on b/t'ing for clues will help?)
yep. ;)
Ter
More information about the antlr-interest
mailing list