David Kastrup <[email protected]> writes:

> David Kastrup <[email protected]> writes:
>
>> "Joel E. Denny" <[email protected]> writes:
>
> [...]
>
>>>> I have not checked that the enhancement for reducing rules with more
>>>> than one token does actually work.  It seems like an obvious change,
>>>> but I don't really understand Bison enough to be sure.
>>>
>>> Does this mean you haven't found need for that enhancement then?
>>
>> Up to now, I have been just doing basic tests and trying to figure out
>> why I could not get stuff to work at all.  It seems one should always
>> be able to program around the missing enhancement by creating
>> one-element rule aliases to all multi-element rules one wants to back
>> up.
>
> Update: no, that does not work, since backing up only moves backwards
> one reduction, so putting an alias in between will not help.  It would
> seem, however, that YYPOPSTACK (yylen) is the wrong thing to do: when
> the action is executed, apparently the stack has already been reduced to
> have one lefthand value left.  So YYPOPSTACK (1) seems correct
> regardless of the value of yylen (possibly excepting yylen==0 though I
> don't think this can ever occur).

Update: I take the update back.  My code was flawed, crashing due to a
different reason.  Indeed YYPOPSTACK (yylen) is the right thing to do
and actually works.

-- 
David Kastrup


Reply via email to