|shift-reduce conflict, email@example.com (Thinh T. Nguyen) (1998-03-07)|
|Re: shift-reduce conflict, firstname.lastname@example.org (1998-03-13)|
|Re: shift-reduce conflict, dgay@barnowl.CS.Berkeley.EDU (1998-03-15)|
|Re: shift-reduce conflict, email@example.com (1998-03-18)|
|From:||"Thinh T. Nguyen" <firstname.lastname@example.org>|
|Date:||7 Mar 1998 22:40:48 -0500|
|Organization:||University of Illinois at Chicago|
|Keywords:||yacc, C, comment|
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
<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.
[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]
Return to the
Search the comp.compilers archives again.