[antlr-interest] starting with language translation

Andy Tripp antlr at jazillian.com
Thu Mar 13 13:15:05 PDT 2008


On the other hand, you could just spend
about half an hour downloading ANTLR, running it on
java.g, and using JavaEmitter.java to print the AST.

You could then start modifying JavaEmitter to produce
actionscript, and never have to learn any ANTLR or StringTemplate
at all, and know nothing about lexing and parsing. All the information
you'll ever need is there, in the AST that you're printing.

You'll have a lot of work just in really understanding what the
AST looks like and how to map Java code to actionscript. Having to
learn a lot about ANTLR at the same time makes it much more difficult.

IIRC, this is what the Java-to-Python guy did, and the approach
worked out fine.

Andy


Richard Clark wrote:
> hi benzo,
> 
> To make some practical suggestions:
> 1. Do a couple of smaller "warm up" projects before tackling Java to
> Actionscript. Define a subset of Java and define your own parser and
> tree generator. Look at generated trees and write a little code to
> modify them. Write a little StringTemplate test case, and so on...
> 2. Java and Actionscript have different semantics in many places (e.g.
> Java's class-based inheritance vs. Actionscript's prototype-based
> inheritance.) Think about how you're going to bridge those
> differences. Many people wind up writing a runtime library for the
> target language to simplify the translation process.
> 3. Apply unit tests throughout your development. There are just so
> many ways a project of this size can introduce subtle bugs that you
> want automated tests to keep an eye on things.
> 
> Oh, and welcome to the community. :)
> 
> ...Richard
> 



More information about the antlr-interest mailing list