Related articles |
---|
How to clean up on a parse error tongk@cornea.su.edu.au (1994-02-11) |
Newsgroups: | comp.compilers |
From: | tongk@cornea.su.edu.au (Kent Tong) |
Keywords: | C++, yacc, question, comment |
Organization: | Key Center of Design Computing, Sydney University |
Date: | Fri, 11 Feb 1994 12:28:24 GMT |
Hi!
I'm using bison++ to parse the usual expression. I have
a rule like:
exprlist : exprlist '+' expr
{
...
}
| exprlist '-' expr
......
My problem is that after exprlist has been parsed successfully &
some memory has been allocated for it, if there is no '+' following
or the following expr is invalid, how can I free the memory
allocated for exprlist?
Thank you very very much!
--
Kent Tong (tongk@archsci.arch.su.edu.au)
[Freeing memory on yacc parse errors has never been easy. In C parsers,
I usually chain the memory blocks together so I can free them all at once
at the end of the parse. But C++ discourages such hacks. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.