help-bison
[Top][All Lists]
Advanced

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

Re: %left is not working


From: Sasan Forghani
Subject: Re: %left is not working
Date: Wed, 4 Aug 2010 12:39:36 -0400

Thank you for the information.  However, how does this relate to the
$<blIdentifier> problem I am having.  To be more specific, the problem where
the $<blIdentifier> of the ASSIGNMENT production ends up with the same value
of the ( expr ) production.

On Wed, Aug 4, 2010 at 9:04 AM, Hans Aberg <address@hidden> wrote:

> On 4 Aug 2010, at 14:17, Sasan Forghani wrote:
>
>  I apologize for my lack of understanding.  You said the next step is to
>> clean it up in the actions... please clarify?
>>
>
> When you allocate stuff using malloc, strdup, etc. when pointer is not used
> anymore, to avoid memory leak, one must apply free(). For example, an action
> might look like
>  $$ = malloc(...) // pr something
>  // copy over some stuff from the $k values.
> Now the, $k values are not used anymore - only $$, so they must be cleaned
> up using free().
>
> This works if you do not want to do error recovery. For that there is a
> special function (see the Bison manual).
>
> I do not program in C, but C++, where the language is taking care of this.
> So perhaps some else might give better examples.
>


reply via email to

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