On 25 Oct 2006, at 00:09, Joel E. Denny wrote:
<!> is really too hieroglyphic for
me.
I realize <!> looks odd when considered in isolation, but I'm
trying to be
consistent with a couple of other proposals....
First, named semantic values:
exp(sum): exp(term1) '+' exp(term2) {
$sum = $term1 + $term2
}
;
grammar(): defs() rules() epilogue(!) {
$grammar = new_grammar ($defs, $rules);
}
;
Here, () = unspecified value name = default name = the symbol
name. That
seems logical to me. (!) = no value is used at all. The ! conveys a
sense of caution, which I think this is appropriate given that its
purpose
would be to disable any Bison warning about unused $3.
I have looked at this, and tried to find an examples of other similar
uses, though I failed. One variation might be
exp/sum: exp/term1 '+' exp/term2 {...}
Instead of the proposed
exp/sum -> exp/term1 '+' exp/term2 {...}
One might use UTF-8 input files, and the symbol U+2192 RIGHTWARDS
ARROW "→"; thus:
exp/sum → exp/term1 '+' exp/term2 {...}
This should solve the parsing problem of the .y files, I think.
Hans Aberg