[antlr-interest] Question about recursion
micheal_jor <open.zone at virgin.net>
open.zone at virgin.net
Mon Feb 3 10:56:51 PST 2003
> I just noticed recursion was rejected when the rule was the first
rule
> of the right part.
>
> expr
> : MINUS expr
> ;
>
> ..is ok
>
> expr
> : expr MINUS
> ;
>
> ..is not okay
ANTLR is an LL(k) parser. Please the docs on the site for what that
means and why left-recursive grammars generate errors with ANTLR.
This might also help:
http://www.csee.umbc.edu/331/fall02/0101/notes/pdf/4parsing.pdf
> If there a way to allow the second example in an ANTLR grammar ?
> therorically that ahould be accepted, it's a correct rule of the
BNF.
It isn't about BNF/EBNF. It's about leftmost derivation in LL(k)
parsers.
Cheers,
Micheal
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list