The Python export functionality will be implemented in pure Python, drawing on the internal block code interpreter of Turtle Blocks to convert the blocks to a representation of the program flow. I will then use the <code>ast</code> module<ref>http://docs.python.org/2.6/library/ast.html</ref> to build the Python syntax tree from this representation. In order to serialize the syntax tree to a string, which can then be written to a file, I plan to use either the <code>codegen</code> module<ref>http://dev.pocoo.org/hg/sandbox/file/b2aea937f5bb/ast/codegen.py</ref><ref>https://gist.github.com/mattbasta/791312</ref> or the <code>unparse</code> module.<ref>http://svn.python.org/view/python/trunk/Demo/parser/unparse.py?view=markup</ref> | The Python export functionality will be implemented in pure Python, drawing on the internal block code interpreter of Turtle Blocks to convert the blocks to a representation of the program flow. I will then use the <code>ast</code> module<ref>http://docs.python.org/2.6/library/ast.html</ref> to build the Python syntax tree from this representation. In order to serialize the syntax tree to a string, which can then be written to a file, I plan to use either the <code>codegen</code> module<ref>http://dev.pocoo.org/hg/sandbox/file/b2aea937f5bb/ast/codegen.py</ref><ref>https://gist.github.com/mattbasta/791312</ref> or the <code>unparse</code> module.<ref>http://svn.python.org/view/python/trunk/Demo/parser/unparse.py?view=markup</ref> |