help-bison
[Top][All Lists]
Advanced

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

Re: Unabled to Free Discarded Tokens


From: Mike Ady
Subject: Re: Unabled to Free Discarded Tokens
Date: Sun, 15 Feb 2004 13:44:22 -0700

Thanks...

Thanks to everyone who responded to my previous message.  Thanks especially
to Tomas Stanek for his insightful help.  I was working with old
documentation and an old copy of Bison.  Tomas got me straightened out.

I switched to Bison version 1.875, and the "%destructor" directive does
exactly what I need it to do.  However, there was one small problem...  I
added the following directive to my source file:

%destructor {  freetoken($$); } HPTOK_INTEGER  HPTOK_FLOAT

Then Bison generated the following code for each token type I specified:

freetoken(yyvaluep->(null));

That code is invalid and it caused my C compiler to issue an error message.
The problem appears to be that I was declaring the parse value data type
with YYSTYPE instead of with %union.  First I got the parser working by
hacking the output .tab.c file.  Then I switched to a %union directive and
all was well.

This looks like a bug or at least an undocumented feature.  I'll pass a note
along to bug-bison and see if they agree.

Regards,
Mike Ady





reply via email to

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