Eduardo Schettino’s pyregurgitator

pyregurgitator is a project by Eduardo Schettino which provides tools for analysing Python code.

Summary

pyregurgitator is intended to offer two primary tools
  • asdl2html which provides a reference table of python’s ASDL
  • ast2html which provides a super pretty print of python source-code’s AST
As of version 0.1 I have found three tools available
  • ast2html which provides a super pretty print of python source-code’s AST
  • ast2txt which dumps out the AST, similarly to ast.dump
  • ast2map which prints out the AST as a list of items, with minimal information about each

It is released under the MIT license, so can be copied for investigation.

Running pyregurgitator on itself

Run the ast2html tool, with the commands:

$ python2.5 bin/ast2html bin/ast2html > bin/ast2html.html

This produces output showing the detail as the AST of the original source

Conclusion

pyregurgitator is a helpful tool for anyone working with ASTs (such as myself). But it has proved not to be directly relevant to pym, as it concentrates on printing the AST, not the python. The methods it uses to pretty print the AST could yet prove informative, but details deserve a bit more investigation. Looks like he’s using a dictionary.