|Help with Yacc reduce/reduce conflict firstname.lastname@example.org (Warren) (2010-06-21)|
|Re: Help with Yacc reduce/reduce conflict email@example.com (glen herrmannsfeldt) (2010-06-23)|
|Re: Help with Yacc reduce/reduce conflict firstname.lastname@example.org (russell kym horsell) (2010-06-24)|
|Re: Help with Yacc reduce/reduce conflict email@example.com (Paul Mann) (2010-07-01)|
|Date:||Mon, 21 Jun 2010 20:10:33 -0700 (PDT)|
|Posted-Date:||23 Jun 2010 09:53:46 EDT|
I'm writing a tool for novice Java students to submit their programs
on-line and get back warnings about common mistakes, e.g. if (x = y),
and assignments where the == operator is used instead of =.
I've started with the Yacc-based Java grammar at
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y and pruned
it down to this: http://minnie.tuhs.org/Z/java.y
I'm modifying the grammar to accept illegal Java constructs, so that
they can be identified as mistakes. Right now I am trying to add the
'==' operator to assignments, but I am getting 4 reduce/reduce
conflicts. The specific added rule causing the problem is:
left_hand_side assignment_operator assignment_expression
| left_hand_side '==' assignment_expression /* This one!*/
| left_hand_side assignment_operator error
I can see the conflicts in y.output, but after trying all day to fix
them, I'm stuck. I have read several on-line tips for solving this,
e.g. A Quick Introduction to Handling Conflicts in Yacc Parsers by
Saumya Debray, but still no luck.
Any suggestions on how to restructure the grammar to resolve this
would be most appreciated!
Return to the
Search the comp.compilers archives again.