Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better blockly code representation than XML #189

Open
jirmauritz opened this issue Jun 12, 2016 · 1 comment
Open

Better blockly code representation than XML #189

jirmauritz opened this issue Jun 12, 2016 · 1 comment

Comments

@jirmauritz
Copy link
Collaborator

  • replace XML by abstract syntax tree in JSON, postfix, ...
  • write function to convert XML to the new representation (blockly returns XML anyway)
  • ideally write inverse function back to XML to be able to reconstruct blockly programs
@effa
Copy link
Member

effa commented Jun 12, 2016

Some thoughts on the JSON representation:

  1. most compact, while still readable representation I can think of:
[forward, [turn, left], [repeat, 10, forward, [turn, right]],
[while, [check_color, not, yellow], forward]]
  1. "object per block" - less compact, but more explicit and probably easier to work with:
[
{command: 'forward'},
{command: 'turn', args: ['left']},
{command: 'repeat', args: [10], body: [...]
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants