help-bison
[Top][All Lists]
Advanced

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

Destructor trouble


From: Hans Yperman
Subject: Destructor trouble
Date: Tue, 13 May 2003 12:00:58 +0200 (CEST)

Hello everyone,

i have some trouble with understanding the %destructor feature: if I have
a rule:

%type<pointertype> a b c d
%destructor {do_something} pointertype

a: b c d {
                if(trouble) YYERROR
        }

Say b,c and d are pointers that should be freed.
If trouble happens, should i free b, c and d myself, or are they cleaned
by  YYERROR?  And is it possible to call the destructor in the bison code,
say with something like:

if(trouble){ YYDESTRUCT(b); ...; YYERROR;}

Also, if i write yyerror() so that it longjump()s out of the parser, how
can i clean up the stack? This is an issue, as in my program, yyerror()
is called by some other modules that also should clean up the stack
(e.g. error in the input stream or the lexer)

Another issue:  I run both bison 1.35 (from Debian) and bison 1.875
(GNU).  The last one is so immensely slow compared by the first one,
spending almost 30 seconds running m4. Does someone know why?

Oh, and one more thing.  The bison html documentation on the gnu site is
not up-to-date.  I can't find anything about %destructor in it.  If there
are syntax errors in my example, i'm sorry (But you get what i mean
with it, i guess).

Thanks in advance,

Hans.





reply via email to

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