bug-bison
[Top][All Lists]
Advanced

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

Re: $<out of range>


From: Paul Eggert
Subject: Re: $<out of range>
Date: Thu, 25 Apr 2002 16:21:07 -0700 (PDT)

> From: Florian Krohm <address@hidden>
> Date: Thu, 25 Apr 2002 17:42:35 -0400
> 
> [POSIX] also says:
> 
>   An action appearing in the middle of a rule shall be equivalent to
>   replacing the action with a new non-terminal symbol and adding an
>   empty rule with that non-terminal symbol on the laft-hand side. The semantic
>   action associated with the new rule shall be equivalent to the original
>   action....
> 
> Equivalence of rules is not specified AFAICT. It is probably valid to
> assume, that "identical" was meant here. Which would render the GCC grammar
> invalid.

"Identical" isn't quite right, because it would also render invalid
any mid-rule action that accessed the value of a component to its
left, even though I think everybody agrees that that's OK.  For
example, it would mean that

a : b {$<ival>$ = $1} c {$$ = $2};

would be equivalent to

t : {$<ival>$ = $1};
a : b t c {$$ = $2};

but clearly this isn't right, since the $1 needs to be renumbered.

It is a muddy part of the standard, but I don't think the mud affects
the original question.



reply via email to

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