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.
> Should then $$ = $1 be applied?
Under yacc, I'm saying yes.
> - 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. I say we simply state our interpretation of the spec, and
use that interpretation as the justification for handling this with
--yacc.
Joel