[antlr-interest] save a tree

Benjamin Niemann pink at odahoda.de
Fri Jan 11 12:06:39 PST 2008


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