bison-patches
[Top][All Lists]
Advanced

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

Re: too many warnings from Bison CVS for Pike


From: Joel E. Denny
Subject: Re: too many warnings from Bison CVS for Pike
Date: Sun, 29 Jan 2006 14:11:16 -0500 (EST)

On Sun, 29 Jan 2006, Hans Aberg wrote:

> On 29 Jan 2006, at 18:28, Joel E. Denny wrote:
> 
> > Beyond the C++ issue you raise, it seems that an action containing nothing
> > but $$ = $2 ought to warn about an unused (typed) $1.
> 
> Unused token values are pretty common: just take
>   "if" A "then" B
> Here, the token values of "if" and "then" will be unused in the rule action.
> If this should work, I guess you are calling for a special token type, say
> "void", and the warning should come if some non-void $k isn't used.

We already have this "void" type: just don't declare a type.

> Now, with a code placement in hand, one wants to be able to put code at
> various place, including just ahead of the switch statement; call the macro
> say 'pre-switch'. Then a fix under C for those that want $$ = $1 would a
> grammar '.y' file containing:
>   %define pre-switch { if (yylen >= 1)  $$ = $1; }

This isn't yacc compatible.  If the Open Group says we need implicit $$ = 
$1 for explicit actions, bison needs to support it for pure yacc 
specifications.

Maybe there's still the question of what exactly they mean by:

  By default, the value of a rule is the value of the first element in it.

I feel pretty sure that Paul is right: `By default' does *not* mean `When 
the user doesn't specify the action'; it means `When the user doesn't 
specify the value of the rule'.  In other words, in all cases, $1 is the 
default value of $$.  So, this is a yacc issue.

Joel




reply via email to

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