[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %destructor feedback
From: |
Joel E. Denny |
Subject: |
Re: %destructor feedback |
Date: |
Wed, 4 Jan 2006 12:50:47 -0500 (EST) |
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.
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;
That is, bison would see any occurrence of `$<>1' as a usage of $1 but,
because of the `<>', would know to strip it out of the C/C++ code in order
to hide it from the compiler. I guess one could rationalize the weird
notation by saying it means something like `ignore the semantic type'.
Because the semicolons make this look nicer, perhaps they should be
required?
Joel
- Re: %destructor feedback, (continued)
- Re: %destructor feedback, Paul Eggert, 2006/01/03
- Re: %destructor feedback, Joel E. Denny, 2006/01/03
- Re: %destructor feedback, Joel E. Denny, 2006/01/03
- Re: %destructor feedback, Akim Demaille, 2006/01/03
- Re: %destructor feedback, Akim Demaille, 2006/01/04
- Re: %destructor feedback,
Joel E. Denny <=
- Re: %destructor feedback, Frank Heckenbach, 2006/01/04
- Re: %destructor feedback, Joel E. Denny, 2006/01/04
- Re: %destructor feedback, Akim Demaille, 2006/01/04
- Re: %destructor feedback, Joel E. Denny, 2006/01/04
- Re: %destructor feedback, Akim Demaille, 2006/01/05
- Re: %destructor feedback, Joel E. Denny, 2006/01/05
- Re: %destructor feedback, Paul Eggert, 2006/01/04
- Re: %destructor feedback, Akim Demaille, 2006/01/05