Compiler-AST-Walk-Visitor: Any Examples or Documentation?

E

Efrat Regev

Hello,

I'm trying to write something that will translate Python code to
pseudo-code (for teaching purposes). Googling around indicated that the
compiler module is pertinent, especially creating a visitor to walk the
generated AST:
http://docs.python.org/lib/module-compiler.html

I can build the AST, but I can't figure out how to write the
visitor. The package documentation didn't help me out that much, and I
couldn't find any examples. In fact, google only came up with this
unanswered related question:
http://mail.python.org/pipermail/python-list/2006-July/392716.html

Any help is appreciated.

Thanks and Bye,

Efrat
 
B

Bill Mill

Hello,

I'm trying to write something that will translate Python code to
pseudo-code (for teaching purposes). Googling around indicated that the
compiler module is pertinent, especially creating a visitor to walk the
generated AST:http://docs.python.org/lib/module-compiler.html

I can build the AST, but I can't figure out how to write the
visitor. The package documentation didn't help me out that much, and I
couldn't find any examples. In fact, google only came up with this
unanswered related question:http://mail.python.org/pipermail/python-list/2006-July/392716.html

Any help is appreciated.

Thanks and Bye,

Efrat

Maybe some of the files in google codesearch that import compiler and
walk would be helpful?

http://www.google.com/codesearch?q=compiler+walk+lang:python&hl=en&btnG=Search+Code

It seems from a superficial look that some of those files would be
helpful as examples.

-Bill Mill
bill.mill at gmail.com
http://billmill.org
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top