[antlr-interest] Translating from one language to another

David Tauzell dave at tauzell.org
Mon Jul 21 12:54:01 PDT 2008


I'd like to translate from language A to java.  I've written a grammar that
parses language A and generates an AST.   The language is mostly like java,
except there are a few cases where I'll need to change the input.  For
example, something like:

    a.b.c.d = foo

will be converted to

    a.get("b").get("c").get("d").setValue(foo)

Other stuff like:

   if( foo == "bar") {
      ...
   }

can stay like it is.

I'm not sure what is the best way to proceed.  Should I somehow use
StringTemplate?  Should I walk the AST and generate output? Is this question
to vague? Do I just need to buy the ANTLR book and learn more about ANTLR?

Thanks,
    Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080721/5efd4e8e/attachment.html 


More information about the antlr-interest mailing list