wrc error

Bang Jun-Young bjy at mogua.org
Fri Jun 22 23:59:05 CDT 2001

On Fri, Jun 15, 2001 at 08:09:54AM -0700, Francois Gouget wrote:
>    I wanted a preprocessed version of the user32.rc file. But Bang
> Jun-Young sent me the files generated by flex/bison which allowed me to
> reproduce the problem. I have not yet found a fix but the problem is in
> the y.tab.c file.
>    Bang Jun-Young is using byacc while I'm using bison so the files are
> quite different and about impossible to compare. When I compile
> parser.y I get:
> bison -y  -d -t ./parser.y
> conflicts:  2 shift/reduce

I get the same warning with byacc.

>    Maybe that's the source of the problem: byacc resolves the conflicts
> differently from bison which causes tehe parse to fail.

Now I think I have found the reason. It was due to a bug in
byacc. From parser.y of revision 1.25:

	| tNL	/*
		 * This newline rule will never get reduced because we never
		 * get the tNL token, unless we explicitely set the 'want_nl'
		 * flag, which we don't.
		 * The *ONLY* reason for this to be here is because Berkeley
		 * yacc (byacc), at least version 1.9, has a bug.
		 * (identified in the generated parser on the second
		 *  line with:
		 *  static char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93";
		 * )
		 * This extra rule fixes it.
		 * The problem is that the expression handling rule "expr: xpr"
		 * is not reduced on non-terminal tokens, defined above in the
		 * %token declarations. Token tNL is the only non-terminal that
		 * can occur. The error becomes visible in the language parsing
		 * rule below, which looks at the look-ahead token and tests it
		 * for tNL. However, byacc already generates an error upon reading
		 * the token instead of keeping it as a lookahead. The reason
		 * lies in the lack of a $default transition in the "expr : xpr . "
		 * state (currently state 25). It is probably ommitted because tNL
		 * is a non-terminal and the state contains 2 s/r conflicts. The
		 * state enumerates all possible transitions instead of using a
		 * $default transition.
		 * All in all, it is a bug in byacc. (period)
I added a line to parser.y (r1.26) as follows:

--- parser.y	2001/06/06 21:04:08	1.26
+++ parser.y	2001/06/23 04:28:52
@@ -423,6 +423,7 @@
 			want_id = 1;
 		dont_want_id = 0;
+	| resources tNL
After doing that, I could build Wine successfully again. I'll
send a complete patch including above comment to wine-patches 

Bang Jun-Young <bjy at mogua.org>

More information about the wine-devel mailing list