Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattvonrocketstein/sourcecodegen
unofficial version of sourcecodegen with a few changes
https://github.com/mattvonrocketstein/sourcecodegen
Last synced: 26 days ago
JSON representation
unofficial version of sourcecodegen with a few changes
- Host: GitHub
- URL: https://github.com/mattvonrocketstein/sourcecodegen
- Owner: mattvonrocketstein
- License: other
- Created: 2011-02-28T04:20:40.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-02-28T04:30:28.000Z (almost 14 years ago)
- Last Synced: 2024-10-20T01:50:53.335Z (3 months ago)
- Language: Python
- Homepage:
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
- Changelog: CHANGES.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
Overview
========This package provides a module-level source-code generator which
operates on the AST from the built-in ``compiler.ast`` module.Note that this AST is not compatible with the new ``ast`` module in
Python 2.6.Usage
-----The generator works on AST parse trees.
>>> from compiler import parse
>>> tree = parse("""\
... print 'Hello, world!'
... """)We can now generate Python-code equivalent to the original using the
source-code generator.
>>> from sourcecodegen import ModuleSourceCodeGenerator
>>> generator = ModuleSourceCodeGenerator(tree)
>>> print generator.getSourceCode()
print 'Hello, world!'Author
------Malthe Borch