|How to clean up on a parse error firstname.lastname@example.org (1994-02-11)|
|From:||email@example.com (Kent Tong)|
|Keywords:||C++, yacc, question, comment|
|Organization:||Key Center of Design Computing, Sydney University|
|Date:||Fri, 11 Feb 1994 12:28:24 GMT|
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 (firstname.lastname@example.org)
[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
Search the comp.compilers archives again.