3 ms·
I have another take on visual programming We need programming environments that can understand both textual & visual code. We need a new primitive which I cal
by marcelr 2y ago
I have another take on visual programming
We need programming environments that can understand both textual & visual code.
We need a new primitive which I call the visual-ast
encode the AST in html via data attributes, and have a system to ignore irrelevant html nodes, giving space for rich UIs to be developed in place of typical AST nodes.
eg.
// textual
1 + 2
// ast
{
kind: "plus",
lhs: { kind: "int", value: 1 },
rhs: { kind: "int", value: 2 }
}
// visual-ast
<div data-kind="call">
<div data-attr="lhs">
<div data-kind="int">
<!-- typical encoding of a value -->
<div data-attr="value" data-value="2">2</div>
</div>
</div>
<div data-attr="rhs">
<div data-kind="int">
<!-- here we can use an input tag but you can do something more fancy -->
<input type="number" data-attr="value" data-value="1" value="1">
</div>
</div>
</div>
What you can do this with this AST is create rich UIs which contain the appropriate `data-attr`s, (ignoring the other elements), and now you have a generic system for interweaving textual & visual code.
- outworlder 2y agoIf we are going that route, why not go with a lisp-like language?