bug-bison
[Top][All Lists]
Advanced

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

Re: %destructor feedback


From: Frank Heckenbach
Subject: Re: %destructor feedback
Date: Wed, 4 Jan 2006 19:06:49 +0100
User-agent: semail 20060101

Joel E. Denny wrote:

> On Wed, 4 Jan 2006, Akim Demaille wrote:
> 
> > 2. An annoying one:
> > 
> > exp: a_1 a_2 { $<val>$ = 3; } { $<val>$ = $<val>3 + 1; } a_5
> >      sum_of_the_five_previous_values
> >     {
> >        printf ("%d\n", $6);
> >     }
> > 
> > this rule is actually using all the values from $1 to $5 (the rule for
> > $6 uses $-n to do that).  So one wishes to spell that out to Bison to
> > avoid the warning:
> > 
> >       USE (($1, $2, $3, $4, $5));
> > 
> > But then... bison complain about our using $3 and $4 with no specified
> > type tag, i.e., one has to write
> > 
> >       USE (($1, $2, $<foo>3, $<bar>4, $5));
> 
> Yikes.  Specifying a meaningless type is ugly.

Indeed, it looks ugly. OTOH, this seems a rather uncommon situation
(using $-n is already ugly, IMHO -- is it POSIX conformant
actually?), so I'm not convinced we need special effort in Bison to
spare a few characters in such a particular situation. (But of
course, it's not up to me to decide how much effort others put in
it. ;-)

> So maybe we should drop the YYUSE_VAL/USE macro idea and create some sort 
> of construct that bison should parse.  This would be more flexible.
> 
> It looks strange at first glance, but the first thing that pops into my 
> mind is:
> 
>   $<>1; $<>2; $<>3; $<>4; $<>5;

In this case, Bison could also warn if such a variable is actually
used, e.g.:

  $<>1;
  foo ($1);  /* or: foo ($<type>1); */

Frank

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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