On 11 Jul 2006, at 17:29, Joel E. Denny wrote:
On Mon, 10 Jul 2006, Anthony Heading wrote:
The right point appears to be the b4_post_prologue macro,
but bizarrely this seems to be inaccessible unless the
parser uses %union.
Thanks for the feedback. We've been debating how to clean this
behavior
up.
http://www.wsu.edu/~brians/errors/churchill.html
A solution is actually implemented in CVS, but I'm not sure if that
one will stick. You should see some sort of solution in Bison 2.4.
As proof-of-principle, I created a new directive (naturally
called "%no-union"!) which only flipped the prologue. That
seemed to work OK, but I wonder if there's a better solution?
The developers are currently settling for very simple C++, and there
is little chance you will be able to do normal C++ code writing via
Bison 2.4 or whatever.
There is an experimental %define directive which can be used to place
C++ code correctly, some time in the future when it can be used to
place code, except for 1-liners. So you (Anthony Heading) are on
right track: one needs a way to place code more accurately in order
to do C++. In fact, I have made my own tweaks of Bison for last
couple of years in order to place the C++ code correctly. :-) But I
got tired of patching up the many frequent Bison releases, so I am
currently stuck with Bison 2.0.
And when you use %union, the underlying C++ implementation must
currently be untyped, not something that one would use in ordinary C+
+ programming.
Hans Aberg