Declaring $ as part of the value name might help:
exp($sum): exp($term1) '+' exp($term2)
Not that much. Yes, this makes a Perl back-end for Bison even more
difficult, but given Perl 6 has grammars this is not a likely event
anyway (unlike the Java back-end -- shameless plug for my %language patch).
That is, one could potentially choose something other than $. There's an
example of this in TODO as well. For now, we could require that the first
character be $ since searching for any arbitrary sequence in an action
will take some work. I'd just like to get the notation right for now.
As TODO notes, there's still the issue of how to handle locations.
Perhaps Bison could automatically append `_loc' to the value name. So,
exp($sum) would have a value of $sum and a location of $sum_loc.
Please, let's keep $sum and @sum.
Or maybe it should be possible to name these separately:
exp($sum, @sum): exp($term1, @term1) '+' exp($term2, @term2)
Please don't.
Paolo