Re: Initialise tokens in bison/flex

Maneki Neko <{spamtrap}>
17 Mar 2002 22:29:08 -0500

          From comp.compilers

Related articles
Initialise tokens in bison/flex (Torsten Rupp) (2002-03-09)
Re: Initialise tokens in bison/flex (2002-03-11)
Re: Initialise tokens in bison/flex {spamtrap} (Maneki Neko) (2002-03-17)
Re: Initialise tokens in bison/flex (Clint Olsen) (2002-03-17)
Re: Initialise tokens in bison/flex (2002-03-17)
| List of all articles for this month |

From: Maneki Neko <{spamtrap}>
Newsgroups: comp.compilers
Date: 17 Mar 2002 22:29:08 -0500
Organization: The foot bone's connected to the ankle bone, etc ...
References: 02-03-046
Keywords: yacc
Posted-Date: 17 Mar 2002 22:29:08 EST

Torsten Rupp <> writes:
> Does anybody know how I can handle resource allocation/free resources
> in tokens for bison/flex? E. g. allocate a dynamic array when scanning
> a token and free this memory after the last usage.

> [lex, yacc, and their variants don't handle this very well, particularly
> if you try to do error recovery. My usual approach is to chain all the
> allocated storage together, then zip through after each parse and give
> it all back. -John]

Rather than tie oneself in knots to manage memory, use a garbage
collector. If you're absolutely tied down to C, use Hans Boehm's
conservative garbage collector, which often drops in with no extra

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.