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: Hans Aberg
Subject: Re: too many warnings from Bison CVS for Pike
Date: Sun, 29 Jan 2006 21:34:57 +0100

On 29 Jan 2006, at 20:11, Joel E. Denny wrote:

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.

That depends on the interpretation of the Yacc specification.

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

Sure, but there has not been any clarification there yet.

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.

The wording is unclear to me. It needs to be clarified. (And the Yacc spec needs to tell that the default value is only valid for rules of length >= 1, and what should happen when the rule length is 0.)

In the case of C, one can do both: always do $$ = $1, or just do it in the case no explicit rule action has been in the grammar. For C++, one should only do the latter. The POSIX specification does not deal much with C++ right now, but is moving towards it.

If I look for other uses of the word "default" and the wording "by default", it means "in the case no other explicit directions has been given". So "By default, the value of a rule shall be the value of the first element in it." means that this is the value if no other explicit value has been given, and if such an explicit value has been given, the default rules does not apply.

This is still unclear, because one can write a rule action explicitly as {}. Should then $$ = $1 be applied? - There is a difference between explicitly indicating a rule action, and explicitly assigning a value to $$.

  Hans Aberg






reply via email to

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