help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Token types with constructor


From: Wolfgang Wieser
Subject: Re: Token types with constructor
Date: Fri, 3 Sep 2004 17:50:48 +0200
User-agent: KMail/1.6.2

On Thursday 02 September 2004 19:34, Hans Aberg wrote:
> You are essentially saying that, by certain assumptions on how the C-parser
> is implemented, you can write a proper C++-stack, which does what a proper
> sequence container would do.
>
> This is a quick-and-dirty implementation, as there is no guarantee that
> future Bison versions uses the same stack implementation. For example,
> Bison uses up to three stacks, for semantic, state and locations values,
> but these can, if one so wants, be merged into a single stack.
>
Merging stacks will not pose any problem since all the C-types will get a 
suitable constructor automatically by the C++ compiler. We just need to 
make sure that these are actually called. And since malloc()/free() will 
not do this, we need to call the constructors/destructors "by hand". 

Of course this solution is semi-clean as from the design. 

But it has no trouble when restructuring the inner workings and layout of 
the stack. At least I cannot see any. 

> So, if it works for you now, that is fine. But it is not a Bison standard
> C++ solution that you have come up with.
>
I did not try it out, actually. I'm using this "technique" in other sources. 

Wolfgang

-- 
People keep telling me "Full quote is bad style". 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]