[antlr-interest] Rephrasing message 7267 ( Where is the error?)
rmsanjivp <rmsanjivp at yahoo.com>
rmsanjivp at yahoo.com
Wed Jan 29 22:13:37 PST 2003
the grammar is actually
topLevel : expr;
expr : mult_expr ( (PLUS | MINUS) mult_expr)*;
mult_expr : pow_expr ((MULT | DIV) pow_expr)*;
pow_expr: primary_expr ( POWER pow_expr)?;
primary_expr: ID | (LPAREN expr RPAREN) | NUM
;
THe problem is that in the method for pow_expr because I made it
right associative I have RPAREN as a valid lookahead after the match
of ID. THis should not be the case as only an operator can follow
ID. Can anyone please tell me why this is happening? If my grammar
is wrong then where it is wrong?
I think the problem is coming because of rule (LPAREN expr RPAREN)
because if I have this as (LPAREN ID RPAREN) then RPAREN is not
coming as a valid token after pow_expr().
Kindly help me soon.
Thanks,
Sanjiv
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list