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 23:01:03 +0100

On 29 Jan 2006, at 21:56, Joel E. Denny wrote:

On Sun, 29 Jan 2006, Hans Aberg wrote:

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

  %define pre-switch { if (yylen >= 1)  $$ = $1; }

This isn't yacc compatible.

That depends on the interpretation of the Yacc specification.

???

???

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 {}.

Which doesn't give any `explicit directions' for the value for the rule.

Sure it does: Do not do anything. This is useful under C++, if one wants to avoid unneeded copying.

Should then $$ = $1 be applied?

Under yacc, I'm saying yes.

But it is not a question of what you think, but what the POSIX spec intends. This is unclear.

- There is a difference between explicitly
indicating a rule action, and explicitly assigning a value to $$.

That's exactly my point.

Anyway, we can debate this all week and get no where.  I think Paul's
point is valid: regardless of what the Open Group says, executing $ $ = $1 before explicit actions will offer the widest compatibility with existing
yacc grammars.

You are jumping to conclusions: some grammars may assume this, in light that it is something has has worked in the past. In case of a change, one will have to consider the effort to rewrite such grammars.

I say we simply state our interpretation of the spec, and
use that interpretation as the justification for handling this with
--yacc.

As a principle of development, this is a poor strategy: just because something has worked in the past against existing Bison version, but unofficial, it does not mean one should keep it in future versions. One example is the unofficial compile C as C++ that existed for awhile, but that was abandoned in view that it was too difficult to maintain.

I think that the Open Group should clarify its intent. When this has been done, one can take a new look at the problem. In the interim, one can keep the $$ = $1 executed always, as in old Bison version, as it does not cause any harm under C. If the code placement %define eventually appears in Bison, it becomes easy enough to admit a switch, in the case the Open Group says so, in which case it will be important for grammars to change as well. The C++ skeleton file should do what is right for C++, i.e., only execute $$ = $1 for rules with a default action (i.e., no action brackets {...} present).

  Hans Aberg






reply via email to

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