Related articles |
---|
Reduce/Reduce Conflict ? ashwin21_99@hotmail.com (Ashwin) (2003-02-21) |
Re: Reduce/Reduce Conflict ? matt@NOSPAMbeastrider.com (Matt) (2003-02-24) |
Re: Reduce/Reduce Conflict ? snicol@apk.net (Scott Nicol) (2003-02-24) |
Re: Reduce/Reduce Conflict ? slk14@earthlink.net (SLK Parsers) (2003-03-02) |
From: | "Scott Nicol" <snicol@apk.net> |
Newsgroups: | comp.compilers |
Date: | 24 Feb 2003 13:52:07 -0500 |
Organization: | APK Net |
References: | 03-02-124 |
Keywords: | parse |
Posted-Date: | 24 Feb 2003 13:52:06 EST |
"Ashwin" <ashwin21_99@hotmail.com> wrote in message
news:03-02-124@comp.compilers...
> Type:
> IDENTIFIER
> ;
This is your problem. You have both ParenthesizedExpression and
CastExpression with a reduction in the middle that looks like OPENPAREN
IDENTIFIER. Simplest fix is to introduce another terminal, lets call it
TYPEIDENTIFIER. Change your Type rule to:
Type:
TYPEIDENTIFIER
;
and the reduce/reduce is solved. Now you have passed off to the lexer the
problem of figuring out whether an identifier is a IDENTIFIER or
TYPEIDENTIFIER. I'd suggest adding a "token" field to the symbol table
entry type. When the lexer sees an identifier, look it up in the symbol
table and return ident->token.
--
Scott Nicol
snicol@apk.net
Return to the
comp.compilers page.
Search the
comp.compilers archives again.