yacc reduce/reduce conflict question
Ming-Hsiun Tsai
tsaim at eecs.nwu.edu
Thu Sep 7 06:17:08 AEST 1989
Dear Jeff:
The error message on our system is not the same as on your system.
So, I mis-understand that MNEMONIC_ is a (non-)terminal sysbol. I do the
two tests below.
The first one is the one like yours (I hope I do not make any mistake
this time). Also I append the error message I get from my system.
The second one is a correct one (YACC does not say anything wrong).
Comparing the two. I think the problem is the "=" symbol in the rules.
I don't know if "=" has special meaning translated by yacc. I have no
yacc manual on hand. If you have, check it out.
Conclusion: add "'" on both sides of "=".
Try it. Hope it work for you. Good luck.
Ming-Hsiun Tsai (Sep. 6, 1989)
---------------------- Example 1. An error demo ------------------------------
%token MNEMONIC
%start all
%%
all : cmd_parameter
| arg
;
cmd_parameter : MNEMONIC = MNEMONIC
;
arg : MNEMONIC
;
%%
-------------------------------------------------------------------------------
1 rules never reduced
conflicts: 1 reduce/reduce
--------------- Example 2. This one may give you some ideas ------------------
%token MNEMONIC
%start all
%%
all : cmd_parameter
| arg
;
cmd_parameter : MNEMONIC '=' MNEMONIC
;
arg : MNEMONIC
;
%%
-------------------------------------------------------------------------------
More information about the Comp.unix.wizards
mailing list