mem.chr(檔案已創建)
@@ -0,0 +1,23 @@ | |||
1 | + | mem(A,_), mem(A,_) <=> fail | |
2 | + | prog(L,_,_,_), prog(L,_,_,_) <=> fail | |
3 | + | pc(_), pc(_) <=> fail | |
4 | + | ||
5 | + | prog(L,"add",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X+Y), pc(L+1) | |
6 | + | prog(L,"sub",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X-Y), pc(L+1) | |
7 | + | prog(L,"mult",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X*Y), pc(L+1) | |
8 | + | prog(L,"div",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X/Y), pc(L+1) | |
9 | + | ||
10 | + | prog(L,"move",B,A), mem(B,X) \ mem(A,_), pc(L) <=> mem(A,X), pc(L+1) | |
11 | + | prog(L,"i_mov",B,A), mem(B,C), mem(C,X) \ mem(A,_), pc(L) <=> mem(A,X), pc(L+1) | |
12 | + | prog(L,"mov_i",B,A), mem(B,X), mem(A,C) \ mem(C,_), pc(L) <=> mem(C,X), pc(L+1) | |
13 | + | ||
14 | + | prog(L,"const",B,A) \ mem(A,_), pc(L) <=> mem(A,B), pc(L+1) | |
15 | + | prog(L,"init",A,_), mem(A,B) \ pc(L) <=> mem(B,0), pc(L+1) | |
16 | + | ||
17 | + | prog(L,"jump",_,A) \ pc(L) <=> pc(A) | |
18 | + | prog(L,"cjmp",R,A), mem(R,X) \ pc(L) <=> X == 0 | pc(A) | |
19 | + | prog(L,"cjmp",R,_), mem(R,X) \ pc(L) <=> X != 0 | pc(L+1) | |
20 | + | ||
21 | + | prog(L,"halt",_,_) \ pc(L) <=> true | |
22 | + | ||
23 | + | pc(_) <=> fail |
mem.js(檔案已創建)
@@ -0,0 +1,2935 @@ | |||
1 | + | /** | |
2 | + | Input program: | |
3 | + | mem(A,_), mem(A,_) <=> fail | |
4 | + | prog(L,_,_,_), prog(L,_,_,_) <=> fail | |
5 | + | pc(_), pc(_) <=> fail | |
6 | + | ||
7 | + | prog(L,"add",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X+Y), pc(L+1) | |
8 | + | prog(L,"sub",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X-Y), pc(L+1) | |
9 | + | prog(L,"mult",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X*Y), pc(L+1) | |
10 | + | prog(L,"div",B,A), mem(B,Y) \ mem(A,X), pc(L) <=> mem(A,X/Y), pc(L+1) | |
11 | + | ||
12 | + | prog(L,"move",B,A), mem(B,X) \ mem(A,_), pc(L) <=> mem(A,X), pc(L+1) | |
13 | + | prog(L,"i_mov",B,A), mem(B,C), mem(C,X) \ mem(A,_), pc(L) <=> mem(A,X), pc(L+1) | |
14 | + | prog(L,"mov_i",B,A), mem(B,X), mem(A,C) \ mem(C,_), pc(L) <=> mem(C,X), pc(L+1) | |
15 | + | ||
16 | + | prog(L,"const",B,A) \ mem(A,_), pc(L) <=> mem(A,B), pc(L+1) | |
17 | + | prog(L,"init",A,_), mem(A,B) \ pc(L) <=> mem(B,0), pc(L+1) | |
18 | + | ||
19 | + | prog(L,"jump",_,A) \ pc(L) <=> pc(A) | |
20 | + | prog(L,"cjmp",R,A), mem(R,X) \ pc(L) <=> X == 0 | pc(A) | |
21 | + | prog(L,"cjmp",R,_), mem(R,X) \ pc(L) <=> X != 0 | pc(L+1) | |
22 | + | ||
23 | + | prog(L,"halt",_,_) \ pc(L) <=> true | |
24 | + | ||
25 | + | pc(_) <=> fail | |
26 | + | */ | |
27 | + | ||
28 | + | module.exports = (function () { | |
29 | + | ||
30 | + | /* eslint no-labels: ["error", { "allowLoop": true }] */ | |
31 | + | ||
32 | + | // Constraint | |
33 | + | function Constraint (name, arity, args) { | |
34 | + | this.name = name | |
35 | + | this.arity = arity | |
36 | + | this.functor = name + '/' + arity | |
37 | + | this.args = args | |
38 | + | this.id = null | |
39 | + | this.alive = true | |
40 | + | this.activated = false | |
41 | + | this.stored = false | |
42 | + | this.hist = null | |
43 | + | this.cont = null | |
44 | + | } | |
45 | + | ||
46 | + | Constraint.prototype.continue = function () { | |
47 | + | this.cont[0].call(this, this, this.cont[1]) | |
48 | + | } | |
49 | + | ||
50 | + | Constraint.prototype.toString = function () { | |
51 | + | let s = this.name | |
52 | + | if (this.arity >= 1) { | |
53 | + | s += '(' + this.args.join(',') + ')' | |
54 | + | } | |
55 | + | return s | |
56 | + | } | |
57 | + | ||
58 | + | // Store | |
59 | + | function Store () { | |
60 | + | this._index = {} | |
61 | + | this._size = 0 | |
62 | + | this._nextId = 0 | |
63 | + | } | |
64 | + | ||
65 | + | Store.prototype.add = function (constraint) { | |
66 | + | if (typeof this._index[constraint.functor] === 'undefined') { | |
67 | + | this._index[constraint.functor] = [] | |
68 | + | } | |
69 | + | constraint.id = this._nextId | |
70 | + | this._index[constraint.functor].push(constraint) | |
71 | + | this._size += 1 | |
72 | + | this._nextId += 1 | |
73 | + | } | |
74 | + | ||
75 | + | Store.prototype.remove = function (constraint) { | |
76 | + | constraint.alive = false | |
77 | + | const ix = this._index[constraint.functor].indexOf(constraint) | |
78 | + | this._index[constraint.functor].splice(ix, 1) | |
79 | + | ||
80 | + | this._size -= 1 | |
81 | + | } | |
82 | + | ||
83 | + | Store.prototype.lookup = function (rule, patterns, constraint) { | |
84 | + | const ret = this.lookupResume(rule, patterns, constraint, 0) | |
85 | + | if (!ret || !ret.res) { | |
86 | + | return false | |
87 | + | } | |
88 | + | return ret.res | |
89 | + | } | |
90 | + | ||
91 | + | Store.prototype.lookupResume = function (rule, patterns, constraint, startFrom) { | |
92 | + | startFrom = startFrom || 0 | |
93 | + | ||
94 | + | const lastPattern = patterns.length - 1 | |
95 | + | const lengths = [] | |
96 | + | const divs = [] | |
97 | + | let div = 1 | |
98 | + | let i | |
99 | + | ||
100 | + | // build array of arrays | |
101 | + | const arr = [] | |
102 | + | for (i = 0; i <= lastPattern; i++) { | |
103 | + | if (patterns[i] === '_') { | |
104 | + | // "_" is a placeholder for the given `constraint` | |
105 | + | arr[i] = [constraint] | |
106 | + | } else if (typeof this._index[patterns[i]] !== 'undefined') { | |
107 | + | arr[i] = this._index[patterns[i]] | |
108 | + | } else { | |
109 | + | // not a single element for this functor | |
110 | + | return false | |
111 | + | } | |
112 | + | } | |
113 | + | ||
114 | + | for (i = lastPattern; i >= 0; i--) { | |
115 | + | lengths[i] = arr[i].length | |
116 | + | divs[i] = div | |
117 | + | div *= arr[i].length | |
118 | + | } | |
119 | + | const max = divs[0] * arr[0].length | |
120 | + | ||
121 | + | let res | |
122 | + | let resIds | |
123 | + | let curr | |
124 | + | loopng: for (let n = startFrom; n < max; n++) { | |
125 | + | res = [] | |
126 | + | resIds = [] | |
127 | + | curr = n | |
128 | + | for (i = 0; i <= lastPattern; i++) { | |
129 | + | res[i] = arr[i][curr / divs[i] >> 0] | |
130 | + | resIds[i] = res[i].id | |
131 | + | ||
132 | + | // avoid multiple occurences of the same constraint | |
133 | + | if (res.slice(0, i).indexOf(res[i]) !== -1) { | |
134 | + | continue loopng | |
135 | + | } | |
136 | + | ||
137 | + | curr = curr % divs[i] | |
138 | + | } | |
139 | + | ||
140 | + | // check if already in history | |
141 | + | /* | |
142 | + | if (history.lookup(rule, resIds)) { | |
143 | + | continue loopng | |
144 | + | } | |
145 | + | */ | |
146 | + | return { | |
147 | + | n: n, | |
148 | + | res: res | |
149 | + | } | |
150 | + | } | |
151 | + | ||
152 | + | return false | |
153 | + | } | |
154 | + | ||
155 | + | Store.prototype.size = function () { | |
156 | + | return this._size | |
157 | + | } | |
158 | + | ||
159 | + | Store.prototype.valueOf = function () { | |
160 | + | return this.size() | |
161 | + | } | |
162 | + | ||
163 | + | Store.prototype.toString = function () { | |
164 | + | if (this.size() === 0) { | |
165 | + | return '(empty)' | |
166 | + | } | |
167 | + | ||
168 | + | let maxLengthC = 'constraint'.length | |
169 | + | let maxLengthI = 'id'.length | |
170 | + | const rows = [] | |
171 | + | let functor | |
172 | + | for (functor in this._index) { | |
173 | + | this._index[functor].forEach(function (c) { | |
174 | + | const s = c.toString() | |
175 | + | maxLengthC = Math.max(s.length, maxLengthC) | |
176 | + | maxLengthI = Math.max(c.id.toString().length + 1, maxLengthI) | |
177 | + | }) | |
178 | + | } | |
179 | + | for (functor in this._index) { | |
180 | + | this._index[functor].forEach(function (c) { | |
181 | + | rows.push(c.id.toString().padStart(maxLengthI) + ' | ' + c.toString().padEnd(maxLengthC)) | |
182 | + | }) | |
183 | + | } | |
184 | + | ||
185 | + | return [ | |
186 | + | 'id'.padStart(maxLengthI) + ' | ' + 'constraint'.padEnd(maxLengthC), | |
187 | + | ''.padStart(maxLengthI, '-') + '-+-' + ''.padEnd(maxLengthC, '-') | |
188 | + | ].concat(rows).join('\n') | |
189 | + | } | |
190 | + | ||
191 | + | // History | |
192 | + | /* | |
193 | + | function History () { | |
194 | + | this._index = {} | |
195 | + | this._size = 0 | |
196 | + | } | |
197 | + | ||
198 | + | History.prototype.size = function () { | |
199 | + | return this._size | |
200 | + | } | |
201 | + | ||
202 | + | History.prototype.valueOf = function () { | |
203 | + | return this.size() | |
204 | + | } | |
205 | + | ||
206 | + | History.prototype.toString = function () { | |
207 | + | if (this.size() === 0) { | |
208 | + | return "(empty)" | |
209 | + | } | |
210 | + | ||
211 | + | var maxLength_r = "rule".length | |
212 | + | var maxLength_f = "fired with".length | |
213 | + | var rows = [] | |
214 | + | var curr | |
215 | + | for (var rule in this._index) { | |
216 | + | maxLength_r = Math.max(rule.toString().length, maxLength_r) | |
217 | + | } | |
218 | + | ||
219 | + | // TODO | |
220 | + | } | |
221 | + | ||
222 | + | History.prototype.add = function (rule, ids) { | |
223 | + | if (!this._index.hasOwnProperty(rule)) { | |
224 | + | this._index[rule] = {} | |
225 | + | } | |
226 | + | ||
227 | + | var curr = this._index[rule] | |
228 | + | for (var i = 0; i < ids.length-1; i++) { | |
229 | + | if (!curr.hasOwnProperty(ids[i])) { | |
230 | + | curr[ids[i]] = {} | |
231 | + | } | |
232 | + | curr = curr[ids[i]] | |
233 | + | } | |
234 | + | curr[ids[i]] = true | |
235 | + | ||
236 | + | this._size += 1 | |
237 | + | } | |
238 | + | ||
239 | + | History.prototype.lookup = function (rule, ids) { | |
240 | + | if (!this._index.hasOwnProperty(rule)) { | |
241 | + | return false | |
242 | + | } | |
243 | + | ||
244 | + | var curr = this._index[rule] | |
245 | + | for (var i = 0; i < ids.length; i++) { | |
246 | + | if (!curr[ids[i]]) { | |
247 | + | return false | |
248 | + | } | |
249 | + | curr = curr[ids[i]] | |
250 | + | } | |
251 | + | ||
252 | + | if (curr !== true) { | |
253 | + | return false | |
254 | + | } | |
255 | + | ||
256 | + | return true | |
257 | + | } | |
258 | + | */ | |
259 | + | // trampoline | |
260 | + | function trampoline () { // eslint-disable-line | |
261 | + | let constraint | |
262 | + | while (constraint = stack.pop()) { // eslint-disable-line | |
263 | + | constraint.continue() | |
264 | + | } | |
265 | + | } | |
266 | + | ||
267 | + | var chr = { // eslint-disable-line | |
268 | + | Store: new Store() | |
269 | + | } | |
270 | + | ||
271 | + | var stack = [] // eslint-disable-line | |
272 | + | // var history = new History() | |
273 | + | ||
274 | + | function __mem_2_0 (constraint, __n) { | |
275 | + | __n = __n || 0 | |
276 | + | ||
277 | + | var A_0 = constraint.args[0] | |
278 | + | var __0 = constraint.args[1] | |
279 | + | ||
280 | + | var constraintPattern = [ "mem/2", "_" ] | |
281 | + | var lookupResult = chr.Store.lookupResume(0, constraintPattern, constraint, __n) | |
282 | + | if (lookupResult === false) { | |
283 | + | constraint.cont = [__mem_2_1, 0] | |
284 | + | stack.push(constraint) | |
285 | + | return | |
286 | + | } | |
287 | + | var constraints = lookupResult.res | |
288 | + | ||
289 | + | var A = constraints[0].args[0] | |
290 | + | var _ = constraints[0].args[1] | |
291 | + | ||
292 | + | if (!(A === A_0 && _ === __0)) { | |
293 | + | constraint.cont = [__mem_2_0, __n + 1] | |
294 | + | stack.push(constraint) | |
295 | + | return | |
296 | + | } | |
297 | + | ||
298 | + | chr.Store.remove(constraints[0]) | |
299 | + | ||
300 | + | ;(function () { | |
301 | + | var _c = new Constraint("fail", 0, [ ]) | |
302 | + | _c.cont = [__fail_0_0, 0] | |
303 | + | stack.push(_c) | |
304 | + | })() | |
305 | + | ||
306 | + | // active constraint gets removed | |
307 | + | } | |
308 | + | ||
309 | + | function __mem_2_1 (constraint, __n) { | |
310 | + | __n = __n || 0 | |
311 | + | ||
312 | + | var A = constraint.args[0] | |
313 | + | var _ = constraint.args[1] | |
314 | + | ||
315 | + | var constraintPattern = [ "_", "mem/2" ] | |
316 | + | var lookupResult = chr.Store.lookupResume(0, constraintPattern, constraint, __n) | |
317 | + | if (lookupResult === false) { | |
318 | + | constraint.cont = [__mem_2_2, 0] | |
319 | + | stack.push(constraint) | |
320 | + | return | |
321 | + | } | |
322 | + | var constraints = lookupResult.res | |
323 | + | ||
324 | + | var A_0 = constraints[1].args[0] | |
325 | + | var __0 = constraints[1].args[1] | |
326 | + | ||
327 | + | if (!(A === A_0 && _ === __0)) { | |
328 | + | constraint.cont = [__mem_2_1, __n + 1] | |
329 | + | stack.push(constraint) | |
330 | + | return | |
331 | + | } | |
332 | + | ||
333 | + | chr.Store.remove(constraints[1]) | |
334 | + | ||
335 | + | ;(function () { | |
336 | + | var _c = new Constraint("fail", 0, [ ]) | |
337 | + | _c.cont = [__fail_0_0, 0] | |
338 | + | stack.push(_c) | |
339 | + | })() | |
340 | + | ||
341 | + | // active constraint gets removed | |
342 | + | } | |
343 | + | ||
344 | + | function __prog_4_0 (constraint, __n) { | |
345 | + | __n = __n || 0 | |
346 | + | ||
347 | + | var L_0 = constraint.args[0] | |
348 | + | var __2 = constraint.args[1] | |
349 | + | var __3 = constraint.args[2] | |
350 | + | var __4 = constraint.args[3] | |
351 | + | ||
352 | + | var constraintPattern = [ "prog/4", "_" ] | |
353 | + | var lookupResult = chr.Store.lookupResume(1, constraintPattern, constraint, __n) | |
354 | + | if (lookupResult === false) { | |
355 | + | constraint.cont = [__prog_4_1, 0] | |
356 | + | stack.push(constraint) | |
357 | + | return | |
358 | + | } | |
359 | + | var constraints = lookupResult.res | |
360 | + | ||
361 | + | var L = constraints[0].args[0] | |
362 | + | var _ = constraints[0].args[1] | |
363 | + | var __0 = constraints[0].args[2] | |
364 | + | var __1 = constraints[0].args[3] | |
365 | + | ||
366 | + | if (!(_ === __0 && _ === __1 && L === L_0 && _ === __2 && _ === __3 && _ === __4)) { | |
367 | + | constraint.cont = [__prog_4_0, __n + 1] | |
368 | + | stack.push(constraint) | |
369 | + | return | |
370 | + | } | |
371 | + | ||
372 | + | chr.Store.remove(constraints[0]) | |
373 | + | ||
374 | + | ;(function () { | |
375 | + | var _c = new Constraint("fail", 0, [ ]) | |
376 | + | _c.cont = [__fail_0_0, 0] | |
377 | + | stack.push(_c) | |
378 | + | })() | |
379 | + | ||
380 | + | // active constraint gets removed | |
381 | + | } | |
382 | + | ||
383 | + | function __prog_4_1 (constraint, __n) { | |
384 | + | __n = __n || 0 | |
385 | + | ||
386 | + | var L = constraint.args[0] | |
387 | + | var _ = constraint.args[1] | |
388 | + | var __0 = constraint.args[2] | |
389 | + | var __1 = constraint.args[3] | |
390 | + | ||
391 | + | var constraintPattern = [ "_", "prog/4" ] | |
392 | + | var lookupResult = chr.Store.lookupResume(1, constraintPattern, constraint, __n) | |
393 | + | if (lookupResult === false) { | |
394 | + | constraint.cont = [__prog_4_2, 0] | |
395 | + | stack.push(constraint) | |
396 | + | return | |
397 | + | } | |
398 | + | var constraints = lookupResult.res | |
399 | + | ||
400 | + | var L_0 = constraints[1].args[0] | |
401 | + | var __2 = constraints[1].args[1] | |
402 | + | var __3 = constraints[1].args[2] | |
403 | + | var __4 = constraints[1].args[3] | |
404 | + | ||
405 | + | if (!(_ === __0 && _ === __1 && L === L_0 && _ === __2 && _ === __3 && _ === __4)) { | |
406 | + | constraint.cont = [__prog_4_1, __n + 1] | |
407 | + | stack.push(constraint) | |
408 | + | return | |
409 | + | } | |
410 | + | ||
411 | + | chr.Store.remove(constraints[1]) | |
412 | + | ||
413 | + | ;(function () { | |
414 | + | var _c = new Constraint("fail", 0, [ ]) | |
415 | + | _c.cont = [__fail_0_0, 0] | |
416 | + | stack.push(_c) | |
417 | + | })() | |
418 | + | ||
419 | + | // active constraint gets removed | |
420 | + | } | |
421 | + | ||
422 | + | function __pc_1_0 (constraint, __n) { | |
423 | + | __n = __n || 0 | |
424 | + | ||
425 | + | var __0 = constraint.args[0] | |
426 | + | ||
427 | + | var constraintPattern = [ "pc/1", "_" ] | |
428 | + | var lookupResult = chr.Store.lookupResume(2, constraintPattern, constraint, __n) | |
429 | + | if (lookupResult === false) { | |
430 | + | constraint.cont = [__pc_1_1, 0] | |
431 | + | stack.push(constraint) | |
432 | + | return | |
433 | + | } | |
434 | + | var constraints = lookupResult.res | |
435 | + | ||
436 | + | var _ = constraints[0].args[0] | |
437 | + | ||
438 | + | if (!(_ === __0)) { | |
439 | + | constraint.cont = [__pc_1_0, __n + 1] | |
440 | + | stack.push(constraint) | |
441 | + | return | |
442 | + | } | |
443 | + | ||
444 | + | chr.Store.remove(constraints[0]) | |
445 | + | ||
446 | + | ;(function () { | |
447 | + | var _c = new Constraint("fail", 0, [ ]) | |
448 | + | _c.cont = [__fail_0_0, 0] | |
449 | + | stack.push(_c) | |
450 | + | })() | |
451 | + | ||
452 | + | // active constraint gets removed | |
453 | + | } | |
454 | + | ||
455 | + | function __pc_1_1 (constraint, __n) { | |
456 | + | __n = __n || 0 | |
457 | + | ||
458 | + | var _ = constraint.args[0] | |
459 | + | ||
460 | + | var constraintPattern = [ "_", "pc/1" ] | |
461 | + | var lookupResult = chr.Store.lookupResume(2, constraintPattern, constraint, __n) | |
462 | + | if (lookupResult === false) { | |
463 | + | constraint.cont = [__pc_1_2, 0] | |
464 | + | stack.push(constraint) | |
465 | + | return | |
466 | + | } | |
467 | + | var constraints = lookupResult.res | |
468 | + | ||
469 | + | var __0 = constraints[1].args[0] | |
470 | + | ||
471 | + | if (!(_ === __0)) { | |
472 | + | constraint.cont = [__pc_1_1, __n + 1] | |
473 | + | stack.push(constraint) | |
474 | + | return | |
475 | + | } | |
476 | + | ||
477 | + | chr.Store.remove(constraints[1]) | |
478 | + | ||
479 | + | ;(function () { | |
480 | + | var _c = new Constraint("fail", 0, [ ]) | |
481 | + | _c.cont = [__fail_0_0, 0] | |
482 | + | stack.push(_c) | |
483 | + | })() | |
484 | + | ||
485 | + | // active constraint gets removed | |
486 | + | } | |
487 | + | ||
488 | + | function __pc_1_2 (constraint, __n) { | |
489 | + | __n = __n || 0 | |
490 | + | ||
491 | + | var L_0 = constraint.args[0] | |
492 | + | ||
493 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_" ] | |
494 | + | var lookupResult = chr.Store.lookupResume(3, constraintPattern, constraint, __n) | |
495 | + | if (lookupResult === false) { | |
496 | + | constraint.cont = [__pc_1_3, 0] | |
497 | + | stack.push(constraint) | |
498 | + | return | |
499 | + | } | |
500 | + | var constraints = lookupResult.res | |
501 | + | ||
502 | + | var L = constraints[0].args[0] | |
503 | + | if (constraints[0].args[1] !== "add") { | |
504 | + | constraint.cont = [__pc_1_2, __n + 1] | |
505 | + | stack.push(constraint) | |
506 | + | return | |
507 | + | } | |
508 | + | var B = constraints[0].args[2] | |
509 | + | var A = constraints[0].args[3] | |
510 | + | ||
511 | + | var B_0 = constraints[1].args[0] | |
512 | + | var Y = constraints[1].args[1] | |
513 | + | ||
514 | + | var A_0 = constraints[2].args[0] | |
515 | + | var X = constraints[2].args[1] | |
516 | + | ||
517 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
518 | + | constraint.cont = [__pc_1_2, __n + 1] | |
519 | + | stack.push(constraint) | |
520 | + | return | |
521 | + | } | |
522 | + | ||
523 | + | chr.Store.remove(constraints[2]) | |
524 | + | ||
525 | + | ;(function () { | |
526 | + | var _c = new Constraint("mem", 2, [ A, X + Y ]) | |
527 | + | _c.cont = [__mem_2_0, 0] | |
528 | + | stack.push(_c) | |
529 | + | })() | |
530 | + | ||
531 | + | ;(function () { | |
532 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
533 | + | _c.cont = [__pc_1_0, 0] | |
534 | + | stack.push(_c) | |
535 | + | })() | |
536 | + | ||
537 | + | // active constraint gets removed | |
538 | + | } | |
539 | + | ||
540 | + | function __mem_2_2 (constraint, __n) { | |
541 | + | __n = __n || 0 | |
542 | + | ||
543 | + | var A_0 = constraint.args[0] | |
544 | + | var X = constraint.args[1] | |
545 | + | ||
546 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "pc/1" ] | |
547 | + | var lookupResult = chr.Store.lookupResume(3, constraintPattern, constraint, __n) | |
548 | + | if (lookupResult === false) { | |
549 | + | constraint.cont = [__mem_2_3, 0] | |
550 | + | stack.push(constraint) | |
551 | + | return | |
552 | + | } | |
553 | + | var constraints = lookupResult.res | |
554 | + | ||
555 | + | var L = constraints[0].args[0] | |
556 | + | if (constraints[0].args[1] !== "add") { | |
557 | + | constraint.cont = [__mem_2_2, __n + 1] | |
558 | + | stack.push(constraint) | |
559 | + | return | |
560 | + | } | |
561 | + | var B = constraints[0].args[2] | |
562 | + | var A = constraints[0].args[3] | |
563 | + | ||
564 | + | var B_0 = constraints[1].args[0] | |
565 | + | var Y = constraints[1].args[1] | |
566 | + | ||
567 | + | var L_0 = constraints[3].args[0] | |
568 | + | ||
569 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
570 | + | constraint.cont = [__mem_2_2, __n + 1] | |
571 | + | stack.push(constraint) | |
572 | + | return | |
573 | + | } | |
574 | + | ||
575 | + | chr.Store.remove(constraints[3]) | |
576 | + | ||
577 | + | ;(function () { | |
578 | + | var _c = new Constraint("mem", 2, [ A, X + Y ]) | |
579 | + | _c.cont = [__mem_2_0, 0] | |
580 | + | stack.push(_c) | |
581 | + | })() | |
582 | + | ||
583 | + | ;(function () { | |
584 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
585 | + | _c.cont = [__pc_1_0, 0] | |
586 | + | stack.push(_c) | |
587 | + | })() | |
588 | + | ||
589 | + | // active constraint gets removed | |
590 | + | } | |
591 | + | ||
592 | + | function __mem_2_3 (constraint, __n) { | |
593 | + | __n = __n || 0 | |
594 | + | ||
595 | + | var B_0 = constraint.args[0] | |
596 | + | var Y = constraint.args[1] | |
597 | + | ||
598 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "pc/1" ] | |
599 | + | var lookupResult = chr.Store.lookupResume(3, constraintPattern, constraint, __n) | |
600 | + | if (lookupResult === false) { | |
601 | + | constraint.cont = [__mem_2_4, 0] | |
602 | + | stack.push(constraint) | |
603 | + | return | |
604 | + | } | |
605 | + | var constraints = lookupResult.res | |
606 | + | ||
607 | + | var L = constraints[0].args[0] | |
608 | + | if (constraints[0].args[1] !== "add") { | |
609 | + | constraint.cont = [__mem_2_3, __n + 1] | |
610 | + | stack.push(constraint) | |
611 | + | return | |
612 | + | } | |
613 | + | var B = constraints[0].args[2] | |
614 | + | var A = constraints[0].args[3] | |
615 | + | ||
616 | + | var A_0 = constraints[2].args[0] | |
617 | + | var X = constraints[2].args[1] | |
618 | + | ||
619 | + | var L_0 = constraints[3].args[0] | |
620 | + | ||
621 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
622 | + | constraint.cont = [__mem_2_3, __n + 1] | |
623 | + | stack.push(constraint) | |
624 | + | return | |
625 | + | } | |
626 | + | ||
627 | + | chr.Store.remove(constraints[2]) | |
628 | + | chr.Store.remove(constraints[3]) | |
629 | + | ||
630 | + | ;(function () { | |
631 | + | var _c = new Constraint("mem", 2, [ A, X + Y ]) | |
632 | + | _c.cont = [__mem_2_0, 0] | |
633 | + | stack.push(_c) | |
634 | + | })() | |
635 | + | ||
636 | + | ;(function () { | |
637 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
638 | + | _c.cont = [__pc_1_0, 0] | |
639 | + | stack.push(_c) | |
640 | + | })() | |
641 | + | ||
642 | + | constraint.cont = [__mem_2_3, __n + 1] | |
643 | + | stack.push(constraint) | |
644 | + | return | |
645 | + | } | |
646 | + | ||
647 | + | function __prog_4_2 (constraint, __n) { | |
648 | + | __n = __n || 0 | |
649 | + | ||
650 | + | var L = constraint.args[0] | |
651 | + | if (constraint.args[1] !== "add") { | |
652 | + | constraint.cont = [__prog_4_3, 0] | |
653 | + | stack.push(constraint) | |
654 | + | return | |
655 | + | } | |
656 | + | var B = constraint.args[2] | |
657 | + | var A = constraint.args[3] | |
658 | + | ||
659 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "pc/1" ] | |
660 | + | var lookupResult = chr.Store.lookupResume(3, constraintPattern, constraint, __n) | |
661 | + | if (lookupResult === false) { | |
662 | + | constraint.cont = [__prog_4_3, 0] | |
663 | + | stack.push(constraint) | |
664 | + | return | |
665 | + | } | |
666 | + | var constraints = lookupResult.res | |
667 | + | ||
668 | + | var B_0 = constraints[1].args[0] | |
669 | + | var Y = constraints[1].args[1] | |
670 | + | ||
671 | + | var A_0 = constraints[2].args[0] | |
672 | + | var X = constraints[2].args[1] | |
673 | + | ||
674 | + | var L_0 = constraints[3].args[0] | |
675 | + | ||
676 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
677 | + | constraint.cont = [__prog_4_2, __n + 1] | |
678 | + | stack.push(constraint) | |
679 | + | return | |
680 | + | } | |
681 | + | ||
682 | + | chr.Store.remove(constraints[2]) | |
683 | + | chr.Store.remove(constraints[3]) | |
684 | + | ||
685 | + | ;(function () { | |
686 | + | var _c = new Constraint("mem", 2, [ A, X + Y ]) | |
687 | + | _c.cont = [__mem_2_0, 0] | |
688 | + | stack.push(_c) | |
689 | + | })() | |
690 | + | ||
691 | + | ;(function () { | |
692 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
693 | + | _c.cont = [__pc_1_0, 0] | |
694 | + | stack.push(_c) | |
695 | + | })() | |
696 | + | ||
697 | + | constraint.cont = [__prog_4_2, __n + 1] | |
698 | + | stack.push(constraint) | |
699 | + | return | |
700 | + | } | |
701 | + | ||
702 | + | function __pc_1_3 (constraint, __n) { | |
703 | + | __n = __n || 0 | |
704 | + | ||
705 | + | var L_0 = constraint.args[0] | |
706 | + | ||
707 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_" ] | |
708 | + | var lookupResult = chr.Store.lookupResume(4, constraintPattern, constraint, __n) | |
709 | + | if (lookupResult === false) { | |
710 | + | constraint.cont = [__pc_1_4, 0] | |
711 | + | stack.push(constraint) | |
712 | + | return | |
713 | + | } | |
714 | + | var constraints = lookupResult.res | |
715 | + | ||
716 | + | var L = constraints[0].args[0] | |
717 | + | if (constraints[0].args[1] !== "sub") { | |
718 | + | constraint.cont = [__pc_1_3, __n + 1] | |
719 | + | stack.push(constraint) | |
720 | + | return | |
721 | + | } | |
722 | + | var B = constraints[0].args[2] | |
723 | + | var A = constraints[0].args[3] | |
724 | + | ||
725 | + | var B_0 = constraints[1].args[0] | |
726 | + | var Y = constraints[1].args[1] | |
727 | + | ||
728 | + | var A_0 = constraints[2].args[0] | |
729 | + | var X = constraints[2].args[1] | |
730 | + | ||
731 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
732 | + | constraint.cont = [__pc_1_3, __n + 1] | |
733 | + | stack.push(constraint) | |
734 | + | return | |
735 | + | } | |
736 | + | ||
737 | + | chr.Store.remove(constraints[2]) | |
738 | + | ||
739 | + | ;(function () { | |
740 | + | var _c = new Constraint("mem", 2, [ A, X - Y ]) | |
741 | + | _c.cont = [__mem_2_0, 0] | |
742 | + | stack.push(_c) | |
743 | + | })() | |
744 | + | ||
745 | + | ;(function () { | |
746 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
747 | + | _c.cont = [__pc_1_0, 0] | |
748 | + | stack.push(_c) | |
749 | + | })() | |
750 | + | ||
751 | + | // active constraint gets removed | |
752 | + | } | |
753 | + | ||
754 | + | function __mem_2_4 (constraint, __n) { | |
755 | + | __n = __n || 0 | |
756 | + | ||
757 | + | var A_0 = constraint.args[0] | |
758 | + | var X = constraint.args[1] | |
759 | + | ||
760 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "pc/1" ] | |
761 | + | var lookupResult = chr.Store.lookupResume(4, constraintPattern, constraint, __n) | |
762 | + | if (lookupResult === false) { | |
763 | + | constraint.cont = [__mem_2_5, 0] | |
764 | + | stack.push(constraint) | |
765 | + | return | |
766 | + | } | |
767 | + | var constraints = lookupResult.res | |
768 | + | ||
769 | + | var L = constraints[0].args[0] | |
770 | + | if (constraints[0].args[1] !== "sub") { | |
771 | + | constraint.cont = [__mem_2_4, __n + 1] | |
772 | + | stack.push(constraint) | |
773 | + | return | |
774 | + | } | |
775 | + | var B = constraints[0].args[2] | |
776 | + | var A = constraints[0].args[3] | |
777 | + | ||
778 | + | var B_0 = constraints[1].args[0] | |
779 | + | var Y = constraints[1].args[1] | |
780 | + | ||
781 | + | var L_0 = constraints[3].args[0] | |
782 | + | ||
783 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
784 | + | constraint.cont = [__mem_2_4, __n + 1] | |
785 | + | stack.push(constraint) | |
786 | + | return | |
787 | + | } | |
788 | + | ||
789 | + | chr.Store.remove(constraints[3]) | |
790 | + | ||
791 | + | ;(function () { | |
792 | + | var _c = new Constraint("mem", 2, [ A, X - Y ]) | |
793 | + | _c.cont = [__mem_2_0, 0] | |
794 | + | stack.push(_c) | |
795 | + | })() | |
796 | + | ||
797 | + | ;(function () { | |
798 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
799 | + | _c.cont = [__pc_1_0, 0] | |
800 | + | stack.push(_c) | |
801 | + | })() | |
802 | + | ||
803 | + | // active constraint gets removed | |
804 | + | } | |
805 | + | ||
806 | + | function __mem_2_5 (constraint, __n) { | |
807 | + | __n = __n || 0 | |
808 | + | ||
809 | + | var B_0 = constraint.args[0] | |
810 | + | var Y = constraint.args[1] | |
811 | + | ||
812 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "pc/1" ] | |
813 | + | var lookupResult = chr.Store.lookupResume(4, constraintPattern, constraint, __n) | |
814 | + | if (lookupResult === false) { | |
815 | + | constraint.cont = [__mem_2_6, 0] | |
816 | + | stack.push(constraint) | |
817 | + | return | |
818 | + | } | |
819 | + | var constraints = lookupResult.res | |
820 | + | ||
821 | + | var L = constraints[0].args[0] | |
822 | + | if (constraints[0].args[1] !== "sub") { | |
823 | + | constraint.cont = [__mem_2_5, __n + 1] | |
824 | + | stack.push(constraint) | |
825 | + | return | |
826 | + | } | |
827 | + | var B = constraints[0].args[2] | |
828 | + | var A = constraints[0].args[3] | |
829 | + | ||
830 | + | var A_0 = constraints[2].args[0] | |
831 | + | var X = constraints[2].args[1] | |
832 | + | ||
833 | + | var L_0 = constraints[3].args[0] | |
834 | + | ||
835 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
836 | + | constraint.cont = [__mem_2_5, __n + 1] | |
837 | + | stack.push(constraint) | |
838 | + | return | |
839 | + | } | |
840 | + | ||
841 | + | chr.Store.remove(constraints[2]) | |
842 | + | chr.Store.remove(constraints[3]) | |
843 | + | ||
844 | + | ;(function () { | |
845 | + | var _c = new Constraint("mem", 2, [ A, X - Y ]) | |
846 | + | _c.cont = [__mem_2_0, 0] | |
847 | + | stack.push(_c) | |
848 | + | })() | |
849 | + | ||
850 | + | ;(function () { | |
851 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
852 | + | _c.cont = [__pc_1_0, 0] | |
853 | + | stack.push(_c) | |
854 | + | })() | |
855 | + | ||
856 | + | constraint.cont = [__mem_2_5, __n + 1] | |
857 | + | stack.push(constraint) | |
858 | + | return | |
859 | + | } | |
860 | + | ||
861 | + | function __prog_4_3 (constraint, __n) { | |
862 | + | __n = __n || 0 | |
863 | + | ||
864 | + | var L = constraint.args[0] | |
865 | + | if (constraint.args[1] !== "sub") { | |
866 | + | constraint.cont = [__prog_4_4, 0] | |
867 | + | stack.push(constraint) | |
868 | + | return | |
869 | + | } | |
870 | + | var B = constraint.args[2] | |
871 | + | var A = constraint.args[3] | |
872 | + | ||
873 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "pc/1" ] | |
874 | + | var lookupResult = chr.Store.lookupResume(4, constraintPattern, constraint, __n) | |
875 | + | if (lookupResult === false) { | |
876 | + | constraint.cont = [__prog_4_4, 0] | |
877 | + | stack.push(constraint) | |
878 | + | return | |
879 | + | } | |
880 | + | var constraints = lookupResult.res | |
881 | + | ||
882 | + | var B_0 = constraints[1].args[0] | |
883 | + | var Y = constraints[1].args[1] | |
884 | + | ||
885 | + | var A_0 = constraints[2].args[0] | |
886 | + | var X = constraints[2].args[1] | |
887 | + | ||
888 | + | var L_0 = constraints[3].args[0] | |
889 | + | ||
890 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
891 | + | constraint.cont = [__prog_4_3, __n + 1] | |
892 | + | stack.push(constraint) | |
893 | + | return | |
894 | + | } | |
895 | + | ||
896 | + | chr.Store.remove(constraints[2]) | |
897 | + | chr.Store.remove(constraints[3]) | |
898 | + | ||
899 | + | ;(function () { | |
900 | + | var _c = new Constraint("mem", 2, [ A, X - Y ]) | |
901 | + | _c.cont = [__mem_2_0, 0] | |
902 | + | stack.push(_c) | |
903 | + | })() | |
904 | + | ||
905 | + | ;(function () { | |
906 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
907 | + | _c.cont = [__pc_1_0, 0] | |
908 | + | stack.push(_c) | |
909 | + | })() | |
910 | + | ||
911 | + | constraint.cont = [__prog_4_3, __n + 1] | |
912 | + | stack.push(constraint) | |
913 | + | return | |
914 | + | } | |
915 | + | ||
916 | + | function __pc_1_4 (constraint, __n) { | |
917 | + | __n = __n || 0 | |
918 | + | ||
919 | + | var L_0 = constraint.args[0] | |
920 | + | ||
921 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_" ] | |
922 | + | var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n) | |
923 | + | if (lookupResult === false) { | |
924 | + | constraint.cont = [__pc_1_5, 0] | |
925 | + | stack.push(constraint) | |
926 | + | return | |
927 | + | } | |
928 | + | var constraints = lookupResult.res | |
929 | + | ||
930 | + | var L = constraints[0].args[0] | |
931 | + | if (constraints[0].args[1] !== "mult") { | |
932 | + | constraint.cont = [__pc_1_4, __n + 1] | |
933 | + | stack.push(constraint) | |
934 | + | return | |
935 | + | } | |
936 | + | var B = constraints[0].args[2] | |
937 | + | var A = constraints[0].args[3] | |
938 | + | ||
939 | + | var B_0 = constraints[1].args[0] | |
940 | + | var Y = constraints[1].args[1] | |
941 | + | ||
942 | + | var A_0 = constraints[2].args[0] | |
943 | + | var X = constraints[2].args[1] | |
944 | + | ||
945 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
946 | + | constraint.cont = [__pc_1_4, __n + 1] | |
947 | + | stack.push(constraint) | |
948 | + | return | |
949 | + | } | |
950 | + | ||
951 | + | chr.Store.remove(constraints[2]) | |
952 | + | ||
953 | + | ;(function () { | |
954 | + | var _c = new Constraint("mem", 2, [ A, X * Y ]) | |
955 | + | _c.cont = [__mem_2_0, 0] | |
956 | + | stack.push(_c) | |
957 | + | })() | |
958 | + | ||
959 | + | ;(function () { | |
960 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
961 | + | _c.cont = [__pc_1_0, 0] | |
962 | + | stack.push(_c) | |
963 | + | })() | |
964 | + | ||
965 | + | // active constraint gets removed | |
966 | + | } | |
967 | + | ||
968 | + | function __mem_2_6 (constraint, __n) { | |
969 | + | __n = __n || 0 | |
970 | + | ||
971 | + | var A_0 = constraint.args[0] | |
972 | + | var X = constraint.args[1] | |
973 | + | ||
974 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "pc/1" ] | |
975 | + | var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n) | |
976 | + | if (lookupResult === false) { | |
977 | + | constraint.cont = [__mem_2_7, 0] | |
978 | + | stack.push(constraint) | |
979 | + | return | |
980 | + | } | |
981 | + | var constraints = lookupResult.res | |
982 | + | ||
983 | + | var L = constraints[0].args[0] | |
984 | + | if (constraints[0].args[1] !== "mult") { | |
985 | + | constraint.cont = [__mem_2_6, __n + 1] | |
986 | + | stack.push(constraint) | |
987 | + | return | |
988 | + | } | |
989 | + | var B = constraints[0].args[2] | |
990 | + | var A = constraints[0].args[3] | |
991 | + | ||
992 | + | var B_0 = constraints[1].args[0] | |
993 | + | var Y = constraints[1].args[1] | |
994 | + | ||
995 | + | var L_0 = constraints[3].args[0] | |
996 | + | ||
997 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
998 | + | constraint.cont = [__mem_2_6, __n + 1] | |
999 | + | stack.push(constraint) | |
1000 | + | return | |
1001 | + | } | |
1002 | + | ||
1003 | + | chr.Store.remove(constraints[3]) | |
1004 | + | ||
1005 | + | ;(function () { | |
1006 | + | var _c = new Constraint("mem", 2, [ A, X * Y ]) | |
1007 | + | _c.cont = [__mem_2_0, 0] | |
1008 | + | stack.push(_c) | |
1009 | + | })() | |
1010 | + | ||
1011 | + | ;(function () { | |
1012 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1013 | + | _c.cont = [__pc_1_0, 0] | |
1014 | + | stack.push(_c) | |
1015 | + | })() | |
1016 | + | ||
1017 | + | // active constraint gets removed | |
1018 | + | } | |
1019 | + | ||
1020 | + | function __mem_2_7 (constraint, __n) { | |
1021 | + | __n = __n || 0 | |
1022 | + | ||
1023 | + | var B_0 = constraint.args[0] | |
1024 | + | var Y = constraint.args[1] | |
1025 | + | ||
1026 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "pc/1" ] | |
1027 | + | var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n) | |
1028 | + | if (lookupResult === false) { | |
1029 | + | constraint.cont = [__mem_2_8, 0] | |
1030 | + | stack.push(constraint) | |
1031 | + | return | |
1032 | + | } | |
1033 | + | var constraints = lookupResult.res | |
1034 | + | ||
1035 | + | var L = constraints[0].args[0] | |
1036 | + | if (constraints[0].args[1] !== "mult") { | |
1037 | + | constraint.cont = [__mem_2_7, __n + 1] | |
1038 | + | stack.push(constraint) | |
1039 | + | return | |
1040 | + | } | |
1041 | + | var B = constraints[0].args[2] | |
1042 | + | var A = constraints[0].args[3] | |
1043 | + | ||
1044 | + | var A_0 = constraints[2].args[0] | |
1045 | + | var X = constraints[2].args[1] | |
1046 | + | ||
1047 | + | var L_0 = constraints[3].args[0] | |
1048 | + | ||
1049 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1050 | + | constraint.cont = [__mem_2_7, __n + 1] | |
1051 | + | stack.push(constraint) | |
1052 | + | return | |
1053 | + | } | |
1054 | + | ||
1055 | + | chr.Store.remove(constraints[2]) | |
1056 | + | chr.Store.remove(constraints[3]) | |
1057 | + | ||
1058 | + | ;(function () { | |
1059 | + | var _c = new Constraint("mem", 2, [ A, X * Y ]) | |
1060 | + | _c.cont = [__mem_2_0, 0] | |
1061 | + | stack.push(_c) | |
1062 | + | })() | |
1063 | + | ||
1064 | + | ;(function () { | |
1065 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1066 | + | _c.cont = [__pc_1_0, 0] | |
1067 | + | stack.push(_c) | |
1068 | + | })() | |
1069 | + | ||
1070 | + | constraint.cont = [__mem_2_7, __n + 1] | |
1071 | + | stack.push(constraint) | |
1072 | + | return | |
1073 | + | } | |
1074 | + | ||
1075 | + | function __prog_4_4 (constraint, __n) { | |
1076 | + | __n = __n || 0 | |
1077 | + | ||
1078 | + | var L = constraint.args[0] | |
1079 | + | if (constraint.args[1] !== "mult") { | |
1080 | + | constraint.cont = [__prog_4_5, 0] | |
1081 | + | stack.push(constraint) | |
1082 | + | return | |
1083 | + | } | |
1084 | + | var B = constraint.args[2] | |
1085 | + | var A = constraint.args[3] | |
1086 | + | ||
1087 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "pc/1" ] | |
1088 | + | var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n) | |
1089 | + | if (lookupResult === false) { | |
1090 | + | constraint.cont = [__prog_4_5, 0] | |
1091 | + | stack.push(constraint) | |
1092 | + | return | |
1093 | + | } | |
1094 | + | var constraints = lookupResult.res | |
1095 | + | ||
1096 | + | var B_0 = constraints[1].args[0] | |
1097 | + | var Y = constraints[1].args[1] | |
1098 | + | ||
1099 | + | var A_0 = constraints[2].args[0] | |
1100 | + | var X = constraints[2].args[1] | |
1101 | + | ||
1102 | + | var L_0 = constraints[3].args[0] | |
1103 | + | ||
1104 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1105 | + | constraint.cont = [__prog_4_4, __n + 1] | |
1106 | + | stack.push(constraint) | |
1107 | + | return | |
1108 | + | } | |
1109 | + | ||
1110 | + | chr.Store.remove(constraints[2]) | |
1111 | + | chr.Store.remove(constraints[3]) | |
1112 | + | ||
1113 | + | ;(function () { | |
1114 | + | var _c = new Constraint("mem", 2, [ A, X * Y ]) | |
1115 | + | _c.cont = [__mem_2_0, 0] | |
1116 | + | stack.push(_c) | |
1117 | + | })() | |
1118 | + | ||
1119 | + | ;(function () { | |
1120 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1121 | + | _c.cont = [__pc_1_0, 0] | |
1122 | + | stack.push(_c) | |
1123 | + | })() | |
1124 | + | ||
1125 | + | constraint.cont = [__prog_4_4, __n + 1] | |
1126 | + | stack.push(constraint) | |
1127 | + | return | |
1128 | + | } | |
1129 | + | ||
1130 | + | function __pc_1_5 (constraint, __n) { | |
1131 | + | __n = __n || 0 | |
1132 | + | ||
1133 | + | var L_0 = constraint.args[0] | |
1134 | + | ||
1135 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_" ] | |
1136 | + | var lookupResult = chr.Store.lookupResume(6, constraintPattern, constraint, __n) | |
1137 | + | if (lookupResult === false) { | |
1138 | + | constraint.cont = [__pc_1_6, 0] | |
1139 | + | stack.push(constraint) | |
1140 | + | return | |
1141 | + | } | |
1142 | + | var constraints = lookupResult.res | |
1143 | + | ||
1144 | + | var L = constraints[0].args[0] | |
1145 | + | if (constraints[0].args[1] !== "div") { | |
1146 | + | constraint.cont = [__pc_1_5, __n + 1] | |
1147 | + | stack.push(constraint) | |
1148 | + | return | |
1149 | + | } | |
1150 | + | var B = constraints[0].args[2] | |
1151 | + | var A = constraints[0].args[3] | |
1152 | + | ||
1153 | + | var B_0 = constraints[1].args[0] | |
1154 | + | var Y = constraints[1].args[1] | |
1155 | + | ||
1156 | + | var A_0 = constraints[2].args[0] | |
1157 | + | var X = constraints[2].args[1] | |
1158 | + | ||
1159 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1160 | + | constraint.cont = [__pc_1_5, __n + 1] | |
1161 | + | stack.push(constraint) | |
1162 | + | return | |
1163 | + | } | |
1164 | + | ||
1165 | + | chr.Store.remove(constraints[2]) | |
1166 | + | ||
1167 | + | ;(function () { | |
1168 | + | var _c = new Constraint("mem", 2, [ A, X / Y ]) | |
1169 | + | _c.cont = [__mem_2_0, 0] | |
1170 | + | stack.push(_c) | |
1171 | + | })() | |
1172 | + | ||
1173 | + | ;(function () { | |
1174 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1175 | + | _c.cont = [__pc_1_0, 0] | |
1176 | + | stack.push(_c) | |
1177 | + | })() | |
1178 | + | ||
1179 | + | // active constraint gets removed | |
1180 | + | } | |
1181 | + | ||
1182 | + | function __mem_2_8 (constraint, __n) { | |
1183 | + | __n = __n || 0 | |
1184 | + | ||
1185 | + | var A_0 = constraint.args[0] | |
1186 | + | var X = constraint.args[1] | |
1187 | + | ||
1188 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "pc/1" ] | |
1189 | + | var lookupResult = chr.Store.lookupResume(6, constraintPattern, constraint, __n) | |
1190 | + | if (lookupResult === false) { | |
1191 | + | constraint.cont = [__mem_2_9, 0] | |
1192 | + | stack.push(constraint) | |
1193 | + | return | |
1194 | + | } | |
1195 | + | var constraints = lookupResult.res | |
1196 | + | ||
1197 | + | var L = constraints[0].args[0] | |
1198 | + | if (constraints[0].args[1] !== "div") { | |
1199 | + | constraint.cont = [__mem_2_8, __n + 1] | |
1200 | + | stack.push(constraint) | |
1201 | + | return | |
1202 | + | } | |
1203 | + | var B = constraints[0].args[2] | |
1204 | + | var A = constraints[0].args[3] | |
1205 | + | ||
1206 | + | var B_0 = constraints[1].args[0] | |
1207 | + | var Y = constraints[1].args[1] | |
1208 | + | ||
1209 | + | var L_0 = constraints[3].args[0] | |
1210 | + | ||
1211 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1212 | + | constraint.cont = [__mem_2_8, __n + 1] | |
1213 | + | stack.push(constraint) | |
1214 | + | return | |
1215 | + | } | |
1216 | + | ||
1217 | + | chr.Store.remove(constraints[3]) | |
1218 | + | ||
1219 | + | ;(function () { | |
1220 | + | var _c = new Constraint("mem", 2, [ A, X / Y ]) | |
1221 | + | _c.cont = [__mem_2_0, 0] | |
1222 | + | stack.push(_c) | |
1223 | + | })() | |
1224 | + | ||
1225 | + | ;(function () { | |
1226 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1227 | + | _c.cont = [__pc_1_0, 0] | |
1228 | + | stack.push(_c) | |
1229 | + | })() | |
1230 | + | ||
1231 | + | // active constraint gets removed | |
1232 | + | } | |
1233 | + | ||
1234 | + | function __mem_2_9 (constraint, __n) { | |
1235 | + | __n = __n || 0 | |
1236 | + | ||
1237 | + | var B_0 = constraint.args[0] | |
1238 | + | var Y = constraint.args[1] | |
1239 | + | ||
1240 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "pc/1" ] | |
1241 | + | var lookupResult = chr.Store.lookupResume(6, constraintPattern, constraint, __n) | |
1242 | + | if (lookupResult === false) { | |
1243 | + | constraint.cont = [__mem_2_10, 0] | |
1244 | + | stack.push(constraint) | |
1245 | + | return | |
1246 | + | } | |
1247 | + | var constraints = lookupResult.res | |
1248 | + | ||
1249 | + | var L = constraints[0].args[0] | |
1250 | + | if (constraints[0].args[1] !== "div") { | |
1251 | + | constraint.cont = [__mem_2_9, __n + 1] | |
1252 | + | stack.push(constraint) | |
1253 | + | return | |
1254 | + | } | |
1255 | + | var B = constraints[0].args[2] | |
1256 | + | var A = constraints[0].args[3] | |
1257 | + | ||
1258 | + | var A_0 = constraints[2].args[0] | |
1259 | + | var X = constraints[2].args[1] | |
1260 | + | ||
1261 | + | var L_0 = constraints[3].args[0] | |
1262 | + | ||
1263 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1264 | + | constraint.cont = [__mem_2_9, __n + 1] | |
1265 | + | stack.push(constraint) | |
1266 | + | return | |
1267 | + | } | |
1268 | + | ||
1269 | + | chr.Store.remove(constraints[2]) | |
1270 | + | chr.Store.remove(constraints[3]) | |
1271 | + | ||
1272 | + | ;(function () { | |
1273 | + | var _c = new Constraint("mem", 2, [ A, X / Y ]) | |
1274 | + | _c.cont = [__mem_2_0, 0] | |
1275 | + | stack.push(_c) | |
1276 | + | })() | |
1277 | + | ||
1278 | + | ;(function () { | |
1279 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1280 | + | _c.cont = [__pc_1_0, 0] | |
1281 | + | stack.push(_c) | |
1282 | + | })() | |
1283 | + | ||
1284 | + | constraint.cont = [__mem_2_9, __n + 1] | |
1285 | + | stack.push(constraint) | |
1286 | + | return | |
1287 | + | } | |
1288 | + | ||
1289 | + | function __prog_4_5 (constraint, __n) { | |
1290 | + | __n = __n || 0 | |
1291 | + | ||
1292 | + | var L = constraint.args[0] | |
1293 | + | if (constraint.args[1] !== "div") { | |
1294 | + | constraint.cont = [__prog_4_6, 0] | |
1295 | + | stack.push(constraint) | |
1296 | + | return | |
1297 | + | } | |
1298 | + | var B = constraint.args[2] | |
1299 | + | var A = constraint.args[3] | |
1300 | + | ||
1301 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "pc/1" ] | |
1302 | + | var lookupResult = chr.Store.lookupResume(6, constraintPattern, constraint, __n) | |
1303 | + | if (lookupResult === false) { | |
1304 | + | constraint.cont = [__prog_4_6, 0] | |
1305 | + | stack.push(constraint) | |
1306 | + | return | |
1307 | + | } | |
1308 | + | var constraints = lookupResult.res | |
1309 | + | ||
1310 | + | var B_0 = constraints[1].args[0] | |
1311 | + | var Y = constraints[1].args[1] | |
1312 | + | ||
1313 | + | var A_0 = constraints[2].args[0] | |
1314 | + | var X = constraints[2].args[1] | |
1315 | + | ||
1316 | + | var L_0 = constraints[3].args[0] | |
1317 | + | ||
1318 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1319 | + | constraint.cont = [__prog_4_5, __n + 1] | |
1320 | + | stack.push(constraint) | |
1321 | + | return | |
1322 | + | } | |
1323 | + | ||
1324 | + | chr.Store.remove(constraints[2]) | |
1325 | + | chr.Store.remove(constraints[3]) | |
1326 | + | ||
1327 | + | ;(function () { | |
1328 | + | var _c = new Constraint("mem", 2, [ A, X / Y ]) | |
1329 | + | _c.cont = [__mem_2_0, 0] | |
1330 | + | stack.push(_c) | |
1331 | + | })() | |
1332 | + | ||
1333 | + | ;(function () { | |
1334 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1335 | + | _c.cont = [__pc_1_0, 0] | |
1336 | + | stack.push(_c) | |
1337 | + | })() | |
1338 | + | ||
1339 | + | constraint.cont = [__prog_4_5, __n + 1] | |
1340 | + | stack.push(constraint) | |
1341 | + | return | |
1342 | + | } | |
1343 | + | ||
1344 | + | function __pc_1_6 (constraint, __n) { | |
1345 | + | __n = __n || 0 | |
1346 | + | ||
1347 | + | var L_0 = constraint.args[0] | |
1348 | + | ||
1349 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_" ] | |
1350 | + | var lookupResult = chr.Store.lookupResume(7, constraintPattern, constraint, __n) | |
1351 | + | if (lookupResult === false) { | |
1352 | + | constraint.cont = [__pc_1_7, 0] | |
1353 | + | stack.push(constraint) | |
1354 | + | return | |
1355 | + | } | |
1356 | + | var constraints = lookupResult.res | |
1357 | + | ||
1358 | + | var L = constraints[0].args[0] | |
1359 | + | if (constraints[0].args[1] !== "move") { | |
1360 | + | constraint.cont = [__pc_1_6, __n + 1] | |
1361 | + | stack.push(constraint) | |
1362 | + | return | |
1363 | + | } | |
1364 | + | var B = constraints[0].args[2] | |
1365 | + | var A = constraints[0].args[3] | |
1366 | + | ||
1367 | + | var B_0 = constraints[1].args[0] | |
1368 | + | var X = constraints[1].args[1] | |
1369 | + | ||
1370 | + | var A_0 = constraints[2].args[0] | |
1371 | + | var _ = constraints[2].args[1] | |
1372 | + | ||
1373 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1374 | + | constraint.cont = [__pc_1_6, __n + 1] | |
1375 | + | stack.push(constraint) | |
1376 | + | return | |
1377 | + | } | |
1378 | + | ||
1379 | + | chr.Store.remove(constraints[2]) | |
1380 | + | ||
1381 | + | ;(function () { | |
1382 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1383 | + | _c.cont = [__mem_2_0, 0] | |
1384 | + | stack.push(_c) | |
1385 | + | })() | |
1386 | + | ||
1387 | + | ;(function () { | |
1388 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1389 | + | _c.cont = [__pc_1_0, 0] | |
1390 | + | stack.push(_c) | |
1391 | + | })() | |
1392 | + | ||
1393 | + | // active constraint gets removed | |
1394 | + | } | |
1395 | + | ||
1396 | + | function __mem_2_10 (constraint, __n) { | |
1397 | + | __n = __n || 0 | |
1398 | + | ||
1399 | + | var A_0 = constraint.args[0] | |
1400 | + | var _ = constraint.args[1] | |
1401 | + | ||
1402 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "pc/1" ] | |
1403 | + | var lookupResult = chr.Store.lookupResume(7, constraintPattern, constraint, __n) | |
1404 | + | if (lookupResult === false) { | |
1405 | + | constraint.cont = [__mem_2_11, 0] | |
1406 | + | stack.push(constraint) | |
1407 | + | return | |
1408 | + | } | |
1409 | + | var constraints = lookupResult.res | |
1410 | + | ||
1411 | + | var L = constraints[0].args[0] | |
1412 | + | if (constraints[0].args[1] !== "move") { | |
1413 | + | constraint.cont = [__mem_2_10, __n + 1] | |
1414 | + | stack.push(constraint) | |
1415 | + | return | |
1416 | + | } | |
1417 | + | var B = constraints[0].args[2] | |
1418 | + | var A = constraints[0].args[3] | |
1419 | + | ||
1420 | + | var B_0 = constraints[1].args[0] | |
1421 | + | var X = constraints[1].args[1] | |
1422 | + | ||
1423 | + | var L_0 = constraints[3].args[0] | |
1424 | + | ||
1425 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1426 | + | constraint.cont = [__mem_2_10, __n + 1] | |
1427 | + | stack.push(constraint) | |
1428 | + | return | |
1429 | + | } | |
1430 | + | ||
1431 | + | chr.Store.remove(constraints[3]) | |
1432 | + | ||
1433 | + | ;(function () { | |
1434 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1435 | + | _c.cont = [__mem_2_0, 0] | |
1436 | + | stack.push(_c) | |
1437 | + | })() | |
1438 | + | ||
1439 | + | ;(function () { | |
1440 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1441 | + | _c.cont = [__pc_1_0, 0] | |
1442 | + | stack.push(_c) | |
1443 | + | })() | |
1444 | + | ||
1445 | + | // active constraint gets removed | |
1446 | + | } | |
1447 | + | ||
1448 | + | function __mem_2_11 (constraint, __n) { | |
1449 | + | __n = __n || 0 | |
1450 | + | ||
1451 | + | var B_0 = constraint.args[0] | |
1452 | + | var X = constraint.args[1] | |
1453 | + | ||
1454 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "pc/1" ] | |
1455 | + | var lookupResult = chr.Store.lookupResume(7, constraintPattern, constraint, __n) | |
1456 | + | if (lookupResult === false) { | |
1457 | + | constraint.cont = [__mem_2_12, 0] | |
1458 | + | stack.push(constraint) | |
1459 | + | return | |
1460 | + | } | |
1461 | + | var constraints = lookupResult.res | |
1462 | + | ||
1463 | + | var L = constraints[0].args[0] | |
1464 | + | if (constraints[0].args[1] !== "move") { | |
1465 | + | constraint.cont = [__mem_2_11, __n + 1] | |
1466 | + | stack.push(constraint) | |
1467 | + | return | |
1468 | + | } | |
1469 | + | var B = constraints[0].args[2] | |
1470 | + | var A = constraints[0].args[3] | |
1471 | + | ||
1472 | + | var A_0 = constraints[2].args[0] | |
1473 | + | var _ = constraints[2].args[1] | |
1474 | + | ||
1475 | + | var L_0 = constraints[3].args[0] | |
1476 | + | ||
1477 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1478 | + | constraint.cont = [__mem_2_11, __n + 1] | |
1479 | + | stack.push(constraint) | |
1480 | + | return | |
1481 | + | } | |
1482 | + | ||
1483 | + | chr.Store.remove(constraints[2]) | |
1484 | + | chr.Store.remove(constraints[3]) | |
1485 | + | ||
1486 | + | ;(function () { | |
1487 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1488 | + | _c.cont = [__mem_2_0, 0] | |
1489 | + | stack.push(_c) | |
1490 | + | })() | |
1491 | + | ||
1492 | + | ;(function () { | |
1493 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1494 | + | _c.cont = [__pc_1_0, 0] | |
1495 | + | stack.push(_c) | |
1496 | + | })() | |
1497 | + | ||
1498 | + | constraint.cont = [__mem_2_11, __n + 1] | |
1499 | + | stack.push(constraint) | |
1500 | + | return | |
1501 | + | } | |
1502 | + | ||
1503 | + | function __prog_4_6 (constraint, __n) { | |
1504 | + | __n = __n || 0 | |
1505 | + | ||
1506 | + | var L = constraint.args[0] | |
1507 | + | if (constraint.args[1] !== "move") { | |
1508 | + | constraint.cont = [__prog_4_7, 0] | |
1509 | + | stack.push(constraint) | |
1510 | + | return | |
1511 | + | } | |
1512 | + | var B = constraint.args[2] | |
1513 | + | var A = constraint.args[3] | |
1514 | + | ||
1515 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "pc/1" ] | |
1516 | + | var lookupResult = chr.Store.lookupResume(7, constraintPattern, constraint, __n) | |
1517 | + | if (lookupResult === false) { | |
1518 | + | constraint.cont = [__prog_4_7, 0] | |
1519 | + | stack.push(constraint) | |
1520 | + | return | |
1521 | + | } | |
1522 | + | var constraints = lookupResult.res | |
1523 | + | ||
1524 | + | var B_0 = constraints[1].args[0] | |
1525 | + | var X = constraints[1].args[1] | |
1526 | + | ||
1527 | + | var A_0 = constraints[2].args[0] | |
1528 | + | var _ = constraints[2].args[1] | |
1529 | + | ||
1530 | + | var L_0 = constraints[3].args[0] | |
1531 | + | ||
1532 | + | if (!(B === B_0 && A === A_0 && L === L_0)) { | |
1533 | + | constraint.cont = [__prog_4_6, __n + 1] | |
1534 | + | stack.push(constraint) | |
1535 | + | return | |
1536 | + | } | |
1537 | + | ||
1538 | + | chr.Store.remove(constraints[2]) | |
1539 | + | chr.Store.remove(constraints[3]) | |
1540 | + | ||
1541 | + | ;(function () { | |
1542 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1543 | + | _c.cont = [__mem_2_0, 0] | |
1544 | + | stack.push(_c) | |
1545 | + | })() | |
1546 | + | ||
1547 | + | ;(function () { | |
1548 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1549 | + | _c.cont = [__pc_1_0, 0] | |
1550 | + | stack.push(_c) | |
1551 | + | })() | |
1552 | + | ||
1553 | + | constraint.cont = [__prog_4_6, __n + 1] | |
1554 | + | stack.push(constraint) | |
1555 | + | return | |
1556 | + | } | |
1557 | + | ||
1558 | + | function __pc_1_7 (constraint, __n) { | |
1559 | + | __n = __n || 0 | |
1560 | + | ||
1561 | + | var L_0 = constraint.args[0] | |
1562 | + | ||
1563 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "mem/2", "_" ] | |
1564 | + | var lookupResult = chr.Store.lookupResume(8, constraintPattern, constraint, __n) | |
1565 | + | if (lookupResult === false) { | |
1566 | + | constraint.cont = [__pc_1_8, 0] | |
1567 | + | stack.push(constraint) | |
1568 | + | return | |
1569 | + | } | |
1570 | + | var constraints = lookupResult.res | |
1571 | + | ||
1572 | + | var L = constraints[0].args[0] | |
1573 | + | if (constraints[0].args[1] !== "i_mov") { | |
1574 | + | constraint.cont = [__pc_1_7, __n + 1] | |
1575 | + | stack.push(constraint) | |
1576 | + | return | |
1577 | + | } | |
1578 | + | var B = constraints[0].args[2] | |
1579 | + | var A = constraints[0].args[3] | |
1580 | + | ||
1581 | + | var B_0 = constraints[1].args[0] | |
1582 | + | var C = constraints[1].args[1] | |
1583 | + | ||
1584 | + | var C_0 = constraints[2].args[0] | |
1585 | + | var X = constraints[2].args[1] | |
1586 | + | ||
1587 | + | var A_0 = constraints[3].args[0] | |
1588 | + | var _ = constraints[3].args[1] | |
1589 | + | ||
1590 | + | if (!(B === B_0 && C === C_0 && A === A_0 && L === L_0)) { | |
1591 | + | constraint.cont = [__pc_1_7, __n + 1] | |
1592 | + | stack.push(constraint) | |
1593 | + | return | |
1594 | + | } | |
1595 | + | ||
1596 | + | chr.Store.remove(constraints[3]) | |
1597 | + | ||
1598 | + | ;(function () { | |
1599 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1600 | + | _c.cont = [__mem_2_0, 0] | |
1601 | + | stack.push(_c) | |
1602 | + | })() | |
1603 | + | ||
1604 | + | ;(function () { | |
1605 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1606 | + | _c.cont = [__pc_1_0, 0] | |
1607 | + | stack.push(_c) | |
1608 | + | })() | |
1609 | + | ||
1610 | + | // active constraint gets removed | |
1611 | + | } | |
1612 | + | ||
1613 | + | function __mem_2_12 (constraint, __n) { | |
1614 | + | __n = __n || 0 | |
1615 | + | ||
1616 | + | var A_0 = constraint.args[0] | |
1617 | + | var _ = constraint.args[1] | |
1618 | + | ||
1619 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_", "pc/1" ] | |
1620 | + | var lookupResult = chr.Store.lookupResume(8, constraintPattern, constraint, __n) | |
1621 | + | if (lookupResult === false) { | |
1622 | + | constraint.cont = [__mem_2_13, 0] | |
1623 | + | stack.push(constraint) | |
1624 | + | return | |
1625 | + | } | |
1626 | + | var constraints = lookupResult.res | |
1627 | + | ||
1628 | + | var L = constraints[0].args[0] | |
1629 | + | if (constraints[0].args[1] !== "i_mov") { | |
1630 | + | constraint.cont = [__mem_2_12, __n + 1] | |
1631 | + | stack.push(constraint) | |
1632 | + | return | |
1633 | + | } | |
1634 | + | var B = constraints[0].args[2] | |
1635 | + | var A = constraints[0].args[3] | |
1636 | + | ||
1637 | + | var B_0 = constraints[1].args[0] | |
1638 | + | var C = constraints[1].args[1] | |
1639 | + | ||
1640 | + | var C_0 = constraints[2].args[0] | |
1641 | + | var X = constraints[2].args[1] | |
1642 | + | ||
1643 | + | var L_0 = constraints[4].args[0] | |
1644 | + | ||
1645 | + | if (!(B === B_0 && C === C_0 && A === A_0 && L === L_0)) { | |
1646 | + | constraint.cont = [__mem_2_12, __n + 1] | |
1647 | + | stack.push(constraint) | |
1648 | + | return | |
1649 | + | } | |
1650 | + | ||
1651 | + | chr.Store.remove(constraints[4]) | |
1652 | + | ||
1653 | + | ;(function () { | |
1654 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1655 | + | _c.cont = [__mem_2_0, 0] | |
1656 | + | stack.push(_c) | |
1657 | + | })() | |
1658 | + | ||
1659 | + | ;(function () { | |
1660 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1661 | + | _c.cont = [__pc_1_0, 0] | |
1662 | + | stack.push(_c) | |
1663 | + | })() | |
1664 | + | ||
1665 | + | // active constraint gets removed | |
1666 | + | } | |
1667 | + | ||
1668 | + | function __mem_2_13 (constraint, __n) { | |
1669 | + | __n = __n || 0 | |
1670 | + | ||
1671 | + | var C_0 = constraint.args[0] | |
1672 | + | var X = constraint.args[1] | |
1673 | + | ||
1674 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "mem/2", "pc/1" ] | |
1675 | + | var lookupResult = chr.Store.lookupResume(8, constraintPattern, constraint, __n) | |
1676 | + | if (lookupResult === false) { | |
1677 | + | constraint.cont = [__mem_2_14, 0] | |
1678 | + | stack.push(constraint) | |
1679 | + | return | |
1680 | + | } | |
1681 | + | var constraints = lookupResult.res | |
1682 | + | ||
1683 | + | var L = constraints[0].args[0] | |
1684 | + | if (constraints[0].args[1] !== "i_mov") { | |
1685 | + | constraint.cont = [__mem_2_13, __n + 1] | |
1686 | + | stack.push(constraint) | |
1687 | + | return | |
1688 | + | } | |
1689 | + | var B = constraints[0].args[2] | |
1690 | + | var A = constraints[0].args[3] | |
1691 | + | ||
1692 | + | var B_0 = constraints[1].args[0] | |
1693 | + | var C = constraints[1].args[1] | |
1694 | + | ||
1695 | + | var A_0 = constraints[3].args[0] | |
1696 | + | var _ = constraints[3].args[1] | |
1697 | + | ||
1698 | + | var L_0 = constraints[4].args[0] | |
1699 | + | ||
1700 | + | if (!(B === B_0 && C === C_0 && A === A_0 && L === L_0)) { | |
1701 | + | constraint.cont = [__mem_2_13, __n + 1] | |
1702 | + | stack.push(constraint) | |
1703 | + | return | |
1704 | + | } | |
1705 | + | ||
1706 | + | chr.Store.remove(constraints[3]) | |
1707 | + | chr.Store.remove(constraints[4]) | |
1708 | + | ||
1709 | + | ;(function () { | |
1710 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1711 | + | _c.cont = [__mem_2_0, 0] | |
1712 | + | stack.push(_c) | |
1713 | + | })() | |
1714 | + | ||
1715 | + | ;(function () { | |
1716 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1717 | + | _c.cont = [__pc_1_0, 0] | |
1718 | + | stack.push(_c) | |
1719 | + | })() | |
1720 | + | ||
1721 | + | constraint.cont = [__mem_2_13, __n + 1] | |
1722 | + | stack.push(constraint) | |
1723 | + | return | |
1724 | + | } | |
1725 | + | ||
1726 | + | function __mem_2_14 (constraint, __n) { | |
1727 | + | __n = __n || 0 | |
1728 | + | ||
1729 | + | var B_0 = constraint.args[0] | |
1730 | + | var C = constraint.args[1] | |
1731 | + | ||
1732 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "mem/2", "pc/1" ] | |
1733 | + | var lookupResult = chr.Store.lookupResume(8, constraintPattern, constraint, __n) | |
1734 | + | if (lookupResult === false) { | |
1735 | + | constraint.cont = [__mem_2_15, 0] | |
1736 | + | stack.push(constraint) | |
1737 | + | return | |
1738 | + | } | |
1739 | + | var constraints = lookupResult.res | |
1740 | + | ||
1741 | + | var L = constraints[0].args[0] | |
1742 | + | if (constraints[0].args[1] !== "i_mov") { | |
1743 | + | constraint.cont = [__mem_2_14, __n + 1] | |
1744 | + | stack.push(constraint) | |
1745 | + | return | |
1746 | + | } | |
1747 | + | var B = constraints[0].args[2] | |
1748 | + | var A = constraints[0].args[3] | |
1749 | + | ||
1750 | + | var C_0 = constraints[2].args[0] | |
1751 | + | var X = constraints[2].args[1] | |
1752 | + | ||
1753 | + | var A_0 = constraints[3].args[0] | |
1754 | + | var _ = constraints[3].args[1] | |
1755 | + | ||
1756 | + | var L_0 = constraints[4].args[0] | |
1757 | + | ||
1758 | + | if (!(B === B_0 && C === C_0 && A === A_0 && L === L_0)) { | |
1759 | + | constraint.cont = [__mem_2_14, __n + 1] | |
1760 | + | stack.push(constraint) | |
1761 | + | return | |
1762 | + | } | |
1763 | + | ||
1764 | + | chr.Store.remove(constraints[3]) | |
1765 | + | chr.Store.remove(constraints[4]) | |
1766 | + | ||
1767 | + | ;(function () { | |
1768 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1769 | + | _c.cont = [__mem_2_0, 0] | |
1770 | + | stack.push(_c) | |
1771 | + | })() | |
1772 | + | ||
1773 | + | ;(function () { | |
1774 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1775 | + | _c.cont = [__pc_1_0, 0] | |
1776 | + | stack.push(_c) | |
1777 | + | })() | |
1778 | + | ||
1779 | + | constraint.cont = [__mem_2_14, __n + 1] | |
1780 | + | stack.push(constraint) | |
1781 | + | return | |
1782 | + | } | |
1783 | + | ||
1784 | + | function __prog_4_7 (constraint, __n) { | |
1785 | + | __n = __n || 0 | |
1786 | + | ||
1787 | + | var L = constraint.args[0] | |
1788 | + | if (constraint.args[1] !== "i_mov") { | |
1789 | + | constraint.cont = [__prog_4_8, 0] | |
1790 | + | stack.push(constraint) | |
1791 | + | return | |
1792 | + | } | |
1793 | + | var B = constraint.args[2] | |
1794 | + | var A = constraint.args[3] | |
1795 | + | ||
1796 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "mem/2", "pc/1" ] | |
1797 | + | var lookupResult = chr.Store.lookupResume(8, constraintPattern, constraint, __n) | |
1798 | + | if (lookupResult === false) { | |
1799 | + | constraint.cont = [__prog_4_8, 0] | |
1800 | + | stack.push(constraint) | |
1801 | + | return | |
1802 | + | } | |
1803 | + | var constraints = lookupResult.res | |
1804 | + | ||
1805 | + | var B_0 = constraints[1].args[0] | |
1806 | + | var C = constraints[1].args[1] | |
1807 | + | ||
1808 | + | var C_0 = constraints[2].args[0] | |
1809 | + | var X = constraints[2].args[1] | |
1810 | + | ||
1811 | + | var A_0 = constraints[3].args[0] | |
1812 | + | var _ = constraints[3].args[1] | |
1813 | + | ||
1814 | + | var L_0 = constraints[4].args[0] | |
1815 | + | ||
1816 | + | if (!(B === B_0 && C === C_0 && A === A_0 && L === L_0)) { | |
1817 | + | constraint.cont = [__prog_4_7, __n + 1] | |
1818 | + | stack.push(constraint) | |
1819 | + | return | |
1820 | + | } | |
1821 | + | ||
1822 | + | chr.Store.remove(constraints[3]) | |
1823 | + | chr.Store.remove(constraints[4]) | |
1824 | + | ||
1825 | + | ;(function () { | |
1826 | + | var _c = new Constraint("mem", 2, [ A, X ]) | |
1827 | + | _c.cont = [__mem_2_0, 0] | |
1828 | + | stack.push(_c) | |
1829 | + | })() | |
1830 | + | ||
1831 | + | ;(function () { | |
1832 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1833 | + | _c.cont = [__pc_1_0, 0] | |
1834 | + | stack.push(_c) | |
1835 | + | })() | |
1836 | + | ||
1837 | + | constraint.cont = [__prog_4_7, __n + 1] | |
1838 | + | stack.push(constraint) | |
1839 | + | return | |
1840 | + | } | |
1841 | + | ||
1842 | + | function __pc_1_8 (constraint, __n) { | |
1843 | + | __n = __n || 0 | |
1844 | + | ||
1845 | + | var L_0 = constraint.args[0] | |
1846 | + | ||
1847 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "mem/2", "_" ] | |
1848 | + | var lookupResult = chr.Store.lookupResume(9, constraintPattern, constraint, __n) | |
1849 | + | if (lookupResult === false) { | |
1850 | + | constraint.cont = [__pc_1_9, 0] | |
1851 | + | stack.push(constraint) | |
1852 | + | return | |
1853 | + | } | |
1854 | + | var constraints = lookupResult.res | |
1855 | + | ||
1856 | + | var L = constraints[0].args[0] | |
1857 | + | if (constraints[0].args[1] !== "mov_i") { | |
1858 | + | constraint.cont = [__pc_1_8, __n + 1] | |
1859 | + | stack.push(constraint) | |
1860 | + | return | |
1861 | + | } | |
1862 | + | var B = constraints[0].args[2] | |
1863 | + | var A = constraints[0].args[3] | |
1864 | + | ||
1865 | + | var B_0 = constraints[1].args[0] | |
1866 | + | var X = constraints[1].args[1] | |
1867 | + | ||
1868 | + | var A_0 = constraints[2].args[0] | |
1869 | + | var C = constraints[2].args[1] | |
1870 | + | ||
1871 | + | var C_0 = constraints[3].args[0] | |
1872 | + | var _ = constraints[3].args[1] | |
1873 | + | ||
1874 | + | if (!(B === B_0 && A === A_0 && C === C_0 && L === L_0)) { | |
1875 | + | constraint.cont = [__pc_1_8, __n + 1] | |
1876 | + | stack.push(constraint) | |
1877 | + | return | |
1878 | + | } | |
1879 | + | ||
1880 | + | chr.Store.remove(constraints[3]) | |
1881 | + | ||
1882 | + | ;(function () { | |
1883 | + | var _c = new Constraint("mem", 2, [ C, X ]) | |
1884 | + | _c.cont = [__mem_2_0, 0] | |
1885 | + | stack.push(_c) | |
1886 | + | })() | |
1887 | + | ||
1888 | + | ;(function () { | |
1889 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1890 | + | _c.cont = [__pc_1_0, 0] | |
1891 | + | stack.push(_c) | |
1892 | + | })() | |
1893 | + | ||
1894 | + | // active constraint gets removed | |
1895 | + | } | |
1896 | + | ||
1897 | + | function __mem_2_15 (constraint, __n) { | |
1898 | + | __n = __n || 0 | |
1899 | + | ||
1900 | + | var C_0 = constraint.args[0] | |
1901 | + | var _ = constraint.args[1] | |
1902 | + | ||
1903 | + | var constraintPattern = [ "prog/4", "mem/2", "mem/2", "_", "pc/1" ] | |
1904 | + | var lookupResult = chr.Store.lookupResume(9, constraintPattern, constraint, __n) | |
1905 | + | if (lookupResult === false) { | |
1906 | + | constraint.cont = [__mem_2_16, 0] | |
1907 | + | stack.push(constraint) | |
1908 | + | return | |
1909 | + | } | |
1910 | + | var constraints = lookupResult.res | |
1911 | + | ||
1912 | + | var L = constraints[0].args[0] | |
1913 | + | if (constraints[0].args[1] !== "mov_i") { | |
1914 | + | constraint.cont = [__mem_2_15, __n + 1] | |
1915 | + | stack.push(constraint) | |
1916 | + | return | |
1917 | + | } | |
1918 | + | var B = constraints[0].args[2] | |
1919 | + | var A = constraints[0].args[3] | |
1920 | + | ||
1921 | + | var B_0 = constraints[1].args[0] | |
1922 | + | var X = constraints[1].args[1] | |
1923 | + | ||
1924 | + | var A_0 = constraints[2].args[0] | |
1925 | + | var C = constraints[2].args[1] | |
1926 | + | ||
1927 | + | var L_0 = constraints[4].args[0] | |
1928 | + | ||
1929 | + | if (!(B === B_0 && A === A_0 && C === C_0 && L === L_0)) { | |
1930 | + | constraint.cont = [__mem_2_15, __n + 1] | |
1931 | + | stack.push(constraint) | |
1932 | + | return | |
1933 | + | } | |
1934 | + | ||
1935 | + | chr.Store.remove(constraints[4]) | |
1936 | + | ||
1937 | + | ;(function () { | |
1938 | + | var _c = new Constraint("mem", 2, [ C, X ]) | |
1939 | + | _c.cont = [__mem_2_0, 0] | |
1940 | + | stack.push(_c) | |
1941 | + | })() | |
1942 | + | ||
1943 | + | ;(function () { | |
1944 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
1945 | + | _c.cont = [__pc_1_0, 0] | |
1946 | + | stack.push(_c) | |
1947 | + | })() | |
1948 | + | ||
1949 | + | // active constraint gets removed | |
1950 | + | } | |
1951 | + | ||
1952 | + | function __mem_2_16 (constraint, __n) { | |
1953 | + | __n = __n || 0 | |
1954 | + | ||
1955 | + | var A_0 = constraint.args[0] | |
1956 | + | var C = constraint.args[1] | |
1957 | + | ||
1958 | + | var constraintPattern = [ "prog/4", "mem/2", "_", "mem/2", "pc/1" ] | |
1959 | + | var lookupResult = chr.Store.lookupResume(9, constraintPattern, constraint, __n) | |
1960 | + | if (lookupResult === false) { | |
1961 | + | constraint.cont = [__mem_2_17, 0] | |
1962 | + | stack.push(constraint) | |
1963 | + | return | |
1964 | + | } | |
1965 | + | var constraints = lookupResult.res | |
1966 | + | ||
1967 | + | var L = constraints[0].args[0] | |
1968 | + | if (constraints[0].args[1] !== "mov_i") { | |
1969 | + | constraint.cont = [__mem_2_16, __n + 1] | |
1970 | + | stack.push(constraint) | |
1971 | + | return | |
1972 | + | } | |
1973 | + | var B = constraints[0].args[2] | |
1974 | + | var A = constraints[0].args[3] | |
1975 | + | ||
1976 | + | var B_0 = constraints[1].args[0] | |
1977 | + | var X = constraints[1].args[1] | |
1978 | + | ||
1979 | + | var C_0 = constraints[3].args[0] | |
1980 | + | var _ = constraints[3].args[1] | |
1981 | + | ||
1982 | + | var L_0 = constraints[4].args[0] | |
1983 | + | ||
1984 | + | if (!(B === B_0 && A === A_0 && C === C_0 && L === L_0)) { | |
1985 | + | constraint.cont = [__mem_2_16, __n + 1] | |
1986 | + | stack.push(constraint) | |
1987 | + | return | |
1988 | + | } | |
1989 | + | ||
1990 | + | chr.Store.remove(constraints[3]) | |
1991 | + | chr.Store.remove(constraints[4]) | |
1992 | + | ||
1993 | + | ;(function () { | |
1994 | + | var _c = new Constraint("mem", 2, [ C, X ]) | |
1995 | + | _c.cont = [__mem_2_0, 0] | |
1996 | + | stack.push(_c) | |
1997 | + | })() | |
1998 | + | ||
1999 | + | ;(function () { | |
2000 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2001 | + | _c.cont = [__pc_1_0, 0] | |
2002 | + | stack.push(_c) | |
2003 | + | })() | |
2004 | + | ||
2005 | + | constraint.cont = [__mem_2_16, __n + 1] | |
2006 | + | stack.push(constraint) | |
2007 | + | return | |
2008 | + | } | |
2009 | + | ||
2010 | + | function __mem_2_17 (constraint, __n) { | |
2011 | + | __n = __n || 0 | |
2012 | + | ||
2013 | + | var B_0 = constraint.args[0] | |
2014 | + | var X = constraint.args[1] | |
2015 | + | ||
2016 | + | var constraintPattern = [ "prog/4", "_", "mem/2", "mem/2", "pc/1" ] | |
2017 | + | var lookupResult = chr.Store.lookupResume(9, constraintPattern, constraint, __n) | |
2018 | + | if (lookupResult === false) { | |
2019 | + | constraint.cont = [__mem_2_18, 0] | |
2020 | + | stack.push(constraint) | |
2021 | + | return | |
2022 | + | } | |
2023 | + | var constraints = lookupResult.res | |
2024 | + | ||
2025 | + | var L = constraints[0].args[0] | |
2026 | + | if (constraints[0].args[1] !== "mov_i") { | |
2027 | + | constraint.cont = [__mem_2_17, __n + 1] | |
2028 | + | stack.push(constraint) | |
2029 | + | return | |
2030 | + | } | |
2031 | + | var B = constraints[0].args[2] | |
2032 | + | var A = constraints[0].args[3] | |
2033 | + | ||
2034 | + | var A_0 = constraints[2].args[0] | |
2035 | + | var C = constraints[2].args[1] | |
2036 | + | ||
2037 | + | var C_0 = constraints[3].args[0] | |
2038 | + | var _ = constraints[3].args[1] | |
2039 | + | ||
2040 | + | var L_0 = constraints[4].args[0] | |
2041 | + | ||
2042 | + | if (!(B === B_0 && A === A_0 && C === C_0 && L === L_0)) { | |
2043 | + | constraint.cont = [__mem_2_17, __n + 1] | |
2044 | + | stack.push(constraint) | |
2045 | + | return | |
2046 | + | } | |
2047 | + | ||
2048 | + | chr.Store.remove(constraints[3]) | |
2049 | + | chr.Store.remove(constraints[4]) | |
2050 | + | ||
2051 | + | ;(function () { | |
2052 | + | var _c = new Constraint("mem", 2, [ C, X ]) | |
2053 | + | _c.cont = [__mem_2_0, 0] | |
2054 | + | stack.push(_c) | |
2055 | + | })() | |
2056 | + | ||
2057 | + | ;(function () { | |
2058 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2059 | + | _c.cont = [__pc_1_0, 0] | |
2060 | + | stack.push(_c) | |
2061 | + | })() | |
2062 | + | ||
2063 | + | constraint.cont = [__mem_2_17, __n + 1] | |
2064 | + | stack.push(constraint) | |
2065 | + | return | |
2066 | + | } | |
2067 | + | ||
2068 | + | function __prog_4_8 (constraint, __n) { | |
2069 | + | __n = __n || 0 | |
2070 | + | ||
2071 | + | var L = constraint.args[0] | |
2072 | + | if (constraint.args[1] !== "mov_i") { | |
2073 | + | constraint.cont = [__prog_4_9, 0] | |
2074 | + | stack.push(constraint) | |
2075 | + | return | |
2076 | + | } | |
2077 | + | var B = constraint.args[2] | |
2078 | + | var A = constraint.args[3] | |
2079 | + | ||
2080 | + | var constraintPattern = [ "_", "mem/2", "mem/2", "mem/2", "pc/1" ] | |
2081 | + | var lookupResult = chr.Store.lookupResume(9, constraintPattern, constraint, __n) | |
2082 | + | if (lookupResult === false) { | |
2083 | + | constraint.cont = [__prog_4_9, 0] | |
2084 | + | stack.push(constraint) | |
2085 | + | return | |
2086 | + | } | |
2087 | + | var constraints = lookupResult.res | |
2088 | + | ||
2089 | + | var B_0 = constraints[1].args[0] | |
2090 | + | var X = constraints[1].args[1] | |
2091 | + | ||
2092 | + | var A_0 = constraints[2].args[0] | |
2093 | + | var C = constraints[2].args[1] | |
2094 | + | ||
2095 | + | var C_0 = constraints[3].args[0] | |
2096 | + | var _ = constraints[3].args[1] | |
2097 | + | ||
2098 | + | var L_0 = constraints[4].args[0] | |
2099 | + | ||
2100 | + | if (!(B === B_0 && A === A_0 && C === C_0 && L === L_0)) { | |
2101 | + | constraint.cont = [__prog_4_8, __n + 1] | |
2102 | + | stack.push(constraint) | |
2103 | + | return | |
2104 | + | } | |
2105 | + | ||
2106 | + | chr.Store.remove(constraints[3]) | |
2107 | + | chr.Store.remove(constraints[4]) | |
2108 | + | ||
2109 | + | ;(function () { | |
2110 | + | var _c = new Constraint("mem", 2, [ C, X ]) | |
2111 | + | _c.cont = [__mem_2_0, 0] | |
2112 | + | stack.push(_c) | |
2113 | + | })() | |
2114 | + | ||
2115 | + | ;(function () { | |
2116 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2117 | + | _c.cont = [__pc_1_0, 0] | |
2118 | + | stack.push(_c) | |
2119 | + | })() | |
2120 | + | ||
2121 | + | constraint.cont = [__prog_4_8, __n + 1] | |
2122 | + | stack.push(constraint) | |
2123 | + | return | |
2124 | + | } | |
2125 | + | ||
2126 | + | function __pc_1_9 (constraint, __n) { | |
2127 | + | __n = __n || 0 | |
2128 | + | ||
2129 | + | var L_0 = constraint.args[0] | |
2130 | + | ||
2131 | + | var constraintPattern = [ "prog/4", "mem/2", "_" ] | |
2132 | + | var lookupResult = chr.Store.lookupResume(10, constraintPattern, constraint, __n) | |
2133 | + | if (lookupResult === false) { | |
2134 | + | constraint.cont = [__pc_1_10, 0] | |
2135 | + | stack.push(constraint) | |
2136 | + | return | |
2137 | + | } | |
2138 | + | var constraints = lookupResult.res | |
2139 | + | ||
2140 | + | var L = constraints[0].args[0] | |
2141 | + | if (constraints[0].args[1] !== "const") { | |
2142 | + | constraint.cont = [__pc_1_9, __n + 1] | |
2143 | + | stack.push(constraint) | |
2144 | + | return | |
2145 | + | } | |
2146 | + | var B = constraints[0].args[2] | |
2147 | + | var A = constraints[0].args[3] | |
2148 | + | ||
2149 | + | var A_0 = constraints[1].args[0] | |
2150 | + | var _ = constraints[1].args[1] | |
2151 | + | ||
2152 | + | if (!(A === A_0 && L === L_0)) { | |
2153 | + | constraint.cont = [__pc_1_9, __n + 1] | |
2154 | + | stack.push(constraint) | |
2155 | + | return | |
2156 | + | } | |
2157 | + | ||
2158 | + | chr.Store.remove(constraints[1]) | |
2159 | + | ||
2160 | + | ;(function () { | |
2161 | + | var _c = new Constraint("mem", 2, [ A, B ]) | |
2162 | + | _c.cont = [__mem_2_0, 0] | |
2163 | + | stack.push(_c) | |
2164 | + | })() | |
2165 | + | ||
2166 | + | ;(function () { | |
2167 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2168 | + | _c.cont = [__pc_1_0, 0] | |
2169 | + | stack.push(_c) | |
2170 | + | })() | |
2171 | + | ||
2172 | + | // active constraint gets removed | |
2173 | + | } | |
2174 | + | ||
2175 | + | function __mem_2_18 (constraint, __n) { | |
2176 | + | __n = __n || 0 | |
2177 | + | ||
2178 | + | var A_0 = constraint.args[0] | |
2179 | + | var _ = constraint.args[1] | |
2180 | + | ||
2181 | + | var constraintPattern = [ "prog/4", "_", "pc/1" ] | |
2182 | + | var lookupResult = chr.Store.lookupResume(10, constraintPattern, constraint, __n) | |
2183 | + | if (lookupResult === false) { | |
2184 | + | constraint.cont = [__mem_2_19, 0] | |
2185 | + | stack.push(constraint) | |
2186 | + | return | |
2187 | + | } | |
2188 | + | var constraints = lookupResult.res | |
2189 | + | ||
2190 | + | var L = constraints[0].args[0] | |
2191 | + | if (constraints[0].args[1] !== "const") { | |
2192 | + | constraint.cont = [__mem_2_18, __n + 1] | |
2193 | + | stack.push(constraint) | |
2194 | + | return | |
2195 | + | } | |
2196 | + | var B = constraints[0].args[2] | |
2197 | + | var A = constraints[0].args[3] | |
2198 | + | ||
2199 | + | var L_0 = constraints[2].args[0] | |
2200 | + | ||
2201 | + | if (!(A === A_0 && L === L_0)) { | |
2202 | + | constraint.cont = [__mem_2_18, __n + 1] | |
2203 | + | stack.push(constraint) | |
2204 | + | return | |
2205 | + | } | |
2206 | + | ||
2207 | + | chr.Store.remove(constraints[2]) | |
2208 | + | ||
2209 | + | ;(function () { | |
2210 | + | var _c = new Constraint("mem", 2, [ A, B ]) | |
2211 | + | _c.cont = [__mem_2_0, 0] | |
2212 | + | stack.push(_c) | |
2213 | + | })() | |
2214 | + | ||
2215 | + | ;(function () { | |
2216 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2217 | + | _c.cont = [__pc_1_0, 0] | |
2218 | + | stack.push(_c) | |
2219 | + | })() | |
2220 | + | ||
2221 | + | // active constraint gets removed | |
2222 | + | } | |
2223 | + | ||
2224 | + | function __prog_4_9 (constraint, __n) { | |
2225 | + | __n = __n || 0 | |
2226 | + | ||
2227 | + | var L = constraint.args[0] | |
2228 | + | if (constraint.args[1] !== "const") { | |
2229 | + | constraint.cont = [__prog_4_10, 0] | |
2230 | + | stack.push(constraint) | |
2231 | + | return | |
2232 | + | } | |
2233 | + | var B = constraint.args[2] | |
2234 | + | var A = constraint.args[3] | |
2235 | + | ||
2236 | + | var constraintPattern = [ "_", "mem/2", "pc/1" ] | |
2237 | + | var lookupResult = chr.Store.lookupResume(10, constraintPattern, constraint, __n) | |
2238 | + | if (lookupResult === false) { | |
2239 | + | constraint.cont = [__prog_4_10, 0] | |
2240 | + | stack.push(constraint) | |
2241 | + | return | |
2242 | + | } | |
2243 | + | var constraints = lookupResult.res | |
2244 | + | ||
2245 | + | var A_0 = constraints[1].args[0] | |
2246 | + | var _ = constraints[1].args[1] | |
2247 | + | ||
2248 | + | var L_0 = constraints[2].args[0] | |
2249 | + | ||
2250 | + | if (!(A === A_0 && L === L_0)) { | |
2251 | + | constraint.cont = [__prog_4_9, __n + 1] | |
2252 | + | stack.push(constraint) | |
2253 | + | return | |
2254 | + | } | |
2255 | + | ||
2256 | + | chr.Store.remove(constraints[1]) | |
2257 | + | chr.Store.remove(constraints[2]) | |
2258 | + | ||
2259 | + | ;(function () { | |
2260 | + | var _c = new Constraint("mem", 2, [ A, B ]) | |
2261 | + | _c.cont = [__mem_2_0, 0] | |
2262 | + | stack.push(_c) | |
2263 | + | })() | |
2264 | + | ||
2265 | + | ;(function () { | |
2266 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2267 | + | _c.cont = [__pc_1_0, 0] | |
2268 | + | stack.push(_c) | |
2269 | + | })() | |
2270 | + | ||
2271 | + | constraint.cont = [__prog_4_9, __n + 1] | |
2272 | + | stack.push(constraint) | |
2273 | + | return | |
2274 | + | } | |
2275 | + | ||
2276 | + | function __pc_1_10 (constraint, __n) { | |
2277 | + | __n = __n || 0 | |
2278 | + | ||
2279 | + | var L_0 = constraint.args[0] | |
2280 | + | ||
2281 | + | var constraintPattern = [ "prog/4", "mem/2", "_" ] | |
2282 | + | var lookupResult = chr.Store.lookupResume(11, constraintPattern, constraint, __n) | |
2283 | + | if (lookupResult === false) { | |
2284 | + | constraint.cont = [__pc_1_11, 0] | |
2285 | + | stack.push(constraint) | |
2286 | + | return | |
2287 | + | } | |
2288 | + | var constraints = lookupResult.res | |
2289 | + | ||
2290 | + | var L = constraints[0].args[0] | |
2291 | + | if (constraints[0].args[1] !== "init") { | |
2292 | + | constraint.cont = [__pc_1_10, __n + 1] | |
2293 | + | stack.push(constraint) | |
2294 | + | return | |
2295 | + | } | |
2296 | + | var A = constraints[0].args[2] | |
2297 | + | var _ = constraints[0].args[3] | |
2298 | + | ||
2299 | + | var A_0 = constraints[1].args[0] | |
2300 | + | var B = constraints[1].args[1] | |
2301 | + | ||
2302 | + | if (!(A === A_0 && L === L_0)) { | |
2303 | + | constraint.cont = [__pc_1_10, __n + 1] | |
2304 | + | stack.push(constraint) | |
2305 | + | return | |
2306 | + | } | |
2307 | + | ||
2308 | + | ;(function () { | |
2309 | + | var _c = new Constraint("mem", 2, [ B, 0 ]) | |
2310 | + | _c.cont = [__mem_2_0, 0] | |
2311 | + | stack.push(_c) | |
2312 | + | })() | |
2313 | + | ||
2314 | + | ;(function () { | |
2315 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2316 | + | _c.cont = [__pc_1_0, 0] | |
2317 | + | stack.push(_c) | |
2318 | + | })() | |
2319 | + | ||
2320 | + | // active constraint gets removed | |
2321 | + | } | |
2322 | + | ||
2323 | + | function __mem_2_19 (constraint, __n) { | |
2324 | + | __n = __n || 0 | |
2325 | + | ||
2326 | + | var A_0 = constraint.args[0] | |
2327 | + | var B = constraint.args[1] | |
2328 | + | ||
2329 | + | var constraintPattern = [ "prog/4", "_", "pc/1" ] | |
2330 | + | var lookupResult = chr.Store.lookupResume(11, constraintPattern, constraint, __n) | |
2331 | + | if (lookupResult === false) { | |
2332 | + | constraint.cont = [__mem_2_20, 0] | |
2333 | + | stack.push(constraint) | |
2334 | + | return | |
2335 | + | } | |
2336 | + | var constraints = lookupResult.res | |
2337 | + | ||
2338 | + | var L = constraints[0].args[0] | |
2339 | + | if (constraints[0].args[1] !== "init") { | |
2340 | + | constraint.cont = [__mem_2_19, __n + 1] | |
2341 | + | stack.push(constraint) | |
2342 | + | return | |
2343 | + | } | |
2344 | + | var A = constraints[0].args[2] | |
2345 | + | var _ = constraints[0].args[3] | |
2346 | + | ||
2347 | + | var L_0 = constraints[2].args[0] | |
2348 | + | ||
2349 | + | if (!(A === A_0 && L === L_0)) { | |
2350 | + | constraint.cont = [__mem_2_19, __n + 1] | |
2351 | + | stack.push(constraint) | |
2352 | + | return | |
2353 | + | } | |
2354 | + | ||
2355 | + | chr.Store.remove(constraints[2]) | |
2356 | + | ||
2357 | + | ;(function () { | |
2358 | + | var _c = new Constraint("mem", 2, [ B, 0 ]) | |
2359 | + | _c.cont = [__mem_2_0, 0] | |
2360 | + | stack.push(_c) | |
2361 | + | })() | |
2362 | + | ||
2363 | + | ;(function () { | |
2364 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2365 | + | _c.cont = [__pc_1_0, 0] | |
2366 | + | stack.push(_c) | |
2367 | + | })() | |
2368 | + | ||
2369 | + | constraint.cont = [__mem_2_19, __n + 1] | |
2370 | + | stack.push(constraint) | |
2371 | + | return | |
2372 | + | } | |
2373 | + | ||
2374 | + | function __prog_4_10 (constraint, __n) { | |
2375 | + | __n = __n || 0 | |
2376 | + | ||
2377 | + | var L = constraint.args[0] | |
2378 | + | if (constraint.args[1] !== "init") { | |
2379 | + | constraint.cont = [__prog_4_11, 0] | |
2380 | + | stack.push(constraint) | |
2381 | + | return | |
2382 | + | } | |
2383 | + | var A = constraint.args[2] | |
2384 | + | var _ = constraint.args[3] | |
2385 | + | ||
2386 | + | var constraintPattern = [ "_", "mem/2", "pc/1" ] | |
2387 | + | var lookupResult = chr.Store.lookupResume(11, constraintPattern, constraint, __n) | |
2388 | + | if (lookupResult === false) { | |
2389 | + | constraint.cont = [__prog_4_11, 0] | |
2390 | + | stack.push(constraint) | |
2391 | + | return | |
2392 | + | } | |
2393 | + | var constraints = lookupResult.res | |
2394 | + | ||
2395 | + | var A_0 = constraints[1].args[0] | |
2396 | + | var B = constraints[1].args[1] | |
2397 | + | ||
2398 | + | var L_0 = constraints[2].args[0] | |
2399 | + | ||
2400 | + | if (!(A === A_0 && L === L_0)) { | |
2401 | + | constraint.cont = [__prog_4_10, __n + 1] | |
2402 | + | stack.push(constraint) | |
2403 | + | return | |
2404 | + | } | |
2405 | + | ||
2406 | + | chr.Store.remove(constraints[2]) | |
2407 | + | ||
2408 | + | ;(function () { | |
2409 | + | var _c = new Constraint("mem", 2, [ B, 0 ]) | |
2410 | + | _c.cont = [__mem_2_0, 0] | |
2411 | + | stack.push(_c) | |
2412 | + | })() | |
2413 | + | ||
2414 | + | ;(function () { | |
2415 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2416 | + | _c.cont = [__pc_1_0, 0] | |
2417 | + | stack.push(_c) | |
2418 | + | })() | |
2419 | + | ||
2420 | + | constraint.cont = [__prog_4_10, __n + 1] | |
2421 | + | stack.push(constraint) | |
2422 | + | return | |
2423 | + | } | |
2424 | + | ||
2425 | + | function __pc_1_11 (constraint, __n) { | |
2426 | + | __n = __n || 0 | |
2427 | + | ||
2428 | + | var L_0 = constraint.args[0] | |
2429 | + | ||
2430 | + | var constraintPattern = [ "prog/4", "_" ] | |
2431 | + | var lookupResult = chr.Store.lookupResume(12, constraintPattern, constraint, __n) | |
2432 | + | if (lookupResult === false) { | |
2433 | + | constraint.cont = [__pc_1_12, 0] | |
2434 | + | stack.push(constraint) | |
2435 | + | return | |
2436 | + | } | |
2437 | + | var constraints = lookupResult.res | |
2438 | + | ||
2439 | + | var L = constraints[0].args[0] | |
2440 | + | if (constraints[0].args[1] !== "jump") { | |
2441 | + | constraint.cont = [__pc_1_11, __n + 1] | |
2442 | + | stack.push(constraint) | |
2443 | + | return | |
2444 | + | } | |
2445 | + | var _ = constraints[0].args[2] | |
2446 | + | var A = constraints[0].args[3] | |
2447 | + | ||
2448 | + | if (!(L === L_0)) { | |
2449 | + | constraint.cont = [__pc_1_11, __n + 1] | |
2450 | + | stack.push(constraint) | |
2451 | + | return | |
2452 | + | } | |
2453 | + | ||
2454 | + | ;(function () { | |
2455 | + | var _c = new Constraint("pc", 1, [ A ]) | |
2456 | + | _c.cont = [__pc_1_0, 0] | |
2457 | + | stack.push(_c) | |
2458 | + | })() | |
2459 | + | ||
2460 | + | // active constraint gets removed | |
2461 | + | } | |
2462 | + | ||
2463 | + | function __prog_4_11 (constraint, __n) { | |
2464 | + | __n = __n || 0 | |
2465 | + | ||
2466 | + | var L = constraint.args[0] | |
2467 | + | if (constraint.args[1] !== "jump") { | |
2468 | + | constraint.cont = [__prog_4_12, 0] | |
2469 | + | stack.push(constraint) | |
2470 | + | return | |
2471 | + | } | |
2472 | + | var _ = constraint.args[2] | |
2473 | + | var A = constraint.args[3] | |
2474 | + | ||
2475 | + | var constraintPattern = [ "_", "pc/1" ] | |
2476 | + | var lookupResult = chr.Store.lookupResume(12, constraintPattern, constraint, __n) | |
2477 | + | if (lookupResult === false) { | |
2478 | + | constraint.cont = [__prog_4_12, 0] | |
2479 | + | stack.push(constraint) | |
2480 | + | return | |
2481 | + | } | |
2482 | + | var constraints = lookupResult.res | |
2483 | + | ||
2484 | + | var L_0 = constraints[1].args[0] | |
2485 | + | ||
2486 | + | if (!(L === L_0)) { | |
2487 | + | constraint.cont = [__prog_4_11, __n + 1] | |
2488 | + | stack.push(constraint) | |
2489 | + | return | |
2490 | + | } | |
2491 | + | ||
2492 | + | chr.Store.remove(constraints[1]) | |
2493 | + | ||
2494 | + | ;(function () { | |
2495 | + | var _c = new Constraint("pc", 1, [ A ]) | |
2496 | + | _c.cont = [__pc_1_0, 0] | |
2497 | + | stack.push(_c) | |
2498 | + | })() | |
2499 | + | ||
2500 | + | constraint.cont = [__prog_4_11, __n + 1] | |
2501 | + | stack.push(constraint) | |
2502 | + | return | |
2503 | + | } | |
2504 | + | ||
2505 | + | function __pc_1_12 (constraint, __n) { | |
2506 | + | __n = __n || 0 | |
2507 | + | ||
2508 | + | var L_0 = constraint.args[0] | |
2509 | + | ||
2510 | + | var constraintPattern = [ "prog/4", "mem/2", "_" ] | |
2511 | + | var lookupResult = chr.Store.lookupResume(13, constraintPattern, constraint, __n) | |
2512 | + | if (lookupResult === false) { | |
2513 | + | constraint.cont = [__pc_1_13, 0] | |
2514 | + | stack.push(constraint) | |
2515 | + | return | |
2516 | + | } | |
2517 | + | var constraints = lookupResult.res | |
2518 | + | ||
2519 | + | var L = constraints[0].args[0] | |
2520 | + | if (constraints[0].args[1] !== "cjmp") { | |
2521 | + | constraint.cont = [__pc_1_12, __n + 1] | |
2522 | + | stack.push(constraint) | |
2523 | + | return | |
2524 | + | } | |
2525 | + | var R = constraints[0].args[2] | |
2526 | + | var A = constraints[0].args[3] | |
2527 | + | ||
2528 | + | var R_0 = constraints[1].args[0] | |
2529 | + | var X = constraints[1].args[1] | |
2530 | + | ||
2531 | + | if (!(X == 0 && R === R_0 && L === L_0)) { | |
2532 | + | constraint.cont = [__pc_1_12, __n + 1] | |
2533 | + | stack.push(constraint) | |
2534 | + | return | |
2535 | + | } | |
2536 | + | ||
2537 | + | ;(function () { | |
2538 | + | var _c = new Constraint("pc", 1, [ A ]) | |
2539 | + | _c.cont = [__pc_1_0, 0] | |
2540 | + | stack.push(_c) | |
2541 | + | })() | |
2542 | + | ||
2543 | + | // active constraint gets removed | |
2544 | + | } | |
2545 | + | ||
2546 | + | function __mem_2_20 (constraint, __n) { | |
2547 | + | __n = __n || 0 | |
2548 | + | ||
2549 | + | var R_0 = constraint.args[0] | |
2550 | + | var X = constraint.args[1] | |
2551 | + | ||
2552 | + | var constraintPattern = [ "prog/4", "_", "pc/1" ] | |
2553 | + | var lookupResult = chr.Store.lookupResume(13, constraintPattern, constraint, __n) | |
2554 | + | if (lookupResult === false) { | |
2555 | + | constraint.cont = [__mem_2_21, 0] | |
2556 | + | stack.push(constraint) | |
2557 | + | return | |
2558 | + | } | |
2559 | + | var constraints = lookupResult.res | |
2560 | + | ||
2561 | + | var L = constraints[0].args[0] | |
2562 | + | if (constraints[0].args[1] !== "cjmp") { | |
2563 | + | constraint.cont = [__mem_2_20, __n + 1] | |
2564 | + | stack.push(constraint) | |
2565 | + | return | |
2566 | + | } | |
2567 | + | var R = constraints[0].args[2] | |
2568 | + | var A = constraints[0].args[3] | |
2569 | + | ||
2570 | + | var L_0 = constraints[2].args[0] | |
2571 | + | ||
2572 | + | if (!(X == 0 && R === R_0 && L === L_0)) { | |
2573 | + | constraint.cont = [__mem_2_20, __n + 1] | |
2574 | + | stack.push(constraint) | |
2575 | + | return | |
2576 | + | } | |
2577 | + | ||
2578 | + | chr.Store.remove(constraints[2]) | |
2579 | + | ||
2580 | + | ;(function () { | |
2581 | + | var _c = new Constraint("pc", 1, [ A ]) | |
2582 | + | _c.cont = [__pc_1_0, 0] | |
2583 | + | stack.push(_c) | |
2584 | + | })() | |
2585 | + | ||
2586 | + | constraint.cont = [__mem_2_20, __n + 1] | |
2587 | + | stack.push(constraint) | |
2588 | + | return | |
2589 | + | } | |
2590 | + | ||
2591 | + | function __prog_4_12 (constraint, __n) { | |
2592 | + | __n = __n || 0 | |
2593 | + | ||
2594 | + | var L = constraint.args[0] | |
2595 | + | if (constraint.args[1] !== "cjmp") { | |
2596 | + | constraint.cont = [__prog_4_13, 0] | |
2597 | + | stack.push(constraint) | |
2598 | + | return | |
2599 | + | } | |
2600 | + | var R = constraint.args[2] | |
2601 | + | var A = constraint.args[3] | |
2602 | + | ||
2603 | + | var constraintPattern = [ "_", "mem/2", "pc/1" ] | |
2604 | + | var lookupResult = chr.Store.lookupResume(13, constraintPattern, constraint, __n) | |
2605 | + | if (lookupResult === false) { | |
2606 | + | constraint.cont = [__prog_4_13, 0] | |
2607 | + | stack.push(constraint) | |
2608 | + | return | |
2609 | + | } | |
2610 | + | var constraints = lookupResult.res | |
2611 | + | ||
2612 | + | var R_0 = constraints[1].args[0] | |
2613 | + | var X = constraints[1].args[1] | |
2614 | + | ||
2615 | + | var L_0 = constraints[2].args[0] | |
2616 | + | ||
2617 | + | if (!(X == 0 && R === R_0 && L === L_0)) { | |
2618 | + | constraint.cont = [__prog_4_12, __n + 1] | |
2619 | + | stack.push(constraint) | |
2620 | + | return | |
2621 | + | } | |
2622 | + | ||
2623 | + | chr.Store.remove(constraints[2]) | |
2624 | + | ||
2625 | + | ;(function () { | |
2626 | + | var _c = new Constraint("pc", 1, [ A ]) | |
2627 | + | _c.cont = [__pc_1_0, 0] | |
2628 | + | stack.push(_c) | |
2629 | + | })() | |
2630 | + | ||
2631 | + | constraint.cont = [__prog_4_12, __n + 1] | |
2632 | + | stack.push(constraint) | |
2633 | + | return | |
2634 | + | } | |
2635 | + | ||
2636 | + | function __pc_1_13 (constraint, __n) { | |
2637 | + | __n = __n || 0 | |
2638 | + | ||
2639 | + | var L_0 = constraint.args[0] | |
2640 | + | ||
2641 | + | var constraintPattern = [ "prog/4", "mem/2", "_" ] | |
2642 | + | var lookupResult = chr.Store.lookupResume(14, constraintPattern, constraint, __n) | |
2643 | + | if (lookupResult === false) { | |
2644 | + | constraint.cont = [__pc_1_14, 0] | |
2645 | + | stack.push(constraint) | |
2646 | + | return | |
2647 | + | } | |
2648 | + | var constraints = lookupResult.res | |
2649 | + | ||
2650 | + | var L = constraints[0].args[0] | |
2651 | + | if (constraints[0].args[1] !== "cjmp") { | |
2652 | + | constraint.cont = [__pc_1_13, __n + 1] | |
2653 | + | stack.push(constraint) | |
2654 | + | return | |
2655 | + | } | |
2656 | + | var R = constraints[0].args[2] | |
2657 | + | var _ = constraints[0].args[3] | |
2658 | + | ||
2659 | + | var R_0 = constraints[1].args[0] | |
2660 | + | var X = constraints[1].args[1] | |
2661 | + | ||
2662 | + | if (!(X != 0 && R === R_0 && L === L_0)) { | |
2663 | + | constraint.cont = [__pc_1_13, __n + 1] | |
2664 | + | stack.push(constraint) | |
2665 | + | return | |
2666 | + | } | |
2667 | + | ||
2668 | + | ;(function () { | |
2669 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2670 | + | _c.cont = [__pc_1_0, 0] | |
2671 | + | stack.push(_c) | |
2672 | + | })() | |
2673 | + | ||
2674 | + | // active constraint gets removed | |
2675 | + | } | |
2676 | + | ||
2677 | + | function __mem_2_21 (constraint, __n) { | |
2678 | + | __n = __n || 0 | |
2679 | + | ||
2680 | + | var R_0 = constraint.args[0] | |
2681 | + | var X = constraint.args[1] | |
2682 | + | ||
2683 | + | var constraintPattern = [ "prog/4", "_", "pc/1" ] | |
2684 | + | var lookupResult = chr.Store.lookupResume(14, constraintPattern, constraint, __n) | |
2685 | + | if (lookupResult === false) { | |
2686 | + | constraint.cont = [__mem_2_22, 0] | |
2687 | + | stack.push(constraint) | |
2688 | + | return | |
2689 | + | } | |
2690 | + | var constraints = lookupResult.res | |
2691 | + | ||
2692 | + | var L = constraints[0].args[0] | |
2693 | + | if (constraints[0].args[1] !== "cjmp") { | |
2694 | + | constraint.cont = [__mem_2_21, __n + 1] | |
2695 | + | stack.push(constraint) | |
2696 | + | return | |
2697 | + | } | |
2698 | + | var R = constraints[0].args[2] | |
2699 | + | var _ = constraints[0].args[3] | |
2700 | + | ||
2701 | + | var L_0 = constraints[2].args[0] | |
2702 | + | ||
2703 | + | if (!(X != 0 && R === R_0 && L === L_0)) { | |
2704 | + | constraint.cont = [__mem_2_21, __n + 1] | |
2705 | + | stack.push(constraint) | |
2706 | + | return | |
2707 | + | } | |
2708 | + | ||
2709 | + | chr.Store.remove(constraints[2]) | |
2710 | + | ||
2711 | + | ;(function () { | |
2712 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2713 | + | _c.cont = [__pc_1_0, 0] | |
2714 | + | stack.push(_c) | |
2715 | + | })() | |
2716 | + | ||
2717 | + | constraint.cont = [__mem_2_21, __n + 1] | |
2718 | + | stack.push(constraint) | |
2719 | + | return | |
2720 | + | } | |
2721 | + | ||
2722 | + | function __prog_4_13 (constraint, __n) { | |
2723 | + | __n = __n || 0 | |
2724 | + | ||
2725 | + | var L = constraint.args[0] | |
2726 | + | if (constraint.args[1] !== "cjmp") { | |
2727 | + | constraint.cont = [__prog_4_14, 0] | |
2728 | + | stack.push(constraint) | |
2729 | + | return | |
2730 | + | } | |
2731 | + | var R = constraint.args[2] | |
2732 | + | var _ = constraint.args[3] | |
2733 | + | ||
2734 | + | var constraintPattern = [ "_", "mem/2", "pc/1" ] | |
2735 | + | var lookupResult = chr.Store.lookupResume(14, constraintPattern, constraint, __n) | |
2736 | + | if (lookupResult === false) { | |
2737 | + | constraint.cont = [__prog_4_14, 0] | |
2738 | + | stack.push(constraint) | |
2739 | + | return | |
2740 | + | } | |
2741 | + | var constraints = lookupResult.res | |
2742 | + | ||
2743 | + | var R_0 = constraints[1].args[0] | |
2744 | + | var X = constraints[1].args[1] | |
2745 | + | ||
2746 | + | var L_0 = constraints[2].args[0] | |
2747 | + | ||
2748 | + | if (!(X != 0 && R === R_0 && L === L_0)) { | |
2749 | + | constraint.cont = [__prog_4_13, __n + 1] | |
2750 | + | stack.push(constraint) | |
2751 | + | return | |
2752 | + | } | |
2753 | + | ||
2754 | + | chr.Store.remove(constraints[2]) | |
2755 | + | ||
2756 | + | ;(function () { | |
2757 | + | var _c = new Constraint("pc", 1, [ L + 1 ]) | |
2758 | + | _c.cont = [__pc_1_0, 0] | |
2759 | + | stack.push(_c) | |
2760 | + | })() | |
2761 | + | ||
2762 | + | constraint.cont = [__prog_4_13, __n + 1] | |
2763 | + | stack.push(constraint) | |
2764 | + | return | |
2765 | + | } | |
2766 | + | ||
2767 | + | function __pc_1_14 (constraint, __n) { | |
2768 | + | __n = __n || 0 | |
2769 | + | ||
2770 | + | var L_0 = constraint.args[0] | |
2771 | + | ||
2772 | + | var constraintPattern = [ "prog/4", "_" ] | |
2773 | + | var lookupResult = chr.Store.lookupResume(15, constraintPattern, constraint, __n) | |
2774 | + | if (lookupResult === false) { | |
2775 | + | constraint.cont = [__pc_1_15, 0] | |
2776 | + | stack.push(constraint) | |
2777 | + | return | |
2778 | + | } | |
2779 | + | var constraints = lookupResult.res | |
2780 | + | ||
2781 | + | var L = constraints[0].args[0] | |
2782 | + | if (constraints[0].args[1] !== "halt") { | |
2783 | + | constraint.cont = [__pc_1_14, __n + 1] | |
2784 | + | stack.push(constraint) | |
2785 | + | return | |
2786 | + | } | |
2787 | + | var _ = constraints[0].args[2] | |
2788 | + | var __0 = constraints[0].args[3] | |
2789 | + | ||
2790 | + | if (!(_ === __0 && L === L_0)) { | |
2791 | + | constraint.cont = [__pc_1_14, __n + 1] | |
2792 | + | stack.push(constraint) | |
2793 | + | return | |
2794 | + | } | |
2795 | + | ||
2796 | + | // active constraint gets removed | |
2797 | + | } | |
2798 | + | ||
2799 | + | function __prog_4_14 (constraint, __n) { | |
2800 | + | __n = __n || 0 | |
2801 | + | ||
2802 | + | var L = constraint.args[0] | |
2803 | + | if (constraint.args[1] !== "halt") { | |
2804 | + | constraint.cont = [__prog_4_15, 0] | |
2805 | + | stack.push(constraint) | |
2806 | + | return | |
2807 | + | } | |
2808 | + | var _ = constraint.args[2] | |
2809 | + | var __0 = constraint.args[3] | |
2810 | + | ||
2811 | + | var constraintPattern = [ "_", "pc/1" ] | |
2812 | + | var lookupResult = chr.Store.lookupResume(15, constraintPattern, constraint, __n) | |
2813 | + | if (lookupResult === false) { | |
2814 | + | constraint.cont = [__prog_4_15, 0] | |
2815 | + | stack.push(constraint) | |
2816 | + | return | |
2817 | + | } | |
2818 | + | var constraints = lookupResult.res | |
2819 | + | ||
2820 | + | var L_0 = constraints[1].args[0] | |
2821 | + | ||
2822 | + | if (!(_ === __0 && L === L_0)) { | |
2823 | + | constraint.cont = [__prog_4_14, __n + 1] | |
2824 | + | stack.push(constraint) | |
2825 | + | return | |
2826 | + | } | |
2827 | + | ||
2828 | + | chr.Store.remove(constraints[1]) | |
2829 | + | ||
2830 | + | constraint.cont = [__prog_4_14, __n + 1] | |
2831 | + | stack.push(constraint) | |
2832 | + | return | |
2833 | + | } | |
2834 | + | ||
2835 | + | function __pc_1_15 (constraint, __n) { | |
2836 | + | __n = __n || 0 | |
2837 | + | ||
2838 | + | var _ = constraint.args[0] | |
2839 | + | ||
2840 | + | ;(function () { | |
2841 | + | var _c = new Constraint("fail", 0, [ ]) | |
2842 | + | _c.cont = [__fail_0_0, 0] | |
2843 | + | stack.push(_c) | |
2844 | + | })() | |
2845 | + | ||
2846 | + | // active constraint gets removed | |
2847 | + | } | |
2848 | + | ||
2849 | + | function __mem_2_22 (constraint) { | |
2850 | + | constraint.cont = null | |
2851 | + | chr.Store.add(constraint) | |
2852 | + | } | |
2853 | + | ||
2854 | + | function __fail_0_0 (constraint) { | |
2855 | + | constraint.cont = null | |
2856 | + | chr.Store.add(constraint) | |
2857 | + | } | |
2858 | + | ||
2859 | + | function __prog_4_15 (constraint) { | |
2860 | + | constraint.cont = null | |
2861 | + | chr.Store.add(constraint) | |
2862 | + | } | |
2863 | + | ||
2864 | + | function __pc_1_16 (constraint) { | |
2865 | + | constraint.cont = null | |
2866 | + | chr.Store.add(constraint) | |
2867 | + | } | |
2868 | + | ||
2869 | + | function mem () { | |
2870 | + | var args = Array.prototype.slice.call(arguments) | |
2871 | + | var arity = arguments.length | |
2872 | + | var functor = "mem/" + arity | |
2873 | + | var constraint = new Constraint("mem", arity, args) | |
2874 | + | if (arity === 2) { | |
2875 | + | constraint.cont = [__mem_2_0, ] | |
2876 | + | } else { | |
2877 | + | throw new Error("Undefined constraint: " + functor) | |
2878 | + | } | |
2879 | + | stack.push(constraint) | |
2880 | + | ||
2881 | + | trampoline() | |
2882 | + | } | |
2883 | + | ||
2884 | + | function fail () { | |
2885 | + | var args = Array.prototype.slice.call(arguments) | |
2886 | + | var arity = arguments.length | |
2887 | + | var functor = "fail/" + arity | |
2888 | + | var constraint = new Constraint("fail", arity, args) | |
2889 | + | if (arity === 0) { | |
2890 | + | constraint.cont = [__fail_0_0, ] | |
2891 | + | } else { | |
2892 | + | throw new Error("Undefined constraint: " + functor) | |
2893 | + | } | |
2894 | + | stack.push(constraint) | |
2895 | + | ||
2896 | + | trampoline() | |
2897 | + | } | |
2898 | + | ||
2899 | + | function prog () { | |
2900 | + | var args = Array.prototype.slice.call(arguments) | |
2901 | + | var arity = arguments.length | |
2902 | + | var functor = "prog/" + arity | |
2903 | + | var constraint = new Constraint("prog", arity, args) | |
2904 | + | if (arity === 4) { | |
2905 | + | constraint.cont = [__prog_4_0, ] | |
2906 | + | } else { | |
2907 | + | throw new Error("Undefined constraint: " + functor) | |
2908 | + | } | |
2909 | + | stack.push(constraint) | |
2910 | + | ||
2911 | + | trampoline() | |
2912 | + | } | |
2913 | + | ||
2914 | + | function pc () { | |
2915 | + | var args = Array.prototype.slice.call(arguments) | |
2916 | + | var arity = arguments.length | |
2917 | + | var functor = "pc/" + arity | |
2918 | + | var constraint = new Constraint("pc", arity, args) | |
2919 | + | if (arity === 1) { | |
2920 | + | constraint.cont = [__pc_1_0, ] | |
2921 | + | } else { | |
2922 | + | throw new Error("Undefined constraint: " + functor) | |
2923 | + | } | |
2924 | + | stack.push(constraint) | |
2925 | + | ||
2926 | + | trampoline() | |
2927 | + | } | |
2928 | + | ||
2929 | + | chr.mem = mem | |
2930 | + | chr.fail = fail | |
2931 | + | chr.prog = prog | |
2932 | + | chr.pc = pc | |
2933 | + | ||
2934 | + | return chr | |
2935 | + | })() |
上一頁
下一頁