repl.it
@paulfears/

Binary expression Tree

HTML, CSS, JS

This allows you to run binary expression trees as code however the arrows are backward https://en.wikipedia.org/wiki/Binary_expression_tree

fork
loading
Files
  • index.html
  • versions
  • functions.js
  • index.css
  • index.js
  • index2.html
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
  <head>
  <script src="index.js"></script>

  </head>
<body>
<p>drag on canvas to create circles</p>
<p>type to add text</p>
<p>drag right click to connect circles</p>
<canvas id="myCanvas" width="800" height="500"
style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>
<script>
    
var canvas = document.getElementById("myCanvas");



var pad = node.init("myCanvas");

a = new node();
a.create(322,51,30,"&alert");

b = new node();
b.create(327,143,30, "+");
b.connect(a);

c = new node();
c.create(400, 243, 30, "*");
c.connect(b);

d = new node();
d.create(435, 350, 30, "14");
d.connect(c);

e = new node();
e.create(315, 300, 30, "11");
e.connect(c);

f = new node();
f.create(200, 200, 30, "6");
f.connect(b);

</script>


</body>
</html>
result
console