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: Laurence Finston
Subject: Re: How to free symbols during error recovery
Date: Fri, 8 Oct 2004 14:53:43 +0200 (MEST)

On Fri, 8 Oct 2004, Akim Demaille wrote:

> >>> "Laurence" == Laurence Finston <address@hidden> writes:
>
>  >> Again, I'm not taking _at all_ about error recovery :)
>
>  > I don't understand.  I'm talking about destroying objects when they
>  > are popped from the stack, which happens when parse errors occur.
>
> Parse error != error recovery.

No, but I've been assuming that a parse error should cause error recovery
to be attempted, either by using the `error' token in rules, or in some
other way.  Please bear with me if I'm not getting your point.

>
> But maybe you wrote this sentence before the following one which was
> above in your answer:
>
>  > I've been assuming that when the `error' token isn't used anywhere,
>  > `yyparse()' just returns 1 right away, without popping states from
>  > the stack.  It just occurred to me that this might not be the case.
>
> It is not, indeed.
>

Then I will either have to use `%destructor', make sure that I
always have a pointer to all dynamically allocated objects, or accept
that parse errors may cause memory leaks.

>
>
>  > In other cases, I don't need a destructor because, like Oliver, I
>  > take care of allocating and freeing memory by hand.  If I'm missing
>  > something here, please explain it.
>
> You don't seem to _need_ it, but I think you want it.
>

I certainly plan to look into using `%destructor'.  Since I only take
responsibility for making sure 3DLDF runs on GNU systems, I won't
have the problem of getting it to work on non-free ones.

Laurence




reply via email to

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