Yacc error recovery: can you avoid memory leaks?

fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Fri, 25 Sep 1992 04:05:17 GMT

          From comp.compilers

Related articles
Yacc error recovery: can you avoid memory leaks? fjh@munta.cs.mu.OZ.AU (1992-09-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Organization: Computer Science, University of Melbourne, Australia
Date: Fri, 25 Sep 1992 04:05:17 GMT
Summary: Yacc error recovery seems fatally flawed
Keywords: yacc, errors, comment

I am using Yacc in a fairly standard manner to generate a parse tree for
my input programs. I want to avoid memory leaks in my parser.


When-ever there is a syntax error in the input, yacc will simply pop
tokens off the token stack, without releasing the storage for the parse
tree associated with these tokens.


Is there a version of Yacc or Bison that avoids these problems?
--
Fergus Henderson fjh@munta.cs.mu.OZ.AU
[Careful use of error productions should let you get enough control to free
up storage. The manual for MKS yacc goes into some detail explaining how to
do so. MKS catches errors before doing default reductions, so it's easier
in their version than in others. -John]
--


Post a followup to this message

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