Summer of Code/2013/Turtle Blocks Python export: Difference between revisions
Marion Zepf (talk | contribs) +abstract, +learning experience as a child |
Marion Zepf (talk | contribs) m timeline: removing my notes |
||
| Line 45: | Line 45: | ||
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> | ||
The exported Python code will need to import a few classes from Turtle Blocks to set up a window etc. I will isolate these classes from the Turtle Blocks code, so it can easily be imported into the generated code. | The exported Python code will need to import a few classes from Turtle Blocks to set up a window etc. I will isolate these classes from the Turtle Blocks code, so it can easily be imported into the generated code. | ||
| Line 73: | Line 72: | ||
** September 9 – September 15 (1 week) | ** September 9 – September 15 (1 week) | ||
*** Multiple turtles and custom turtle shells from the 'Extra options' palette<ref name="requires-add-imports" group="note" /> | *** Multiple turtles and custom turtle shells from the 'Extra options' palette<ref name="requires-add-imports" group="note" /> | ||
*** Display management (hide/ show blocks, toggle full screen) from the 'Presentation templates' palette, and printing and loading blocks and palettes from the 'Extra options' palette:<ref name="requires-add-imports" group="note" /> These are very specific to Turtle Blocks. We need further discussion how this should look in the output of the exported Python code.<!-- TODO report results of discussion --> | *** Display management (hide/ show blocks, toggle full screen) from the 'Presentation templates' palette, and printing and loading blocks and palettes from the 'Extra options' palette:<ref name="requires-add-imports" group="note" /><!-- These are very specific to Turtle Blocks. We need further discussion how this should look in the output of the exported Python code. --><!-- TODO report results of discussion --> | ||
* September 16 – September 23 (1 week): Test exporting different kinds of blocks in combination. Fix the last bugs. Clean up. | * September 16 – September 23 (1 week): Test exporting different kinds of blocks in combination. Fix the last bugs. Clean up. | ||