We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The C backend defines constructors, but no destructors for ASTs.
Too add a recursive deallocation procedure e.g. for grammar Calc.cf we need to:
Calc.cf
Absyn.h
void freeExp(Exp p);
Absyn.c
void freeExp (Exp p) { switch (p->kind) { case is_EAdd: freeExp(p->u.eadd_.exp_1); freeExp(p->u.eadd_.exp_2); break; case is_ESub: freeExp(p->u.esub_.exp_1); freeExp(p->u.esub_.exp_2); break; case is_EMul: freeExp(p->u.emul_.exp_1); freeExp(p->u.emul_.exp_2); break; case is_EDiv: freeExp(p->u.ediv_.exp_1); freeExp(p->u.ediv_.exp_2); break; case is_EInt: break; } free(p); }
The code could be adapted from the printer generator.
The text was updated successfully, but these errors were encountered:
a9d360d
define
Similarly, we want clone_XXX methods to recursively copy trees.
clone_XXX
Sorry, something went wrong.
[ #348 ] C: prefix deallocators with free_ to match current snake-cas…
120a86c
…e style
[ #348 ] C: add clone_* methods for AST types
71db99e
andreasabel
No branches or pull requests
The C backend defines constructors, but no destructors for ASTs.
Too add a recursive deallocation procedure e.g. for grammar
Calc.cf
we need to:Add to
Absyn.h
Add to
Absyn.c
The code could be adapted from the printer generator.
The text was updated successfully, but these errors were encountered: