help-bison
[Top][All Lists]
Advanced

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

Re: Question about token stack


From: Akim Demaille
Subject: Re: Question about token stack
Date: Sun, 30 Aug 2020 17:04:50 +0200


> Le 30 août 2020 à 16:36, Ervin Hegedüs <airween@gmail.com> a écrit :
> 
> I just put:
> 
> %destructor { printf("free() called\n"); free ($$); } <*>
> 
> but it never called, and valgrind still shows that the block is
> still reachable.

You should add debug traces and study them.  Pay special attention
to the error recovery sequence.

> Btw I reviewed the generated code, but I'm afriad this destructor
> called only when the parser run into the error state.

Yes, that's what the doc says, and that is what I believed is
what you are trying to address.

> Now I thought what happens if the scanner found an unrecognized
> token after the previous was pushed into stack - that item is
> sill at there. So I'm still curious, how can I clear the whole
> stack.

Since you don't have error-recovery, your stack will be cleared.
Show us your debug traces (yydebug = 1).

Cheers!




reply via email to

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