help-bison
[Top][All Lists]
Advanced

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

Re: %destructor and unused values


From: Akim Demaille
Subject: Re: %destructor and unused values
Date: Mon, 28 Jan 2013 18:02:22 +0100

Le 28 janv. 2013 à 17:11, John P. Hartmann <address@hidden> a écrit :

> On 28 January 2013 16:43, John P. Hartmann <address@hidden> wrote:
>> But here is another one:
>> 
>>               |  dotobyfors dotobyfor { listend($1, $2); }
>> 
>> Gets "warning: unset value: $$".
>> 
>> I'm relying on the default $$ = $1 here.
>> 
>> Or is there something more subtle going on?  Or (shudder) is the
>> default applied only when there is no explicit semantic code?  (In
>> which case I have a lot of grammars to fix.)
> 
> Adding $$ = $1 kept Bison quiet.
> 
> Here is a variation that gets Unused value $1.
> 
> assign         :  variable ASSIGN expression
>                  {
>                     $$->term.oper = op_assign;
> 
> This is also fixed by stating the default action.
> 
> Surely this is a bug (?).

Actually, I prefer to leave this as is, instead of promoting
the fact that $$ = $1 is run beforehand.  This is not true
for all the configurations (where the warning is right),
so I still prefer pushing the users towards explicitly
perform their $$ = $1 themselves.

Besides, you are not supposed to know that $$ = $1 is always
run before.  The documentation should only state that if
no action at all is provided, then this action defaults to
{ $$ = $1; }.




reply via email to

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