Re: CUP Grammar

Chris Dodd <>
26 Feb 2007 09:26:13 -0500

          From comp.compilers

Related articles
CUP Grammar (Joshua Franco) (2007-02-25)
Re: CUP Grammar (Chris Dodd) (2007-02-26)
| List of all articles for this month |

From: Chris Dodd <>
Newsgroups: comp.compilers
Date: 26 Feb 2007 09:26:13 -0500
Organization: Compilers Central
References: 07-02-054
Keywords: Java, parse
Posted-Date: 26 Feb 2007 09:26:13 EST

Joshua Franco <> wrote in news:07-02-054@comp.compilers:
> I am having a bitch of a time with a grammar that I could swear is
> perfect but seems to be horribly wrong.

The basic problem is that your grammar is not LALR(1) (its even ambigous,
though the obvious ambiguities can be solved with precendeces). You need
to carefully check out each of the conflicts that CUP reports for your
grammar and figure out how to get rid of them.

The biggest problem is going to be disambiguating between 'type ::= ID
LBRACKET RBRACKET' and the lvalue rules.

Chris Dodd

Post a followup to this message

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