[Sugar-devel] Python code generator with support for comments?

Marion Zepf marion.zepf at gmail.com
Sat Jul 6 05:47:18 EDT 2013


Hi,

Does anyone know of a code generator for Python that can handle comments?
 I would like to construct an abstract syntax tree of a module, including
comments and docstrings, and then serialize it into a file.  I do not
necessarily need a parser, since the code will be constructed from a
TurtleArt program.

So far, I only found codegen [1] and unparse [2], which use Python's ast
module, which doesn't support comments.  I know that lib2to3 [3] does
support comments, but it has no stable API.

Thank you.
Marion

[1] http://dev.pocoo.org/hg/sandbox/file/b2aea937f5bb/ast/codegen.py
[2]
http://svn.python.org/view/python/trunk/Demo/parser/unparse.py?view=markup
[3] http://docs.python.org/2/library/2to3.html#module-lib2to3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130706/6c1edd34/attachment.html>


More information about the Sugar-devel mailing list