bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to fix problem with embedded rules in GLR parsers.


From: Paul Eggert
Subject: Re: Patch to fix problem with embedded rules in GLR parsers.
Date: 02 Feb 2003 00:19:12 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3

> From: Paul Hilfinger <address@hidden>
> Date: Wed, 29 Jan 2003 15:52:25 -0800

> In response to the report by S. Eken, I have made the following
> changes to GLR-related files.

I see some problems with that patch.  First, the generated parser
contains statements like this:

  (*yyvalp).ival = power (yyvsp[YYFILL (-2)].yystate.yysemantics.yysval.ival, 
yyvsp[YYFILL (0)].yystate.yysemantics.yysval.ival);

and this has undefined behavior in C, because YYFILL updates the
variable yylow, and so we have two parallel subexpressions of the
above statement that are both modifying the same variable yylow, which
is not allowed in C.

Second, if you have a parser that doesn't need to invoke YYFILL, then
GCC warns that the yyfill procedure is defined but not used, and that
the local variable yynormal is defined but not used.  There are a
couple of examples of such parsers in the test cases.

I found these problems by runnning "configure --enable-gcc-warnings"
and then "make check", with GCC 3.2.

Perhaps it would be better not to attempt to fill yyvsp lazily?  In
other words, just before the parser enters an action, eagerly fill a
vector with the rhs-values for that action.  I don't see what lazy
evaluation is buying us here, as I'd guess that it lengthens and
typically slows the generated code.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]