Re: bison and valgrind
- From: "Rob Thorpe" <rthorpe@xxxxxxxxxxxxxxxxx>
- Date: 29 Mar 2007 02:17:18 -0700
On Mar 29, 7:19 am, Allan Adler <a...@xxxxxxxxxxxxxxxxxxxx> wrote:
I've made some progress and have managed to use bison and flex to write
some simple parsers. The types that they return are complicated data
structures. Before I wrote the parser, the routines I wrote for working
with these data structures were very carefully tested to avoid memory
leaks. One of the things I did to avoid leaks was to use valgrind.
The normal way of using bison is to use it to produce a parse tree.
You write code in the actions that builds up a tree out of nodes, you
only need one or two different types of node. In the actions all that
happens is memory allocation. Then the parser completes and passes
the parse-tree to the next compiler pass. Cleanup is only done after
the parser has completed. Often either 1) The initial parse tree is
never deleted, it exists until the compiler terminates, 2) A GC is
used to clean up the tree, or 3) The whole tree is deleted after some
pass further into the compiler to save memory.
Ask on comp.compilers and you'll get a much more complete answer.
.
- Follow-Ups:
- Re: bison and valgrind
- From: Chris Uppal
- Re: bison and valgrind
- References:
- bison and valgrind
- From: Allan Adler
- bison and valgrind
- Prev by Date: Re: implementation note for scapegoat tree
- Next by Date: Re: bison and valgrind
- Previous by thread: bison and valgrind
- Next by thread: Re: bison and valgrind
- Index(es):
Relevant Pages
|