How to clean up on a parse error (Kent Tong)
Fri, 11 Feb 1994 12:28:24 GMT

          From comp.compilers

Related articles
How to clean up on a parse error (1994-02-11)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (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 (
[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]

Post a followup to this message

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