I am using the C runtime. I have a lexer and a parser. Then I run a constant expression reduction tree walker, which rewrites some nodes (rewrite = false). Then I run a semantic analysis tree walker, which also rewrites some nodes (rewrite = false). Then, at a much later time determined by the user, I run a code generation tree walker. I have to keep the final tree (from the semantic analyzer) around as long as the program is running, which could be hours.
The C runtime example that does something similar, polydiff, keeps all of the separate node streams and all of the intermediate trees around until it no longer needs the final tree. The Java version keeps overwriting the nodes variable (which holds the node stream), so presumably that is getting freed before the start of each tree walker pass. But also it keeps all the intermediate trees. If I try to free the first tree generated by the parser after running the first tree walker (which gives me a different tree), the program crashes on the free. If I try to free the node stream, the tree becomes invalid and I crash the next time I try to access it. I don't honestly have to keep all intermediate tree results and node streams around forever, do I? What can I safely get rid of and when? Thanks, Karim List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
