Parser and Runtime: Divorced!

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 http://evanjones.ca/

On Oct 26, 2005, at 20:02, Evan Jones wrote:
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 am going to assume that since no one was excited about my post, that the answer is: no, there is no interest in seperating the parser from the rest of the Python run time. At any rate, if anyone is looking for a standalone C Python parser library, you can get it at the following URL. It includes a "print the tree" example that displays the AST for a specified file. It only supports a subset of the parse tree (assignment, functions, print, return), but it should be obvious how it could be extended. http://evanjones.ca/software/pyparser.html Evan Jones -- Evan Jones http://evanjones.ca/
participants (1)
-
Evan Jones