Using Skulpt's abstract syntax tree

79 views
Skip to first unread message

Nathanael D. Jones

unread,
Nov 3, 2010, 1:01:00 PM11/3/10
to sku...@googlegroups.com
I'm interested in making python more accessible to kids learning how to program. 
One idea I'd like to pursue is creating a two-pane 'visual editor' for python, with one side being an editable logic flow chart, and the other being source code.
And I want to make it web-based. I know it will be heavy, but I don't intend to have page refreshes often.

I'm wondering how this project could fit into that picture? Could I harness the AST generated by this code?

Thanks!

Nathanael Jones

Scott Graham

unread,
Nov 4, 2010, 2:06:05 AM11/4/10
to sku...@googlegroups.com
Hi

Yes, I imagine you could get get a parse tree pretty easily from Skulpt.

The steps of the compiler are quite separate, it goes from source text to CST (very verbose parse tree corresponding to productions in the grammar) to AST (a 'standard' ast) and then on to the rest of compilation.

src/ast.js contains the code that builds the AST from the CST. "Sk.astDump" near the bottom of the file actually spits out the ast in debuggable format, which might be a useful starting point.

HTH,
scott
Reply all
Reply to author
Forward
0 new messages