On Saturday 18. February 2017 23.45.13 Dylan Trotter wrote:
> Interesting. Thanks for the perspective. I did take a look at the PyPy ast
> module but I guess I got scared off by the PyPy specific requriements.
>
> I ended up integrating pythonparser
> <
https://github.com/m-labs/pythonparser> which is a pure Python parser for
> Python 2.x and 3.x. I'm very impressed with the quality of the code and it
> has a more powerful interface than the AST module (e.g. it gives
> line/column ranges for different parts of a node), so it seemed like a no
> brainer.
I know that pyparser does provide column (or "offset") information, which was
not something exposed by the compiler module and therefore not something I was
looking to use, but I'm not sure about ranges, and it's very possible that it
doesn't support them given the actual needs of the modules that would be using
it for parsing.
I'll try and take a look at pythonparser, though. (It's interesting that it's
done by the M-Labs people and I'm familiar with the activities of at least one
of the authors. It's a small world!)
One nice thing about pyparser is that the grammar is configurable, and I've
modified it to change what language elements I support. I don't immediately
see something similar in pythonparser, although I guess it could be embedded
in one of the Python files.
> I am curious what your toolchain looks like, so if you publish it, be sure
> to update this thread.
Sure. I'm trying to write some documentation, but keep drifting off and doing
other things instead. I'll try harder. ;-)
Paul
P.S. Sorry if I shouldn't have CC'd so many people. I guess that it what
everyone in the recipient list wanted, but feel free to say otherwise!