Fred L. Drake, Jr. wrote: > > Skip Montanaro writes: > > thing? Ideally, I'd like to see a framework that brings the parser module's > > output up to a level where mere mortals like me can reason about Python > > This was exactly what I wanted to prevent when I created the parser > module! ;-) > I think a wrapper that simplifies the parse tree wouldn't be too > hard to do; you simply have to be sure that the simplified version can > be re-elaborated to pass back to the byte-code compiler via > parser.sequence2ast(<seq>).compile(). Otherwise you can't modify the > tree without loosing line number information, which would be nice to > keep around! This has already been done. Grab the Python2C distribution from http://www.mudlib.org/~rassilon/p2c/. There is a module named "transformer.py" which does just what you're thinking -- it converts Python's deeply-nested trees into something human-readable. Each of the resulting node types are doc'd at the top of the module. It is also over a couple years old, so it has had some decent debugging/stabilization. Cheers, -g -- Greg Stein, http://www.lyra.org/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4