Better way of getting parsed Python rather than an AST?

K

Kenneth McDonald

Can anyone recommend something which will do one of the
following:

1) Parse a Python file into an "object-oriented" syntax
tree of some sort (eg. with function definitions represented
by a "FunDef" class, etc.)

or

2) Take an AST as produced by the Python AST module, and
convert it into a "friendlier" form. Unless I'm missing something,
the builtin AST representation seems somewhat, um, low-level.

I try to check the newsgroup regularly, but email as well as
a posting response would be greatly appreciated.

Thanks,
Ken McDonald
(e-mail address removed)
 
?

=?iso-8859-1?Q?Fran=E7ois?= Pinard

[Kenneth McDonald]
2) Take an AST as produced by the Python AST module, and convert it
into a "friendlier" form. Unless I'm missing something, the builtin
AST representation seems somewhat, um, low-level.

Use the `compiler' module, standard in Python 2.3. It has tiny problems,
but overall, it is fairly useful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top