[Python-Dev] Parser and Runtime: Divorced!

Evan Jones ejones at uwaterloo.ca
Thu Oct 27 02:02:54 CEST 2005

After a few hours of tedious and frustrating hacking I've managed to 
separate the Python abstract syntax tree parser from the rest of Python 
itself. This could be useful for people who may wish to build Python 
tools without Python, or tools in C/C++.

In the process of doing this, I came across a comment mentioning that 
it would be desirable to separate the parser. Is there any interest in 
doing this? I now have a vague idea about how to do this. Of course, 
there is no point in making changes like this unless there is some 
tangible benefit.

I will make my ugly hack available once I have polished it a little bit 
more. It involved hacking header files to provide a "re-implementation" 
of the pieces of Python that the parser needs (PyObject, PyString, and 
PyInt). It likely is a bit buggy, and it doesn't support all the types 
(notably, it is missing support for Unicode, Longs, Floats, and 
Complex), but it works well enough to get the AST from a few simple 
strings, which is what I wanted.

Evan Jones

Evan Jones

More information about the Python-Dev mailing list