You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Blockly
Hi,
I'm wondering if it is possible to obtain the AST representation of a current program in my workspace. Does anyone know if it possible and how?
Thanks,
Mauricio
Erik Pasternak
unread,
Nov 20, 2018, 12:16:52 PM11/20/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Blockly
Do you mean the block hierarchy or the AST for the generated text code? If the former, you can call workspace.getTopBlocks() to get all the root blocks and you can traverse them as a tree by following their connections. For the latter, Blockly just generates text so there isn't an AST for the output until the text is parsed by another runtime.