ANTLR and Java
Does anyone here have any experience with antlr? I'm trying to auto generate some code (no need to get into the evils of code generation...) and am able to parse the java code, and alter the AST nodes to my liking. However, I cannot figure out how to convert the AST nodes back into java source code.
Can you walk the tree and generate the Java code representation of each node?
That's what I had started to do, but can't shake the feeling that there must be some automatic way to do this. I somehow doubt I'm the first person to need to do this. Thanks for the response though.
ANTLR has a tree-parser that might help with this (http://www.antlr.org/doc/sor.html). A Prolog-style rule engine might be helpful here. I'm working on something like that for my CFG parser generator, actually. You should be able to say something like:
ANTLR generates parsers and tree-walkers.
Fog Creek Home