[Compiler-sig] Very experimental python AST tree and unpickling support.

Finn Bock bckfnn@worldonline.dk
Thu, 23 May 2002 14:28:16 +0200


Hi,

Jeremy suggested that the CPython view of the AST tree could be 
implemented by pickling the C tree and unpickling a python tree.

I have made such a python tree, mostly in order to reach agreement on 
how the python API of the tree should look like.

You can find my work here:

    http://www.jython.org/ast/

Pythonast.py contains the tree classes including unpickle support and 
asdl_py.py is used to create the Pythonast.py. I have not given much 
though to the pickling format, it is just quick and dirty and I'm sure 
it is full of bugs. The only pickling code I have is located in the java 
tree so from jython I have create the 'os.py.pckl' which can be 
unpickled as a 'Module' like this:

     import Pythonast as ast
     print ast.unpickle(open("os.py.pckl", "rb"))

Thoughs, comments and feedback welcome.

regards,
finn