[antlr-interest] CommonTree between target languages

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Fri Mar 20 03:43:57 PDT 2009


Des Hartman wrote:
> This is a question that I suspect the answer is No, but I thought I'd 
> ask anyway.
> 
> If I have two implementations of ANTLR in different languages; 
> ActionScript and Java, Is there a way that I can share the AST Tree 
> (CommonTree) Objects between them?
> 
> Idea is I enter a formula in a Flex application and do the parsing to 
> AST using Actionscript. Once done I send the CommonTree objects to the 
> server and this is based on Java. Here the server uses the same AST to 
> then repeat the calculations on a much greater dataset.

It's certainly possible in theory, but I don't know of any easy way. 
You'd probably need some degree of custom code for marshal/unmarshal of 
the the ActionScript objects in Java. If they were transmitted in some 
vaguely-standard format, like JSON or some form of XML, you might be 
able to use libraries to help with the Java handling, but direct 
object--object translation seems unlikely.

-- 
Sam Barnett-Cormack


More information about the antlr-interest mailing list