help-bison
[Top][All Lists]
Advanced

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

destruct object when is popped from bison stack?


From: Jakub M
Subject: destruct object when is popped from bison stack?
Date: Sun, 19 Jun 2011 12:38:52 +0200

Hi

I allocate a new object for each token, and i would like to delete the
object when the token is not used anymore. Is there any directive that
would run the delete code every time a token is popped from the stack?
I thought %destructor is the one, but now I am not sure... Exemplary
code below/

%union{
    char * sval;
    Variable * vval;
}

%token VARIABLE
%token Literal
%type <vval> Expression VARIABLE
%type <sval> Literal

%destructor { delete $$; } <vval>
%destructor { delete $$; } Literal



reply via email to

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