help-bison
[Top][All Lists]
Advanced

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

Re: %destructor feedback


From: Wolfgang Spraul
Subject: Re: %destructor feedback
Date: Thu, 20 Oct 2005 17:33:39 +0200
User-agent: KMail/1.8.1

Akim -

> I'm not sure about %param-destructor, it is not very clean, but just
> like there is %initial-action, we could introduce a %final-action
> always run when leaving yyparse (whether on failure or not).

When you say %param-destructor, do you mean the %destructor-param I was 
talking about?
If so, I don't understand why it is 'not very clean'?
Bison has %parse-param and %lex-param already, adding a %destructor-param 
would make it _more_ clean (consistent) in my view.
Even if there were a %final-action, how would that help me?
I am working with pure-parsers, and the cleanup functions I want to call in my 
yydestructor() function are function pointers that are passed in through a 
state object. So basically I need to pass that state object into yyparse() (I 
am using %parse-param for that), and then on to yydestructor() (that's not 
possible right now).

So what I'm doing is that I compile my .y file into a .cc file, and then do

sed -e 's/yydestruct (const char \*/yydestruct (wolfgangs_state_object * 
state, const char \*/' -e 's/yydestruct ("/yydestruct (state, "/'

Now that is _not clean_ :-)
But it works. If there were a %destructor-param, I wouldn't need the sed 
action.
Regards,
Wolfgang




reply via email to

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