[antlr-interest] Rewriting java source code

Morten Olav Hansen mortenoh at gmail.com
Fri Nov 5 09:13:48 PDT 2010


Hi

I'm currently trying to rewrite some java source code, and was looking
for some pointers for doing this. I have added the Java.g (1.5)
grammar and is currently using the grammar for parsing java files,
with no problems.

What I'm wondering is, how to proceed from this? I have used
StringTemplates before, but it seems to be a lot of work when I'm only
interested in rewriting small parts of the grammar, since I would have
to add rewrite rules for the entire java language, and I couldn't find
any pre-made files for this.

Could something like this be accomplished using a tree walker?

Any ideas or examples would be appreciated, thanks.


Regards,
Morten


More information about the antlr-interest mailing list