|
From: | Hans Aberg |
Subject: | Re: FYI: default %printer/%destructor |
Date: | Sat, 18 Nov 2006 21:38:09 +0100 |
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 beconsistent 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. Thatseems logical to me. (!) = no value is used at all. The ! conveys asense of caution, which I think this is appropriate given that its purposewould 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
[Prev in Thread] | Current Thread | [Next in Thread] |