help-bison
[Top][All Lists]
Advanced

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

Re: When to free RHS tokens?


From: William Brannon
Subject: Re: When to free RHS tokens?
Date: Tue, 27 Dec 2016 13:23:04 -0500

Thanks all, that was very helpful.

On Dec 27, 2016 10:06 AM, "John Levine" <address@hidden> wrote:

> >forvalues_cmd:
> >FORVALUES IDENT "=" NUMBER "(" NUMBER ")" NUMBER "{" STRING_LITERAL "}"
> >    {
> >        // do I need to free() or del tokens $3, $5, $7, $9 and $11?
>
> No.  Bison tokens live in an array, no allocation or deallocation needed.
>
> If the lexer or parser puts a pointer to an allocated thing into a
> typed token, you need to manage those things, but in the simplest case
> where it's just an int, the int is in the array and there's nothing
> for you to do.
>
> R's,
> John
>
>
>


reply via email to

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