[antlr-interest] tree grammar question...
pady
prabha_pady at comcast.net
Mon Dec 29 11:10:55 PST 2008
In my parser, I have rules like...
statement
: assignment
| ifStatement
| compoundStatement
;
compoundStatement
: '{' statement* '}' -> statement*
;
In the equivalent tree grammar, I have
statement
: assignment
| ifStatement
| compoundStatement
;
compoundStatement
: statement* // using the rewrite rule alone...
;
But when i build my tree grammar, I get a "mutually left-recursive" rule
error between statement/compoundStatement. I dont get this error when
building the parser grammar. I understand the issue, but I am not sure how
this can be resolved. I saw a similar rule in the java tree grammar in the
antlr grammar list. Not sure how the tree grammar there will avoid this
left-recursive error.
Thanks
-- pady
More information about the antlr-interest
mailing list