help-bison
[Top][All Lists]
Advanced

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

Re: How to free symbols during error recovery


From: sad0ur
Subject: Re: How to free symbols during error recovery
Date: Wed, 6 Oct 2004 17:30:14 +0200
User-agent: Mutt/1.3.28i

On Wed 06.10 (17:14), Oliver Boris Fischer wrote:
> Hello,
> 
> I've written a bison based parser, where I defined  YYSTYPE as pointer 
> to a C structure, which I am allocate within lex/flex and free within 
> bison. This seems to work fine if no parser error occurs. But if an 
> error occurs and the parser unwinds its stack, I have no chance to free 
> them.
> 
> What is the recommended strategy in such situations?

%destructor feautre is probably what you want.

like:

%destructor { free($$); } IDENTIFIER FILENAME

(where IDENTIFIER and FILENAME are LEX tokens)




reply via email to

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