[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: default %printer/%destructor
From: |
Paolo Bonzini |
Subject: |
Re: FYI: default %printer/%destructor |
Date: |
Wed, 25 Oct 2006 10:36:39 +0900 |
User-agent: |
Thunderbird 1.5.0.7 (Macintosh/20060909) |
[Joel, I added some clarifications at the bottom]
grammar(): defs() rules() epilogue(!) {
$grammar = new_grammar ($defs, $rules);
}
;
Here you won't break grammar source compatibility by omitting the ()
altogether.
%destructor(!) { printf ("A symbol was discarded.\n"); } <!>
Here, symbols with no type tags have no values but still have a
%destructor.
Of course, if no symbols in your grammar have type tags, or if you
plan to use $<tag>$ extensively for untagged symbols, it might be
reasonable to have <!> without (!) in a %destructor.
I still don't see much similarity with (!) and Then, why not having
%destructor BLOCK
implement a <*> destruction, and something like
%destructor(!) BLOCK
%destructor BLOCK %pragma(unused-value)
implement a <!> destruction? Going for the latter, of course, would
imply the possibility to do
%destructor BLOCK %pragma(unused-value) <foo>
even if foo is not untagged.
For now, this would mean having only the semantics of <*> available.
But besides debugging code, why would <!> functionality be useful?
Paolo