Reduce/Reduce Conflict ?

"Ashwin" <>
21 Feb 2003 01:22:51 -0500

          From comp.compilers

Related articles
Reduce/Reduce Conflict ? (Ashwin) (2003-02-21)
Re: Reduce/Reduce Conflict ? (Matt) (2003-02-24)
Re: Reduce/Reduce Conflict ? (Scott Nicol) (2003-02-24)
Re: Reduce/Reduce Conflict ? (SLK Parsers) (2003-03-02)
| List of all articles for this month |

From: "Ashwin" <>
Newsgroups: comp.compilers
Date: 21 Feb 2003 01:22:51 -0500
Organization: Posted via Supernews,
Keywords: parse, question
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:

        | CastExpression





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.