Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Yacc Parsers

Name: Anonymous 2011-11-23 22:39

How to properly release heap-based symbols in a POSIX-compliant parser generated by Yacc? Standard Yacc does not support the convenient %destructor directive present in modern versions of GNU Bison.

The only possible alternatives I see in this behalf are:
    - Avoid heap allocation and use static allocation; (easy but bad)
    - Provide some means to save every allocated pointer during grammar traversal in some context and release the pointers appropriately afterwards; (boring to implement, bloats the code, not worth the hassle)
    - Use some pool allocator. (Inconvenient and yield pointers without free()-semantics)

Suggestions are appreciated.

Name: Anonymous 2011-11-23 23:17

easy but bad
Why? If it works, use it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List