How to resolve ambiguity? (Igor)
27 Dec 2003 15:02:36 -0500

          From comp.compilers

Related articles
How to resolve ambiguity? (2003-12-27)
Re: How to resolve ambiguity? (Scott Nicol) (2004-01-02)
Re: How to resolve ambiguity? (Derk Gwen) (2004-01-02)
Re: How to resolve ambiguity? (Scott Nicol) (2004-01-02)
| List of all articles for this month |

From: (Igor)
Newsgroups: comp.compilers
Date: 27 Dec 2003 15:02:36 -0500
Keywords: parse, question
Posted-Date: 27 Dec 2003 15:02:36 EST


  I am trying to write a custom compiler for C sharp,
but I am kind of stuck with the grammar MSDN provides,
for example, in the rule:

<struct-type> ::= <type-name>
                                                          | <simple-type>

<type-name> would reduce to <struct-type>,
and in

<class-type> ::= <type-name>
                                                          | object
                                                          | string

  <type-name> would reduce to <class-type>.
THis is evidently a reduce-reduce conflict.

  Could somebody explain why they provide a grammar like that
and how my parser-compiler is supposed to handle that
to not be ambiguous?

Please help, or direct me to the right location
Thank you very much

Post a followup to this message

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