Is there grammar or lexer and parser for Python (or subse开发者_运维知识库t), written in PLY?
I've found it myself: python4ply
Perhaps not exactly what you were looking for, but Jeremy Seik at the University of Colorado Boulder runs ECEN 4543 - Introduction to Compilers that uses a combination of the python AST module and ply to build up larger and larger subsets of python, and uses the results to produce native code. Course notes are available from here.
An impressive tutorial based on that class was given at PyCon 2010, entitled "How to Compile Python x86 Assembly, the Python Way"
精彩评论