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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
let body = document.body;
let doc={}; // html elements with a class
body.querySelectorAll('[class]').forEach(e=>doc[e.classList[0]]=e);
let setcount = s=>s;
if (doc.count) {
let count_activeMin;
setcount = (s,m) => {
let l = Array.from(s).length;
if (l<m && m!==count_activeMin) return;
count_activeMin = m;
doc.count.textContent = l<m ? "" : l+" char"+(l!=1?"s":"");
}
let c = doc.code;
c.onmouseup = c.onkeyup = () => {
let s=c.selectionStart, e=c.selectionEnd;
setcount(c.value.slice(s,e), 2);
}
}
let setExplain = e=>e;
let showErr = (s,e)=>{
let r=e.src, w=e.message, loc=[];
while (w&&w.loc||(r!=='!'&&w.sh&&w.sh[0]===2)) {
let is; [is,w]=w;
let n=is.sh?is.sh[0]:0, i=n?is[0]:is;
let pair=n&&is.sh.length>1; if (pair) n*=2;
let to=i=>s.slice(0,i).join('').split('\n').map(l=>Array.from(l));
let ll=to(i), l=ll.length-1, j=ll[l].length, m=to()[l];
let k=1,o=i-j,cl=j; while (k<n&&(cl=is[k]-o)<m.length) k++;
let ol=k<n; if (pair) { if (k%2) cl=m.length; else { k--; cl++; } }
let c=Array(cl).fill(0); c[j]=1;
for (let h=1;h<k;h++) c[is[h]-o+(pair?h%2:0)]=1;
if (pair) for (let h=1;h<cl;h++) c[h]^=c[h-1];
let add = ['',m.join(''),c.map(t=>t?'^':' ').join('')];
loc = add.concat(ol?['(and other lines)']:[], loc);
}
if (r==='!') w=w?fmt(w).replace(/^/gm,'! '):'! Error';
else w=w.sh?w.join(''):w;
doc.rslt.classList.add('err');
doc.rslt.textContent=[w].concat(loc).join('\n');
}
let repl = ()=>{
let s=Array.from(doc.code.value), src=str(s);
doc.rslt.classList.remove('err');
doc.rslt.textContent=' '; setExplain();
setcount(s);
setTimeout(() => {
try {
let c=compile(src,runtime);
setExplain(src,c);
doc.rslt.textContent=fmt(run.apply(null,c));
} catch(e) {
showErr(src,e);
}
}, 0);
}
if (doc.run) doc.run.onclick = repl;
let exp=0, explain;
if (doc.doexplain) doc.doexplain.onclick = () => {
if (explain===undefined) {
let drawEval = run(
[0,19,22,0,0,11,22,0,1,11,14,15,1,22,0,2,11,14,15,2,22,0,3,11,14,15,3,22,0,4,11,14,15,4,22,0,5,11,14,0,20,0,46,21,0,5,8,0,31,9,0,20,0,50,21,0,5,8,15,5,3,3,0,52,0,16,0,5,0,56,19,8,22,0,6,11,14,21,0,6,21,0,6,0,41,0,21,7,0,69,19,0,21,9,0,24,0,55,19,15,6,3,3,0,52,0,16,0,5,0,56,19,8,22,0,7,11,14,0,43,15,7,7,0,21,0,82,19,22,0,8,11,14,0,55,0,53,21,0,8,0,46,0,11,8,8,0,21,9,0,49,0,21,8,22,0,9,11,14,15,8,22,0,10,11,14,21,0,6,0,40,0,22,7,0,85,0,86,3,2,19,22,0,11,11,14,21,0,9,0,46,21,0,4,8,22,0,12,11,14,15,9,22,0,13,11,14,0,63,0,64,3,2,22,0,14,11,14,0,56,0,55,3,2,0,2,21,0,14,17,22,0,15,11,14,0,56,0,57,3,2,0,3,21,0,14,17,0,0,0,58,0,65,3,2,17,22,0,16,11,14,0,61,22,0,17,11,14,0,89,21,0,10,16,22,0,18,11,14,0,90,21,0,10,16,22,0,19,11,14,0,92,21,0,10,0,91,17,22,0,20,11,14,0,93,21,0,10,0,91,17,22,0,21,11,14,0,94,21,0,10,0,91,17,22,0,22,11,14,0,95,21,0,10,0,91,17,22,0,23,11,14,0,96,0,97,0,21,0,61,0,25,16,0,0,0,70,17,17,0,98,0,99,0,100,0,101,0,102,0,103,0,104,0,105,0,106,0,107,0,21,0,73,17,0,21,0,84,17,0,108,0,109,3,14,0,20,0,46,0,56,3,2,17,0,27,16,0,40,0,11,7,16,22,0,24,22,0,25,4,2,11,14,0,110,0,111,0,112,0,113,0,114,0,115,0,116,3,7,0,21,22,0,24,13,14,15,10,21,0,25,7,22,0,26,11,14,21,0,24,0,41,15,11,7,16,22,0,27,11,14,0,119,22,0,28,11,14,0,122,0,123,0,124,0,125,3,4,0,41,0,121,0,49,0,21,8,0,21,0,120,19,7,16,22,0,29,11,14,15,12,22,0,30,11,25,0,55,0,18,21,0,2,17,0,54,0,17,0,39,0,20,7,0,55,0,56,3,2,19,0,49,0,39,0,41,0,24,0,21,0,75,19,0,21,0,23,19,7,7,8,8,22,0,3,11,14,21,0,1,21,1,1,0,48,21,1,0,0,31,0,50,21,0,3,8,9,0,21,0,48,0,11,8,0,41,0,55,7,19,8,16,25,15,13,22,0,3,11,14,0,76,21,0,2,0,77,3,3,0,21,16,22,0,4,11,14,0,78,21,0,2,0,28,0,69,0,13,21,0,2,17,0,45,0,9,7,16,17,0,77,3,3,0,21,16,22,0,5,11,14,21,0,1,0,16,16,22,0,6,11,0,11,0,55,17,22,0,7,11,14,21,0,5,21,0,7,0,54,0,11,0,46,0,20,8,8,0,47,15,14,21,0,1,21,0,7,0,54,15,15,8,16,7,8,21,0,4,17,0,21,16,25,0,76,21,0,1,0,80,3,3,0,21,16,25,21,0,1,0,60,0,49,0,11,8,0,9,0,11,0,48,0,59,8,19,16,0,43,0,9,7,16,0,37,16,14,0,61,22,0,3,11,0,39,0,4,7,0,57,17,22,0,4,11,14,0,70,0,1,0,81,17,22,0,5,22,0,6,4,2,11,14,0,58,0,11,21,0,1,17,22,0,7,11,14,21,0,1,0,7,16,22,0,8,11,14,21,0,8,0,2,21,0,4,17,0,0,0,62,17,0,5,16,22,0,9,11,14,21,0,7,0,28,16,0,41,21,0,5,7,0,49,0,11,0,47,0,22,8,8,16,0,22,16,21,0,4,0,3,21,0,9,17,0,5,16,15,16,0,48,0,13,0,46,0,25,8,8,16,21,0,9,15,17,0,48,0,13,0,46,0,25,8,8,16,0,13,0,11,0,58,19,0,54,0,21,0,48,0,30,0,46,0,26,0,31,9,0,50,0,41,21,0,6,7,8,8,8,8,16,3,3,0,21,16,0,27,16,0,40,0,21,0,46,0,11,8,7,16,0,43,0,0,0,48,0,70,8,0,49,0,36,8,7,16,25,21,0,1,14,0,58,0,37,16,25,21,0,1,14,0,58,0,37,16,25,21,0,2,0,83,21,0,1,0,84,3,4,0,21,16,25,15,18,22,0,3,11,14,21,0,1,21,0,3,0,72,7,16,0,41,21,0,3,0,71,7,7,16,0,41,21,1,8,7,0,21,9,0,49,0,21,8,0,51,0,12,8,21,0,2,17,25,21,0,1,21,1,3,0,88,21,0,2,21,1,7,16,3,2,21,1,9,0,87,17,17,25,0,32,0,48,21,0,1,0,21,16,8,0,29,21,0,1,0,41,0,13,7,16,0,45,0,0,7,16,19,25,0,118,0,21,21,0,1,17,0,21,0,117,17,25,21,0,2,22,0,3,22,0,4,22,0,5,22,0,6,22,0,7,4,2,22,0,8,4,5,11,14,0,126,0,127,0,128,0,129,3,4,0,39,0,1,7,0,70,17,22,0,9,22,0,10,22,0,11,22,0,12,4,4,11,14,15,19,22,0,13,11,14,21,0,3,21,0,6,3,2,0,41,0,28,0,48,21,0,13,8,7,16,0,41,0,24,7,0,58,0,65,3,2,17,22,0,14,22,0,15,4,2,11,14,21,0,10,0,30,21,0,14,17,22,0,16,11,0,14,0,65,17,22,0,17,11,14,21,0,13,0,28,16,0,39,0,28,0,48,21,0,17,8,0,50,0,18,0,0,0,55,19,0,39,0,30,7,21,0,3,19,8,7,22,0,16,13,14,21,0,11,0,30,21,0,14,17,0,31,0,48,0,65,8,0,50,0,55,8,16,22,0,18,11,14,21,0,16,0,1,21,0,18,17,0,45,0,0,7,16,22,0,19,11,14,21,0,19,0,31,0,65,17,0,14,0,55,17,0,37,16,14,21,0,16,0,11,0,58,17,22,0,20,11,0,2,0,48,0,2,0,48,21,0,18,8,0,45,0,0,7,9,8,16,22,0,21,11,14,21,0,18,0,8,21,0,16,17,0,28,16,0,30,0,48,0,33,0,0,21,0,19,0,49,0,30,8,19,0,29,0,47,0,30,0,48,0,29,8,8,21,0,19,0,24,0,65,17,19,8,16,22,0,22,11,14,21,0,20,0,8,16,0,23,0,48,0,13,8,21,0,22,17,22,0,23,11,14,21,0,1,15,20,21,0,8,17,22,0,24,22,0,25,22,0,26,4,3,11,14,21,0,22,15,21,16,0,13,0,54,0,39,0,30,7,8,16,0,39,0,30,7,21,0,26,0,30,21,0,23,0,45,0,0,7,16,0,39,0,1,7,0,55,17,17,17,0,24,0,65,17,22,0,27,11,14,0,66,0,21,21,0,27,17,22,0,28,11,14,21,0,22,0,18,0,22,0,30,19,21,0,17,0,1,21,0,28,17,0,30,21,0,22,17,0,13,21,0,27,17,0,15,21,0,23,17,0,28,16,17,22,0,29,11,14,21,0,21,0,22,21,0,28,17,0,0,0,62,0,67,3,2,17,0,2,21,1,14,17,0,27,16,21,1,6,16,0,30,21,0,29,17,0,44,0,39,0,40,0,26,0,49,0,21,8,0,41,0,21,7,0,132,19,0,21,9,0,46,0,11,8,7,7,7,16,22,0,30,11,14,21,0,21,0,30,21,0,22,0,28,21,0,23,17,17,0,41,0,22,0,2,21,1,14,19,0,0,21,1,16,19,0,46,21,1,11,21,1,9,0,133,19,8,7,21,0,26,17,22,0,31,11,14,21,1,15,0,2,0,56,0,58,3,2,17,0,0,21,0,1,0,13,16,21,0,21,0,43,0,6,7,16,0,0,0,56,17,3,2,0,2,21,1,14,17,17,22,0,32,11,14,21,0,32,21,1,6,16,0,40,0,22,7,0,135,0,136,3,2,17,0,21,21,1,15,0,1,16,21,1,11,16,17,0,21,21,1,19,17,21,1,12,0,134,17,0,11,16,21,0,24,21,1,3,0,133,17,0,11,16,21,0,30,0,41,0,19,0,11,0,47,0,22,8,0,138,19,0,21,21,1,18,19,21,1,12,0,137,19,7,16,21,0,25,0,41,0,21,7,0,19,0,41,21,1,3,7,21,0,31,19,0,47,0,11,0,47,0,22,8,8,0,41,0,31,0,48,0,55,8,7,19,16,0,41,21,1,3,7,21,1,22,21,1,23,3,2,17,21,1,3,21,1,21,17,3,4,0,41,0,20,7,16,0,21,16,21,1,3,21,1,20,17,21,1,13,21,1,17,0,2,0,56,17,0,0,21,0,32,17,0,38,0,56,7,0,3,0,39,0,1,7,19,0,39,0,1,7,21,1,15,0,0,21,1,17,17,19,0,39,0,21,7,0,18,19,0,48,0,6,0,48,0,68,0,58,3,2,8,8,16,17,25,21,0,1,0,20,16,0,58,0,46,0,37,8,0,11,0,20,9,0,19,0,41,21,0,0,7,0,21,9,3,4,0,52,0,16,0,5,0,57,19,8,16,25,21,0,2,21,0,4,21,0,1,3,3,25,21,0,1,0,20,16,21,1,6,0,15,0,57,17,0,54,0,41,21,1,3,7,0,21,9,8,16,0,41,0,21,0,48,0,79,8,7,16,25,21,0,1,0,15,21,1,3,17,22,0,3,11,14,21,0,2,21,0,1,3,2,0,22,0,26,0,31,9,0,50,0,7,0,48,21,1,3,8,8,0,21,0,43,0,28,0,48,21,0,3,8,0,47,21,1,3,0,49,0,3,8,0,5,9,0,49,21,0,0,8,8,7,19,3,2,0,52,21,0,3,0,43,0,10,7,16,8,16,25,21,0,1,0,7,21,1,4,17,22,0,1,12,0,2,16,22,0,3,11,14,21,0,1,0,58,0,56,3,2,0,25,16,0,28,0,48,21,0,3,8,0,47,0,2,0,48,21,1,3,8,0,49,21,0,0,0,21,21,1,4,0,49,0,3,8,0,5,9,0,49,0,11,0,47,0,22,8,8,19,8,8,3,2,0,52,21,0,3,0,43,0,10,7,16,8,21,0,2,17,25,0,36,0,48,0,14,0,48,21,0,1,8,0,1,0,48,0,8,0,2,0,45,0,0,7,19,8,9,8,25,21,1,3,0,19,0,2,0,12,0,48,0,13,8,19,0,39,0,30,7,0,18,19,21,1,9,17,0,0,0,55,17,0,0,21,1,3,0,13,16,0,25,16,17,22,0,0,11,14,0,19,0,31,0,65,19,0,14,0,58,19,0,54,15,22,8,22,0,1,11,14,21,0,0,0,41,0,58,7,0,21,0,55,19,21,0,1,0,13,0,49,0,21,8,19,0,23,0,13,19,16,25,21,0,2,22,0,3,22,0,4,22,0,5,22,0,6,22,0,7,4,5,11,14,21,2,25,0,13,16,22,0,8,11,14,21,0,1,0,30,21,0,6,17,21,2,26,16,0,14,0,48,21,0,8,8,0,2,0,1,19,0,0,0,19,19,21,0,4,0,0,0,57,17,0,0,21,0,8,17,17,0,39,0,30,7,21,2,27,17,22,0,9,11,14,21,0,7,0,41,0,130,7,16,22,0,10,11,14,21,0,9,0,21,21,0,10,17,22,0,11,11,14,0,61,0,0,0,74,17,0,14,21,0,1,17,0,28,16,22,0,12,11,14,21,0,1,0,30,0,48,21,0,12,8,0,50,0,131,0,30,21,0,6,0,34,21,0,12,17,17,8,16,22,0,1,12,14,21,0,1,0,32,21,2,28,17,22,0,13,11,0,12,0,48,0,13,8,21,2,28,17,22,0,14,11,0,8,16,0,28,16,22,0,15,11,14,21,0,13,0,28,21,0,14,17,0,39,0,30,7,21,2,29,17,0,39,0,21,7,22,0,11,13,14,0,55,0,1,21,0,6,17,0,21,21,0,7,17,0,21,21,0,14,0,28,16,17,0,28,21,0,11,0,41,0,13,7,16,17,0,21,21,0,15,17,0,29,16,22,0,16,11,14,21,0,11,0,21,16,0,21,21,0,1,0,30,21,0,15,17,17,0,30,21,0,16,17,22,0,17,11,14,0,55,0,21,21,2,29,0,41,0,13,7,16,17,0,30,21,0,13,17,22,0,18,11,14,21,0,17,0,28,0,48,0,13,0,46,0,25,8,0,12,21,0,18,0,43,0,0,7,16,19,0,30,21,0,16,19,8,16,22,0,19,11,14,21,0,9,21,0,7,0,0,0,55,17,0,42,0,28,7,0,23,21,0,1,0,13,16,19,0,45,0,0,7,9,0,47,0,12,0,2,0,18,19,8,21,0,6,17,0,39,0,1,7,0,55,17,0,28,21,0,18,17,0,39,0,36,7,21,0,19,17,21,0,10,3,3,0,12,16,0,27,16,0,40,0,11,7,16,22,0,20,11,14,21,1,15,0,28,21,1,23,17,0,32,21,0,6,17,22,0,21,11,14,21,0,17,21,0,20,0,30,21,0,21,17,0,56,0,3,21,0,7,0,0,21,0,6,17,17,0,30,21,0,21,17,3,3,25,21,0,1,0,29,16,22,0,3,11,0,39,0,30,7,21,0,1,17,22,0,4,11,14,21,1,14,0,13,16,0,25,16,0,30,0,48,21,0,4,0,35,16,8,0,50,21,1,12,0,30,21,1,14,17,0,30,21,0,4,17,0,14,21,0,4,0,33,16,17,0,39,0,28,7,21,0,3,17,8,16,25,21,0,1,0,30,0,48,21,0,2,0,28,21,0,1,17,8,0,50,0,41,0,55,7,8,16,21,1,1,21,0,2,0,39,0,30,7,16,17,25]
,[runtime[0],runtime[1],runtime[2],runtime[3],runtime[4],runtime[6],runtime[7],runtime[8],runtime[9],runtime[10],runtime[11],runtime[12],runtime[13],runtime[14],runtime[15],runtime[16],runtime[18],runtime[19],runtime[20],runtime[21],runtime[22],runtime[23],runtime[24],runtime[25],runtime[26],runtime[27],runtime[30],runtime[31],runtime[32],runtime[33],runtime[35],runtime[36],runtime[37],runtime[38],runtime[39],runtime[40],runtime[41],runtime[42],runtime[43],runtime[44],runtime[45],runtime[46],runtime[48],runtime[49],runtime[50],runtime[51],runtime[52],runtime[53],runtime[54],runtime[55],runtime[56],runtime[57],runtime[58],runtime[59],runtime[61],1,2,3,0,-Infinity,Infinity,10,0.5,10.84,24,-1,-1.25,0.1,512,' ','0','=','|','\"','
|