[antlr-interest] save a tree

Mathew Yeates myeates at jpl.nasa.gov
Fri Jan 11 15:04:33 PST 2008


I found something called xmlserialize in antlr277 which writes out the 
tree. But nothing to read it back in.

Mathew

Terence Parr wrote:
> 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