[antlr-interest] save a tree

Terence Parr parrt at cs.usfca.edu
Fri Jan 11 12:53:50 PST 2008


isn't there a "save as XML" method or somethign?
Ter
On Jan 11, 2008, at 12:06 PM, Benjamin Niemann wrote:

> Hi Mathew,
>
> Mathew Yeates wrote:
>> From within a java program I want to save (to disk) the AST I've
>> created. Then I want to read it back into a python program. Anyone  
>> have
>> any ideas about the simplest approach to this?
>
> I'm not aware of any format, package, whatever (something that could
> (de)serialize custom objects cross language) that could help you  
> here - and
> ANTLR does not offer anything here. So you probably have to build  
> your own
> serialization in Java and deserialize in Python - and ANTLR does not  
> offer
> anything here.
> Just walk to AST and dump all info that you need in a easy to parse  
> format
> and read it back in Python building the nodes along the way.
>
> -Ben
>
> -- 
> Benjamin Niemann
> Email: pink at odahoda dot de
> WWW: http://pink.odahoda.de/
>



More information about the antlr-interest mailing list