[antlr-interest] Two Conflicts..
nbsherid at secsme.org.au
Tue Mar 8 00:14:44 PST 2005
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Matthew Tedder
> Sent: Tuesday, 8 March 2005 4:08 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Two Conflicts..
> It would be really appreciated if someone would give
> me guidance on how to resolve these two conflicts:
> (1) I want someone to enter code such as:
> x = myfunc(param2,param2) * (z - 4);
> y = "You will die in the year " x ", a very sad man."
> : LPAREN (IDENT (COMMA paramList)*)? RPAREN
> : NLIT
> : SLIT
> | IDENT paramList // conflicts with "LPAREN
> expr LPAREN"
> // because of
> string concatenation
> | expr (expr)+ // for string
> | LPAREN expr RPAREN // conflicts with "IDENT
> | expr TIMES expr
> | expr DIVISION expr
> | expr PLUS expr
> | expr MINUS expr
I can't see any conflict here (unless my eyes are deceiving me)... "IDENT
paramList" implies "IDENT LPAREN (IDENT | RPAREN)" is the sequence to match.
With *only these* rules there isn't any conflict, because IDENT can never
appear before LPAREN in any other way (since LPAREN is not optional).
However, if there is some other rule that interacts with expr, then that
might be causing the trouble.
Can you post the full grammar, and the error message?
As for the second issue, I don't see any problem with changing EQ to ASSIGN
in the line "| expr EQ expr". But again, that relies on the rules you have
given us (and depends on whether I have overlooked anything).
PhD research student
Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435
More information about the antlr-interest