shift-reduce conflict,

"Thinh T. Nguyen" <ttnguyen@eecs.uic.edu>
7 Mar 1998 22:40:48 -0500

          From comp.compilers

Related articles
shift-reduce conflict, ttnguyen@eecs.uic.edu (Thinh T. Nguyen) (1998-03-07)
Re: shift-reduce conflict, kers@hplb.hpl.hp.com (1998-03-13)
Re: shift-reduce conflict, dgay@barnowl.CS.Berkeley.EDU (1998-03-15)
Re: shift-reduce conflict, kers@hplb.hpl.hp.com (1998-03-18)
| List of all articles for this month |

From: "Thinh T. Nguyen" <ttnguyen@eecs.uic.edu>
Newsgroups: comp.compilers
Date: 7 Mar 1998 22:40:48 -0500
Organization: University of Illinois at Chicago
Keywords: yacc, C, comment

Hello,


I am writing a parser file (input to bison) for a toy JAVA compiler and
am running into a shift-reduce conflict that could not be resolved. The
problem involves


<cast-expression> -> '(' <type> ')' <expression>


where <type> could be any ID. The problem arises when bison parses
something like '(string)' and confuses whether to reduce it to an
expression or keep on parsing because it could be a cast-expression.


Thanks in advance.


--Thinh.
[This is a famous problem in parsing C. The usual hack is to have the
lexer return different tokens for type names and other names, and to do
something revolting in typedef statements. -John]
--


Post a followup to this message

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