|Reduce/Reduce Conflict ? email@example.com (Ashwin) (2003-02-21)|
|Re: Reduce/Reduce Conflict ? matt@NOSPAMbeastrider.com (Matt) (2003-02-24)|
|Re: Reduce/Reduce Conflict ? firstname.lastname@example.org (Scott Nicol) (2003-02-24)|
|Re: Reduce/Reduce Conflict ? email@example.com (SLK Parsers) (2003-03-02)|
|Date:||21 Feb 2003 01:22:51 -0500|
|Organization:||Posted via Supernews, http://www.supernews.com|
|Posted-Date:||21 Feb 2003 01:22:50 EST|
I have grammar defined for C#. Tools I am using are Lex and Bison. And
the problem is with a reduce/reduce conflict which leads to a major
parse error. The problem is arising due to the conflicting grammar in
case of ParenthesizedExpression, and Cast Expression. When Bison
encounters a Close Parenthesis which appears in both cases. It is not
able to decide whether to reduce using Expression which points into
Parenthesized Expression. Or Type which point into CastExpression. Say
for example my input to be parsed is as follows.
1) a = (foo) b
2) a = (a + (foo))
Gives me a parse error in the second case because, the default path it
takes is Type. So If the statement ends after close paren as in the second
case, it gives me an error unexpected close paren, since it is expecting an
identifier to follow.
I dont know how to solve this. If someone can help me. I have grammar
defined at the end if it can help.
Thank you in advance.
The Grammar is as follows:
OPENPAREN Expression CLOSEPAREN
OPENPAREN Type CLOSEPAREN IDENTIFIER
Return to the
Search the comp.compilers archives again.