Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / dromaeo / tests / v8-earley-boyer.html
blob6324417fee016cdff34d91bafffe50f201f735df
1 <html>
2 <head>
3 <script src="../htmlrunner.js"></script>
4 <script>
5 // This file is automatically generated by scheme2js, except for the
6 // benchmark harness code at the beginning and end of the file.
8 /************* GENERATED FILE - DO NOT EDIT *************/
9 /************* GENERATED FILE - DO NOT EDIT *************/
10 /************* GENERATED FILE - DO NOT EDIT *************/
11 /************* GENERATED FILE - DO NOT EDIT *************/
12 /************* GENERATED FILE - DO NOT EDIT *************/
13 /************* GENERATED FILE - DO NOT EDIT *************/
14 /************* GENERATED FILE - DO NOT EDIT *************/
15 /************* GENERATED FILE - DO NOT EDIT *************/
17 * To use write/prints/... the default-output port has to be set first.
18 * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values
19 * should do the trick.
20 * In the following example the std-out and error-port are redirected to
21 * a DIV.
22 function initRuntime() {
23 function escapeHTML(s) {
24 var tmp = s;
25 tmp = tmp.replace(/&/g, "&amp;");
26 tmp = tmp.replace(/</g, "&lt;");
27 tmp = tmp.replace(/>/g, "&gt;");
28 tmp = tmp.replace(/ /g, "&nbsp;");
29 tmp = tmp.replace(/\n/g, "<br />");
30 tmp = tmp.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp");
31 return tmp;
35 document.write("<div id='stdout'></div>");
36 SC_DEFAULT_OUT = new sc_GenericOutputPort(
37 function(s) {
38 var stdout = document.getElementById('stdout');
39 stdout.innerHTML = stdout.innerHTML + escapeHTML(s);
40 });
41 SC_ERROR_OUT = SC_DEFAULT_OUT;
46 function sc_print_debug() {
47 sc_print.apply(null, arguments);
49 /*** META ((export *js*)) */
50 var sc_JS_GLOBALS = this;
52 var __sc_LINE=-1;
53 var __sc_FILE="";
55 /*** META ((export #t)) */
56 function sc_alert() {
57 var len = arguments.length;
58 var s = "";
59 var i;
61 for( i = 0; i < len; i++ ) {
62 s += sc_toDisplayString(arguments[ i ]);
65 return alert( s );
68 /*** META ((export #t)) */
69 function sc_typeof( x ) {
70 return typeof x;
73 /*** META ((export #t)) */
74 function sc_error() {
75 var a = [sc_jsstring2symbol("*error*")];
76 for (var i = 0; i < arguments.length; i++) {
77 a[i+1] = arguments[i];
79 throw a;
82 /*** META ((export #t)
83 (peephole (prefix "throw ")))
85 function sc_raise(obj) {
86 throw obj;
89 /*** META ((export with-handler-lambda)) */
90 function sc_withHandlerLambda(handler, body) {
91 try {
92 return body();
93 } catch(e) {
94 if (!e._internalException)
95 return handler(e);
96 else
97 throw e;
101 var sc_properties = new Object();
103 /*** META ((export #t)) */
104 function sc_putpropBang(sym, key, val) {
105 var ht = sc_properties[sym];
106 if (!ht) {
107 ht = new Object();
108 sc_properties[sym] = ht;
110 ht[key] = val;
113 /*** META ((export #t)) */
114 function sc_getprop(sym, key) {
115 var ht = sc_properties[sym];
116 if (ht) {
117 if (key in ht)
118 return ht[key];
119 else
120 return false;
121 } else
122 return false;
125 /*** META ((export #t)) */
126 function sc_rempropBang(sym, key) {
127 var ht = sc_properties[sym];
128 if (ht)
129 delete ht[key];
132 /*** META ((export #t)) */
133 function sc_any2String(o) {
134 return jsstring2string(sc_toDisplayString(o));
137 /*** META ((export #t)
138 (peephole (infix 2 2 "==="))
139 (type bool))
141 function sc_isEqv(o1, o2) {
142 return (o1 === o2);
145 /*** META ((export #t)
146 (peephole (infix 2 2 "==="))
147 (type bool))
149 function sc_isEq(o1, o2) {
150 return (o1 === o2);
153 /*** META ((export #t)
154 (type bool))
156 function sc_isNumber(n) {
157 return (typeof n === "number");
160 /*** META ((export #t)
161 (type bool))
163 function sc_isComplex(n) {
164 return sc_isNumber(n);
167 /*** META ((export #t)
168 (type bool))
170 function sc_isReal(n) {
171 return sc_isNumber(n);
174 /*** META ((export #t)
175 (type bool))
177 function sc_isRational(n) {
178 return sc_isReal(n);
181 /*** META ((export #t)
182 (type bool))
184 function sc_isInteger(n) {
185 return (parseInt(n) === n);
188 /*** META ((export #t)
189 (type bool)
190 (peephole (postfix ", false")))
192 // we don't have exact numbers...
193 function sc_isExact(n) {
194 return false;
197 /*** META ((export #t)
198 (peephole (postfix ", true"))
199 (type bool))
201 function sc_isInexact(n) {
202 return true;
205 /*** META ((export = =fx =fl)
206 (type bool)
207 (peephole (infix 2 2 "===")))
209 function sc_equal(x) {
210 for (var i = 1; i < arguments.length; i++)
211 if (x !== arguments[i])
212 return false;
213 return true;
216 /*** META ((export < <fx <fl)
217 (type bool)
218 (peephole (infix 2 2 "<")))
220 function sc_less(x) {
221 for (var i = 1; i < arguments.length; i++) {
222 if (x >= arguments[i])
223 return false;
224 x = arguments[i];
226 return true;
229 /*** META ((export > >fx >fl)
230 (type bool)
231 (peephole (infix 2 2 ">")))
233 function sc_greater(x, y) {
234 for (var i = 1; i < arguments.length; i++) {
235 if (x <= arguments[i])
236 return false;
237 x = arguments[i];
239 return true;
242 /*** META ((export <= <=fx <=fl)
243 (type bool)
244 (peephole (infix 2 2 "<=")))
246 function sc_lessEqual(x, y) {
247 for (var i = 1; i < arguments.length; i++) {
248 if (x > arguments[i])
249 return false;
250 x = arguments[i];
252 return true;
255 /*** META ((export >= >=fl >=fx)
256 (type bool)
257 (peephole (infix 2 2 ">=")))
259 function sc_greaterEqual(x, y) {
260 for (var i = 1; i < arguments.length; i++) {
261 if (x < arguments[i])
262 return false;
263 x = arguments[i];
265 return true;
268 /*** META ((export #t)
269 (type bool)
270 (peephole (postfix "=== 0")))
272 function sc_isZero(x) {
273 return (x === 0);
276 /*** META ((export #t)
277 (type bool)
278 (peephole (postfix "> 0")))
280 function sc_isPositive(x) {
281 return (x > 0);
284 /*** META ((export #t)
285 (type bool)
286 (peephole (postfix "< 0")))
288 function sc_isNegative(x) {
289 return (x < 0);
292 /*** META ((export #t)
293 (type bool)
294 (peephole (postfix "%2===1")))
296 function sc_isOdd(x) {
297 return (x % 2 === 1);
300 /*** META ((export #t)
301 (type bool)
302 (peephole (postfix "%2===0")))
304 function sc_isEven(x) {
305 return (x % 2 === 0);
308 /*** META ((export #t)) */
309 var sc_max = Math.max;
310 /*** META ((export #t)) */
311 var sc_min = Math.min;
313 /*** META ((export + +fx +fl)
314 (peephole (infix 0 #f "+" "0")))
316 function sc_plus() {
317 var sum = 0;
318 for (var i = 0; i < arguments.length; i++)
319 sum += arguments[i];
320 return sum;
323 /*** META ((export * *fx *fl)
324 (peephole (infix 0 #f "*" "1")))
326 function sc_multi() {
327 var product = 1;
328 for (var i = 0; i < arguments.length; i++)
329 product *= arguments[i];
330 return product;
333 /*** META ((export - -fx -fl)
334 (peephole (minus)))
336 function sc_minus(x) {
337 if (arguments.length === 1)
338 return -x;
339 else {
340 var res = x;
341 for (var i = 1; i < arguments.length; i++)
342 res -= arguments[i];
343 return res;
347 /*** META ((export / /fl)
348 (peephole (div)))
350 function sc_div(x) {
351 if (arguments.length === 1)
352 return 1/x;
353 else {
354 var res = x;
355 for (var i = 1; i < arguments.length; i++)
356 res /= arguments[i];
357 return res;
361 /*** META ((export #t)) */
362 var sc_abs = Math.abs;
364 /*** META ((export quotient /fx)
365 (peephole (hole 2 "parseInt(" x "/" y ")")))
367 function sc_quotient(x, y) {
368 return parseInt(x / y);
371 /*** META ((export #t)
372 (peephole (infix 2 2 "%")))
374 function sc_remainder(x, y) {
375 return x % y;
378 /*** META ((export #t)
379 (peephole (modulo)))
381 function sc_modulo(x, y) {
382 var remainder = x % y;
383 // if they don't have the same sign
384 if ((remainder * y) < 0)
385 return remainder + y;
386 else
387 return remainder;
390 function sc_euclid_gcd(a, b) {
391 var temp;
392 if (a === 0) return b;
393 if (b === 0) return a;
394 if (a < 0) {a = -a;};
395 if (b < 0) {b = -b;};
396 if (b > a) {temp = a; a = b; b = temp;};
397 while (true) {
398 a %= b;
399 if(a === 0) {return b;};
400 b %= a;
401 if(b === 0) {return a;};
403 return b;
406 /*** META ((export #t)) */
407 function sc_gcd() {
408 var gcd = 0;
409 for (var i = 0; i < arguments.length; i++)
410 gcd = sc_euclid_gcd(gcd, arguments[i]);
411 return gcd;
414 /*** META ((export #t)) */
415 function sc_lcm() {
416 var lcm = 1;
417 for (var i = 0; i < arguments.length; i++) {
418 var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm));
419 lcm *= Math.abs(f);
421 return lcm;
424 // LIMITATION: numerator and denominator don't make sense in floating point world.
425 //var SC_MAX_DECIMALS = 1000000
427 // function sc_numerator(x) {
428 // var rounded = Math.round(x * SC_MAX_DECIMALS);
429 // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
430 // }
432 // function sc_denominator(x) {
433 // var rounded = Math.round(x * SC_MAX_DECIMALS);
434 // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
435 // }
437 /*** META ((export #t)) */
438 var sc_floor = Math.floor;
439 /*** META ((export #t)) */
440 var sc_ceiling = Math.ceil;
441 /*** META ((export #t)) */
442 var sc_truncate = parseInt;
443 /*** META ((export #t)) */
444 var sc_round = Math.round;
446 // LIMITATION: sc_rationalize doesn't make sense in a floating point world.
448 /*** META ((export #t)) */
449 var sc_exp = Math.exp;
450 /*** META ((export #t)) */
451 var sc_log = Math.log;
452 /*** META ((export #t)) */
453 var sc_sin = Math.sin;
454 /*** META ((export #t)) */
455 var sc_cos = Math.cos;
456 /*** META ((export #t)) */
457 var sc_tan = Math.tan;
458 /*** META ((export #t)) */
459 var sc_asin = Math.asin;
460 /*** META ((export #t)) */
461 var sc_acos = Math.acos;
462 /*** META ((export #t)) */
463 var sc_atan = Math.atan;
465 /*** META ((export #t)) */
466 var sc_sqrt = Math.sqrt;
467 /*** META ((export #t)) */
468 var sc_expt = Math.pow;
470 // LIMITATION: we don't have complex numbers.
471 // LIMITATION: the following functions are hence not implemented.
472 // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle
473 // LIMITATION: 2 argument atan
475 /*** META ((export #t)
476 (peephole (id)))
478 function sc_exact2inexact(x) {
479 return x;
482 /*** META ((export #t)
483 (peephole (id)))
485 function sc_inexact2exact(x) {
486 return x;
489 function sc_number2jsstring(x, radix) {
490 if (radix)
491 return x.toString(radix);
492 else
493 return x.toString();
496 function sc_jsstring2number(s, radix) {
497 if (s === "") return false;
499 if (radix) {
500 var t = parseInt(s, radix);
501 if (!t && t !== 0) return false;
502 // verify that each char is in range. (parseInt ignores leading
503 // white and trailing chars)
504 var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1);
505 if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s))
506 return t;
507 else return false;
508 } else {
509 var t = +s; // does not ignore trailing chars.
510 if (!t && t !== 0) return false;
511 // simply verify that first char is not whitespace.
512 var c = s.charAt(0);
513 // if +c is 0, but the char is not "0", then we have a whitespace.
514 if (+c === 0 && c !== "0") return false;
515 return t;
519 /*** META ((export #t)
520 (type bool)
521 (peephole (not)))
523 function sc_not(b) {
524 return b === false;
527 /*** META ((export #t)
528 (type bool))
530 function sc_isBoolean(b) {
531 return (b === true) || (b === false);
534 function sc_Pair(car, cdr) {
535 this.car = car;
536 this.cdr = cdr;
539 sc_Pair.prototype.toString = function() {
540 return sc_toDisplayString(this);
542 sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {
543 var current = this;
545 var res = "(";
547 while(true) {
548 res += writeOrDisplay(current.car);
549 if (sc_isPair(current.cdr)) {
550 res += " ";
551 current = current.cdr;
552 } else if (current.cdr !== null) {
553 res += " . " + writeOrDisplay(current.cdr);
554 break;
555 } else // current.cdr == null
556 break;
559 res += ")";
561 return res;
563 sc_Pair.prototype.sc_toDisplayString = function() {
564 return this.sc_toWriteOrDisplayString(sc_toDisplayString);
566 sc_Pair.prototype.sc_toWriteString = function() {
567 return this.sc_toWriteOrDisplayString(sc_toWriteString);
569 // sc_Pair.prototype.sc_toWriteCircleString in IO.js
571 /*** META ((export #t)
572 (type bool)
573 (peephole (postfix " instanceof sc_Pair")))
575 function sc_isPair(p) {
576 return (p instanceof sc_Pair);
579 function sc_isPairEqual(p1, p2, comp) {
580 return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr));
583 /*** META ((export #t)
584 (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))
586 function sc_cons(car, cdr) {
587 return new sc_Pair(car, cdr);
590 /*** META ((export cons*)) */
591 function sc_consStar() {
592 var res = arguments[arguments.length - 1];
593 for (var i = arguments.length-2; i >= 0; i--)
594 res = new sc_Pair(arguments[i], res);
595 return res;
598 /*** META ((export #t)
599 (peephole (postfix ".car")))
601 function sc_car(p) {
602 return p.car;
605 /*** META ((export #t)
606 (peephole (postfix ".cdr")))
608 function sc_cdr(p) {
609 return p.cdr;
612 /*** META ((export #t)
613 (peephole (hole 2 p ".car = " val)))
615 function sc_setCarBang(p, val) {
616 p.car = val;
619 /*** META ((export #t)
620 (peephole (hole 2 p ".cdr = " val)))
622 function sc_setCdrBang(p, val) {
623 p.cdr = val;
626 /*** META ((export #t)
627 (peephole (postfix ".car.car")))
629 function sc_caar(p) { return p.car.car; }
630 /*** META ((export #t)
631 (peephole (postfix ".cdr.car")))
633 function sc_cadr(p) { return p.cdr.car; }
634 /*** META ((export #t)
635 (peephole (postfix ".car.cdr")))
637 function sc_cdar(p) { return p.car.cdr; }
638 /*** META ((export #t)
639 (peephole (postfix ".cdr.cdr")))
641 function sc_cddr(p) { return p.cdr.cdr; }
642 /*** META ((export #t)
643 (peephole (postfix ".car.car.car")))
645 function sc_caaar(p) { return p.car.car.car; }
646 /*** META ((export #t)
647 (peephole (postfix ".car.cdr.car")))
649 function sc_cadar(p) { return p.car.cdr.car; }
650 /*** META ((export #t)
651 (peephole (postfix ".cdr.car.car")))
653 function sc_caadr(p) { return p.cdr.car.car; }
654 /*** META ((export #t)
655 (peephole (postfix ".cdr.cdr.car")))
657 function sc_caddr(p) { return p.cdr.cdr.car; }
658 /*** META ((export #t)
659 (peephole (postfix ".car.car.cdr")))
661 function sc_cdaar(p) { return p.car.car.cdr; }
662 /*** META ((export #t)
663 (peephole (postfix ".cdr.car.cdr")))
665 function sc_cdadr(p) { return p.cdr.car.cdr; }
666 /*** META ((export #t)
667 (peephole (postfix ".car.cdr.cdr")))
669 function sc_cddar(p) { return p.car.cdr.cdr; }
670 /*** META ((export #t)
671 (peephole (postfix ".cdr.cdr.cdr")))
673 function sc_cdddr(p) { return p.cdr.cdr.cdr; }
674 /*** META ((export #t)
675 (peephole (postfix ".car.car.car.car")))
677 function sc_caaaar(p) { return p.car.car.car.car; }
678 /*** META ((export #t)
679 (peephole (postfix ".car.cdr.car.car")))
681 function sc_caadar(p) { return p.car.cdr.car.car; }
682 /*** META ((export #t)
683 (peephole (postfix ".cdr.car.car.car")))
685 function sc_caaadr(p) { return p.cdr.car.car.car; }
686 /*** META ((export #t)
687 (peephole (postfix ".cdr.cdr.car.car")))
689 function sc_caaddr(p) { return p.cdr.cdr.car.car; }
690 /*** META ((export #t)
691 (peephole (postfix ".car.car.car.cdr")))
693 function sc_cdaaar(p) { return p.car.car.car.cdr; }
694 /*** META ((export #t)
695 (peephole (postfix ".car.cdr.car.cdr")))
697 function sc_cdadar(p) { return p.car.cdr.car.cdr; }
698 /*** META ((export #t)
699 (peephole (postfix ".cdr.car.car.cdr")))
701 function sc_cdaadr(p) { return p.cdr.car.car.cdr; }
702 /*** META ((export #t)
703 (peephole (postfix ".cdr.cdr.car.cdr")))
705 function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; }
706 /*** META ((export #t)
707 (peephole (postfix ".car.car.cdr.car")))
709 function sc_cadaar(p) { return p.car.car.cdr.car; }
710 /*** META ((export #t)
711 (peephole (postfix ".car.cdr.cdr.car")))
713 function sc_caddar(p) { return p.car.cdr.cdr.car; }
714 /*** META ((export #t)
715 (peephole (postfix ".cdr.car.cdr.car")))
717 function sc_cadadr(p) { return p.cdr.car.cdr.car; }
718 /*** META ((export #t)
719 (peephole (postfix ".cdr.cdr.cdr.car")))
721 function sc_cadddr(p) { return p.cdr.cdr.cdr.car; }
722 /*** META ((export #t)
723 (peephole (postfix ".car.car.cdr.cdr")))
725 function sc_cddaar(p) { return p.car.car.cdr.cdr; }
726 /*** META ((export #t)
727 (peephole (postfix ".car.cdr.cdr.cdr")))
729 function sc_cdddar(p) { return p.car.cdr.cdr.cdr; }
730 /*** META ((export #t)
731 (peephole (postfix ".cdr.car.cdr.cdr")))
733 function sc_cddadr(p) { return p.cdr.car.cdr.cdr; }
734 /*** META ((export #t)
735 (peephole (postfix ".cdr.cdr.cdr.cdr")))
737 function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; }
739 /*** META ((export #t)) */
740 function sc_lastPair(l) {
741 if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected");
742 var res = l;
743 var cdr = l.cdr;
744 while (sc_isPair(cdr)) {
745 res = cdr;
746 cdr = res.cdr;
748 return res;
751 /*** META ((export #t)
752 (type bool)
753 (peephole (postfix " === null")))
755 function sc_isNull(o) {
756 return (o === null);
759 /*** META ((export #t)
760 (type bool))
762 function sc_isList(o) {
763 var rabbit;
764 var turtle;
766 var rabbit = o;
767 var turtle = o;
768 while (true) {
769 if (rabbit === null ||
770 (rabbit instanceof sc_Pair && rabbit.cdr === null))
771 return true; // end of list
772 else if ((rabbit instanceof sc_Pair) &&
773 (rabbit.cdr instanceof sc_Pair)) {
774 rabbit = rabbit.cdr.cdr;
775 turtle = turtle.cdr;
776 if (rabbit === turtle) return false; // cycle
777 } else
778 return false; // not pair
782 /*** META ((export #t)) */
783 function sc_list() {
784 var res = null;
785 var a = arguments;
786 for (var i = a.length-1; i >= 0; i--)
787 res = new sc_Pair(a[i], res);
788 return res;
791 /*** META ((export #t)) */
792 function sc_iota(num, init) {
793 var res = null;
794 if (!init) init = 0;
795 for (var i = num - 1; i >= 0; i--)
796 res = new sc_Pair(i + init, res);
797 return res;
800 /*** META ((export #t)) */
801 function sc_makeList(nbEls, fill) {
802 var res = null;
803 for (var i = 0; i < nbEls; i++)
804 res = new sc_Pair(fill, res);
805 return res;
808 /*** META ((export #t)) */
809 function sc_length(l) {
810 var res = 0;
811 while (l !== null) {
812 res++;
813 l = l.cdr;
815 return res;
818 /*** META ((export #t)) */
819 function sc_remq(o, l) {
820 var dummy = { cdr : null };
821 var tail = dummy;
822 while (l !== null) {
823 if (l.car !== o) {
824 tail.cdr = sc_cons(l.car, null);
825 tail = tail.cdr;
827 l = l.cdr;
829 return dummy.cdr;
832 /*** META ((export #t)) */
833 function sc_remqBang(o, l) {
834 var dummy = { cdr : null };
835 var tail = dummy;
836 var needsAssig = true;
837 while (l !== null) {
838 if (l.car === o) {
839 needsAssig = true;
840 } else {
841 if (needsAssig) {
842 tail.cdr = l;
843 needsAssig = false;
845 tail = l;
847 l = l.cdr;
849 tail.cdr = null;
850 return dummy.cdr;
853 /*** META ((export #t)) */
854 function sc_delete(o, l) {
855 var dummy = { cdr : null };
856 var tail = dummy;
857 while (l !== null) {
858 if (!sc_isEqual(l.car, o)) {
859 tail.cdr = sc_cons(l.car, null);
860 tail = tail.cdr;
862 l = l.cdr;
864 return dummy.cdr;
867 /*** META ((export #t)) */
868 function sc_deleteBang(o, l) {
869 var dummy = { cdr : null };
870 var tail = dummy;
871 var needsAssig = true;
872 while (l !== null) {
873 if (sc_isEqual(l.car, o)) {
874 needsAssig = true;
875 } else {
876 if (needsAssig) {
877 tail.cdr = l;
878 needsAssig = false;
880 tail = l;
882 l = l.cdr;
884 tail.cdr = null;
885 return dummy.cdr;
888 function sc_reverseAppendBang(l1, l2) {
889 var res = l2;
890 while (l1 !== null) {
891 var tmp = res;
892 res = l1;
893 l1 = l1.cdr;
894 res.cdr = tmp;
896 return res;
899 function sc_dualAppend(l1, l2) {
900 if (l1 === null) return l2;
901 if (l2 === null) return l1;
902 var rev = sc_reverse(l1);
903 return sc_reverseAppendBang(rev, l2);
906 /*** META ((export #t)) */
907 function sc_append() {
908 if (arguments.length === 0)
909 return null;
910 var res = arguments[arguments.length - 1];
911 for (var i = arguments.length - 2; i >= 0; i--)
912 res = sc_dualAppend(arguments[i], res);
913 return res;
916 function sc_dualAppendBang(l1, l2) {
917 if (l1 === null) return l2;
918 if (l2 === null) return l1;
919 var tmp = l1;
920 while (tmp.cdr !== null) tmp=tmp.cdr;
921 tmp.cdr = l2;
922 return l1;
925 /*** META ((export #t)) */
926 function sc_appendBang() {
927 var res = null;
928 for (var i = 0; i < arguments.length; i++)
929 res = sc_dualAppendBang(res, arguments[i]);
930 return res;
933 /*** META ((export #t)) */
934 function sc_reverse(l1) {
935 var res = null;
936 while (l1 !== null) {
937 res = sc_cons(l1.car, res);
938 l1 = l1.cdr;
940 return res;
943 /*** META ((export #t)) */
944 function sc_reverseBang(l) {
945 return sc_reverseAppendBang(l, null);
948 /*** META ((export #t)) */
949 function sc_listTail(l, k) {
950 var res = l;
951 for (var i = 0; i < k; i++) {
952 res = res.cdr;
954 return res;
957 /*** META ((export #t)) */
958 function sc_listRef(l, k) {
959 return sc_listTail(l, k).car;
962 /* // unoptimized generic versions
963 function sc_memX(o, l, comp) {
964 while (l != null) {
965 if (comp(l.car, o))
966 return l;
967 l = l.cdr;
969 return false;
971 function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); }
972 function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); }
973 function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); }
976 /* optimized versions */
977 /*** META ((export #t)) */
978 function sc_memq(o, l) {
979 while (l !== null) {
980 if (l.car === o)
981 return l;
982 l = l.cdr;
984 return false;
986 /*** META ((export #t)) */
987 function sc_memv(o, l) {
988 while (l !== null) {
989 if (l.car === o)
990 return l;
991 l = l.cdr;
993 return false;
995 /*** META ((export #t)) */
996 function sc_member(o, l) {
997 while (l !== null) {
998 if (sc_isEqual(l.car,o))
999 return l;
1000 l = l.cdr;
1002 return false;
1005 /* // generic unoptimized versions
1006 function sc_assX(o, al, comp) {
1007 while (al != null) {
1008 if (comp(al.car.car, o))
1009 return al.car;
1010 al = al.cdr;
1012 return false;
1014 function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); }
1015 function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); }
1016 function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); }
1018 // optimized versions
1019 /*** META ((export #t)) */
1020 function sc_assq(o, al) {
1021 while (al !== null) {
1022 if (al.car.car === o)
1023 return al.car;
1024 al = al.cdr;
1026 return false;
1028 /*** META ((export #t)) */
1029 function sc_assv(o, al) {
1030 while (al !== null) {
1031 if (al.car.car === o)
1032 return al.car;
1033 al = al.cdr;
1035 return false;
1037 /*** META ((export #t)) */
1038 function sc_assoc(o, al) {
1039 while (al !== null) {
1040 if (sc_isEqual(al.car.car, o))
1041 return al.car;
1042 al = al.cdr;
1044 return false;
1047 /* can be used for mutable strings and characters */
1048 function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; }
1049 function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; }
1050 function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; }
1051 function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; }
1052 function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; }
1053 function sc_isCharStringCIEqual(cs1, cs2)
1054 { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); }
1055 function sc_isCharStringCILess(cs1, cs2)
1056 { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); }
1057 function sc_isCharStringCIGreater(cs1, cs2)
1058 { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); }
1059 function sc_isCharStringCILessEqual(cs1, cs2)
1060 { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); }
1061 function sc_isCharStringCIGreaterEqual(cs1, cs2)
1062 { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); }
1067 function sc_Char(c) {
1068 var cached = sc_Char.lazy[c];
1069 if (cached)
1070 return cached;
1071 this.val = c;
1072 sc_Char.lazy[c] = this;
1073 // add return, so FF does not complain.
1074 return undefined;
1076 sc_Char.lazy = new Object();
1077 // thanks to Eric
1078 sc_Char.char2readable = {
1079 "\000": "#\\null",
1080 "\007": "#\\bell",
1081 "\010": "#\\backspace",
1082 "\011": "#\\tab",
1083 "\012": "#\\newline",
1084 "\014": "#\\page",
1085 "\015": "#\\return",
1086 "\033": "#\\escape",
1087 "\040": "#\\space",
1088 "\177": "#\\delete",
1090 /* poeticless names */
1091 "\001": "#\\soh",
1092 "\002": "#\\stx",
1093 "\003": "#\\etx",
1094 "\004": "#\\eot",
1095 "\005": "#\\enq",
1096 "\006": "#\\ack",
1098 "\013": "#\\vt",
1099 "\016": "#\\so",
1100 "\017": "#\\si",
1102 "\020": "#\\dle",
1103 "\021": "#\\dc1",
1104 "\022": "#\\dc2",
1105 "\023": "#\\dc3",
1106 "\024": "#\\dc4",
1107 "\025": "#\\nak",
1108 "\026": "#\\syn",
1109 "\027": "#\\etb",
1111 "\030": "#\\can",
1112 "\031": "#\\em",
1113 "\032": "#\\sub",
1114 "\033": "#\\esc",
1115 "\034": "#\\fs",
1116 "\035": "#\\gs",
1117 "\036": "#\\rs",
1118 "\037": "#\\us"};
1120 sc_Char.readable2char = {
1121 "null": "\000",
1122 "bell": "\007",
1123 "backspace": "\010",
1124 "tab": "\011",
1125 "newline": "\012",
1126 "page": "\014",
1127 "return": "\015",
1128 "escape": "\033",
1129 "space": "\040",
1130 "delete": "\000",
1131 "soh": "\001",
1132 "stx": "\002",
1133 "etx": "\003",
1134 "eot": "\004",
1135 "enq": "\005",
1136 "ack": "\006",
1137 "bel": "\007",
1138 "bs": "\010",
1139 "ht": "\011",
1140 "nl": "\012",
1141 "vt": "\013",
1142 "np": "\014",
1143 "cr": "\015",
1144 "so": "\016",
1145 "si": "\017",
1146 "dle": "\020",
1147 "dc1": "\021",
1148 "dc2": "\022",
1149 "dc3": "\023",
1150 "dc4": "\024",
1151 "nak": "\025",
1152 "syn": "\026",
1153 "etb": "\027",
1154 "can": "\030",
1155 "em": "\031",
1156 "sub": "\032",
1157 "esc": "\033",
1158 "fs": "\034",
1159 "gs": "\035",
1160 "rs": "\036",
1161 "us": "\037",
1162 "sp": "\040",
1163 "del": "\177"};
1165 sc_Char.prototype.toString = function() {
1166 return this.val;
1168 // sc_toDisplayString == toString
1169 sc_Char.prototype.sc_toWriteString = function() {
1170 var entry = sc_Char.char2readable[this.val];
1171 if (entry)
1172 return entry;
1173 else
1174 return "#\\" + this.val;
1177 /*** META ((export #t)
1178 (type bool)
1179 (peephole (postfix "instanceof sc_Char")))
1181 function sc_isChar(c) {
1182 return (c instanceof sc_Char);
1185 /*** META ((export char=?)
1186 (type bool)
1187 (peephole (hole 2 c1 ".val === " c2 ".val")))
1189 var sc_isCharEqual = sc_isCharStringEqual;
1190 /*** META ((export char<?)
1191 (type bool)
1192 (peephole (hole 2 c1 ".val < " c2 ".val")))
1194 var sc_isCharLess = sc_isCharStringLess;
1195 /*** META ((export char>?)
1196 (type bool)
1197 (peephole (hole 2 c1 ".val > " c2 ".val")))
1199 var sc_isCharGreater = sc_isCharStringGreater;
1200 /*** META ((export char<=?)
1201 (type bool)
1202 (peephole (hole 2 c1 ".val <= " c2 ".val")))
1204 var sc_isCharLessEqual = sc_isCharStringLessEqual;
1205 /*** META ((export char>=?)
1206 (type bool)
1207 (peephole (hole 2 c1 ".val >= " c2 ".val")))
1209 var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual;
1210 /*** META ((export char-ci=?)
1211 (type bool)
1212 (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()")))
1214 var sc_isCharCIEqual = sc_isCharStringCIEqual;
1215 /*** META ((export char-ci<?)
1216 (type bool)
1217 (peephole (hole 2 c1 ".val.toLowerCase() < " c2 ".val.toLowerCase()")))
1219 var sc_isCharCILess = sc_isCharStringCILess;
1220 /*** META ((export char-ci>?)
1221 (type bool)
1222 (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()")))
1224 var sc_isCharCIGreater = sc_isCharStringCIGreater;
1225 /*** META ((export char-ci<=?)
1226 (type bool)
1227 (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()")))
1229 var sc_isCharCILessEqual = sc_isCharStringCILessEqual;
1230 /*** META ((export char-ci>=?)
1231 (type bool)
1232 (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()")))
1234 var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual;
1236 var SC_NUMBER_CLASS = "0123456789";
1237 var SC_WHITESPACE_CLASS = ' \r\n\t\f';
1238 var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz';
1239 var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1241 function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); }
1242 /*** META ((export #t)
1243 (type bool))
1245 function sc_isCharAlphabetic(c)
1246 { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) ||
1247 sc_isCharOfClass(c.val, SC_UPPER_CLASS); }
1248 /*** META ((export #t)
1249 (type bool)
1250 (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1")))
1252 function sc_isCharNumeric(c)
1253 { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); }
1254 /*** META ((export #t)
1255 (type bool))
1257 function sc_isCharWhitespace(c) {
1258 var tmp = c.val;
1259 return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f";
1261 /*** META ((export #t)
1262 (type bool)
1263 (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1")))
1265 function sc_isCharUpperCase(c)
1266 { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); }
1267 /*** META ((export #t)
1268 (type bool)
1269 (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1")))
1271 function sc_isCharLowerCase(c)
1272 { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); }
1274 /*** META ((export #t)
1275 (peephole (postfix ".val.charCodeAt(0)")))
1277 function sc_char2integer(c)
1278 { return c.val.charCodeAt(0); }
1279 /*** META ((export #t)
1280 (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))")))
1282 function sc_integer2char(n)
1283 { return new sc_Char(String.fromCharCode(n)); }
1285 /*** META ((export #t)
1286 (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())")))
1288 function sc_charUpcase(c)
1289 { return new sc_Char(c.val.toUpperCase()); }
1290 /*** META ((export #t)
1291 (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())")))
1293 function sc_charDowncase(c)
1294 { return new sc_Char(c.val.toLowerCase()); }
1296 function sc_makeJSStringOfLength(k, c) {
1297 var fill;
1298 if (c === undefined)
1299 fill = " ";
1300 else
1301 fill = c;
1302 var res = "";
1303 var len = 1;
1304 // every round doubles the size of fill.
1305 while (k >= len) {
1306 if (k & len)
1307 res = res.concat(fill);
1308 fill = fill.concat(fill);
1309 len *= 2;
1311 return res;
1314 function sc_makejsString(k, c) {
1315 var fill;
1316 if (c)
1317 fill = c.val;
1318 else
1319 fill = " ";
1320 return sc_makeJSStringOfLength(k, fill);
1323 function sc_jsstring2list(s) {
1324 var res = null;
1325 for (var i = s.length - 1; i >= 0; i--)
1326 res = sc_cons(new sc_Char(s.charAt(i)), res);
1327 return res;
1330 function sc_list2jsstring(l) {
1331 var a = new Array();
1332 while(l !== null) {
1333 a.push(l.car.val);
1334 l = l.cdr;
1336 return "".concat.apply("", a);
1339 var sc_Vector = Array;
1341 sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {
1342 if (this.length === 0) return "#()";
1344 var res = "#(" + writeOrDisplay(this[0]);
1345 for (var i = 1; i < this.length; i++)
1346 res += " " + writeOrDisplay(this[i]);
1347 res += ")";
1348 return res;
1350 sc_Vector.prototype.sc_toDisplayString = function() {
1351 return this.sc_toWriteOrDisplayString(sc_toDisplayString);
1353 sc_Vector.prototype.sc_toWriteString = function() {
1354 return this.sc_toWriteOrDisplayString(sc_toWriteString);
1357 /*** META ((export vector? array?)
1358 (type bool)
1359 (peephole (postfix " instanceof sc_Vector")))
1361 function sc_isVector(v) {
1362 return (v instanceof sc_Vector);
1365 // only applies to vectors
1366 function sc_isVectorEqual(v1, v2, comp) {
1367 if (v1.length !== v2.length) return false;
1368 for (var i = 0; i < v1.length; i++)
1369 if (!comp(v1[i], v2[i])) return false;
1370 return true;
1373 /*** META ((export make-vector make-array)) */
1374 function sc_makeVector(size, fill) {
1375 var a = new sc_Vector(size);
1376 if (fill !== undefined)
1377 sc_vectorFillBang(a, fill);
1378 return a;
1381 /*** META ((export vector array)
1382 (peephole (vector)))
1384 function sc_vector() {
1385 var a = new sc_Vector();
1386 for (var i = 0; i < arguments.length; i++)
1387 a.push(arguments[i]);
1388 return a;
1391 /*** META ((export vector-length array-length)
1392 (peephole (postfix ".length")))
1394 function sc_vectorLength(v) {
1395 return v.length;
1398 /*** META ((export vector-ref array-ref)
1399 (peephole (hole 2 v "[" pos "]")))
1401 function sc_vectorRef(v, pos) {
1402 return v[pos];
1405 /*** META ((export vector-set! array-set!)
1406 (peephole (hole 3 v "[" pos "] = " val)))
1408 function sc_vectorSetBang(v, pos, val) {
1409 v[pos] = val;
1412 /*** META ((export vector->list array->list)) */
1413 function sc_vector2list(a) {
1414 var res = null;
1415 for (var i = a.length-1; i >= 0; i--)
1416 res = sc_cons(a[i], res);
1417 return res;
1420 /*** META ((export list->vector list->array)) */
1421 function sc_list2vector(l) {
1422 var a = new sc_Vector();
1423 while(l !== null) {
1424 a.push(l.car);
1425 l = l.cdr;
1427 return a;
1430 /*** META ((export vector-fill! array-fill!)) */
1431 function sc_vectorFillBang(a, fill) {
1432 for (var i = 0; i < a.length; i++)
1433 a[i] = fill;
1437 /*** META ((export #t)) */
1438 function sc_copyVector(a, len) {
1439 if (len <= a.length)
1440 return a.slice(0, len);
1441 else {
1442 var tmp = a.concat();
1443 tmp.length = len;
1444 return tmp;
1448 /*** META ((export #t)
1449 (peephole (hole 3 a ".slice(" start "," end ")")))
1451 function sc_vectorCopy(a, start, end) {
1452 return a.slice(start, end);
1455 /*** META ((export #t)) */
1456 function sc_vectorCopyBang(target, tstart, source, sstart, send) {
1457 if (!sstart) sstart = 0;
1458 if (!send) send = source.length;
1460 // if target == source we don't want to overwrite not yet copied elements.
1461 if (tstart <= sstart) {
1462 for (var i = tstart, j = sstart; j < send; i++, j++) {
1463 target[i] = source[j];
1465 } else {
1466 var diff = send - sstart;
1467 for (var i = tstart + diff - 1, j = send - 1;
1468 j >= sstart;
1469 i--, j--) {
1470 target[i] = source[j];
1473 return target;
1476 /*** META ((export #t)
1477 (type bool)
1478 (peephole (hole 1 "typeof " o " === 'function'")))
1480 function sc_isProcedure(o) {
1481 return (typeof o === "function");
1484 /*** META ((export #t)) */
1485 function sc_apply(proc) {
1486 var args = new Array();
1487 // first part of arguments are not in list-form.
1488 for (var i = 1; i < arguments.length - 1; i++)
1489 args.push(arguments[i]);
1490 var l = arguments[arguments.length - 1];
1491 while (l !== null) {
1492 args.push(l.car);
1493 l = l.cdr;
1495 return proc.apply(null, args);
1498 /*** META ((export #t)) */
1499 function sc_map(proc, l1) {
1500 if (l1 === undefined)
1501 return null;
1502 // else
1503 var nbApplyArgs = arguments.length - 1;
1504 var applyArgs = new Array(nbApplyArgs);
1505 var revres = null;
1506 while (l1 !== null) {
1507 for (var i = 0; i < nbApplyArgs; i++) {
1508 applyArgs[i] = arguments[i + 1].car;
1509 arguments[i + 1] = arguments[i + 1].cdr;
1511 revres = sc_cons(proc.apply(null, applyArgs), revres);
1513 return sc_reverseAppendBang(revres, null);
1516 /*** META ((export #t)) */
1517 function sc_mapBang(proc, l1) {
1518 if (l1 === undefined)
1519 return null;
1520 // else
1521 var l1_orig = l1;
1522 var nbApplyArgs = arguments.length - 1;
1523 var applyArgs = new Array(nbApplyArgs);
1524 while (l1 !== null) {
1525 var tmp = l1;
1526 for (var i = 0; i < nbApplyArgs; i++) {
1527 applyArgs[i] = arguments[i + 1].car;
1528 arguments[i + 1] = arguments[i + 1].cdr;
1530 tmp.car = proc.apply(null, applyArgs);
1532 return l1_orig;
1535 /*** META ((export #t)) */
1536 function sc_forEach(proc, l1) {
1537 if (l1 === undefined)
1538 return undefined;
1539 // else
1540 var nbApplyArgs = arguments.length - 1;
1541 var applyArgs = new Array(nbApplyArgs);
1542 while (l1 !== null) {
1543 for (var i = 0; i < nbApplyArgs; i++) {
1544 applyArgs[i] = arguments[i + 1].car;
1545 arguments[i + 1] = arguments[i + 1].cdr;
1547 proc.apply(null, applyArgs);
1549 // add return so FF does not complain.
1550 return undefined;
1553 /*** META ((export #t)) */
1554 function sc_filter(proc, l1) {
1555 var dummy = { cdr : null };
1556 var tail = dummy;
1557 while (l1 !== null) {
1558 if (proc(l1.car) !== false) {
1559 tail.cdr = sc_cons(l1.car, null);
1560 tail = tail.cdr;
1562 l1 = l1.cdr;
1564 return dummy.cdr;
1567 /*** META ((export #t)) */
1568 function sc_filterBang(proc, l1) {
1569 var head = sc_cons("dummy", l1);
1570 var it = head;
1571 var next = l1;
1572 while (next !== null) {
1573 if (proc(next.car) !== false) {
1574 it.cdr = next
1575 it = next;
1577 next = next.cdr;
1579 it.cdr = null;
1580 return head.cdr;
1583 function sc_filterMap1(proc, l1) {
1584 var revres = null;
1585 while (l1 !== null) {
1586 var tmp = proc(l1.car)
1587 if (tmp !== false) revres = sc_cons(tmp, revres);
1588 l1 = l1.cdr;
1590 return sc_reverseAppendBang(revres, null);
1592 function sc_filterMap2(proc, l1, l2) {
1593 var revres = null;
1594 while (l1 !== null) {
1595 var tmp = proc(l1.car, l2.car);
1596 if(tmp !== false) revres = sc_cons(tmp, revres);
1597 l1 = l1.cdr;
1598 l2 = l2.cdr
1600 return sc_reverseAppendBang(revres, null);
1603 /*** META ((export #t)) */
1604 function sc_filterMap(proc, l1, l2, l3) {
1605 if (l2 === undefined)
1606 return sc_filterMap1(proc, l1);
1607 else if (l3 === undefined)
1608 return sc_filterMap2(proc, l1, l2);
1609 // else
1610 var nbApplyArgs = arguments.length - 1;
1611 var applyArgs = new Array(nbApplyArgs);
1612 var revres = null;
1613 while (l1 !== null) {
1614 for (var i = 0; i < nbApplyArgs; i++) {
1615 applyArgs[i] = arguments[i + 1].car;
1616 arguments[i + 1] = arguments[i + 1].cdr;
1618 var tmp = proc.apply(null, applyArgs);
1619 if(tmp !== false) revres = sc_cons(tmp, revres);
1621 return sc_reverseAppendBang(revres, null);
1624 /*** META ((export #t)) */
1625 function sc_any(proc, l) {
1626 var revres = null;
1627 while (l !== null) {
1628 var tmp = proc(l.car);
1629 if(tmp !== false) return tmp;
1630 l = l.cdr;
1632 return false;
1635 /*** META ((export any?)
1636 (peephole (hole 2 "sc_any(" proc "," l ") !== false")))
1638 function sc_anyPred(proc, l) {
1639 return sc_any(proc, l)!== false;
1642 /*** META ((export #t)) */
1643 function sc_every(proc, l) {
1644 var revres = null;
1645 var tmp = true;
1646 while (l !== null) {
1647 tmp = proc(l.car);
1648 if (tmp === false) return false;
1649 l = l.cdr;
1651 return tmp;
1654 /*** META ((export every?)
1655 (peephole (hole 2 "sc_every(" proc "," l ") !== false")))
1657 function sc_everyPred(proc, l) {
1658 var tmp = sc_every(proc, l);
1659 if (tmp !== false) return true;
1660 return false;
1663 /*** META ((export #t)
1664 (peephole (postfix "()")))
1666 function sc_force(o) {
1667 return o();
1670 /*** META ((export #t)) */
1671 function sc_makePromise(proc) {
1672 var isResultReady = false;
1673 var result = undefined;
1674 return function() {
1675 if (!isResultReady) {
1676 var tmp = proc();
1677 if (!isResultReady) {
1678 isResultReady = true;
1679 result = tmp;
1682 return result;
1686 function sc_Values(values) {
1687 this.values = values;
1690 /*** META ((export #t)
1691 (peephole (values)))
1693 function sc_values() {
1694 if (arguments.length === 1)
1695 return arguments[0];
1696 else
1697 return new sc_Values(arguments);
1700 /*** META ((export #t)) */
1701 function sc_callWithValues(producer, consumer) {
1702 var produced = producer();
1703 if (produced instanceof sc_Values)
1704 return consumer.apply(null, produced.values);
1705 else
1706 return consumer(produced);
1709 /*** META ((export #t)) */
1710 function sc_dynamicWind(before, thunk, after) {
1711 before();
1712 try {
1713 var res = thunk();
1714 return res;
1715 } finally {
1716 after();
1721 // TODO: eval/scheme-report-environment/null-environment/interaction-environment
1723 // LIMITATION: 'load' doesn't exist without files.
1724 // LIMITATION: transcript-on/transcript-off doesn't exist without files.
1727 function sc_Struct(name) {
1728 this.name = name;
1730 sc_Struct.prototype.sc_toDisplayString = function() {
1731 return "#<struct" + sc_hash(this) + ">";
1733 sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString;
1735 /*** META ((export #t)
1736 (peephole (hole 1 "new sc_Struct(" name ")")))
1738 function sc_makeStruct(name) {
1739 return new sc_Struct(name);
1742 /*** META ((export #t)
1743 (type bool)
1744 (peephole (postfix " instanceof sc_Struct")))
1746 function sc_isStruct(o) {
1747 return (o instanceof sc_Struct);
1750 /*** META ((export #t)
1751 (type bool)
1752 (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")")))
1754 function sc_isStructNamed(name, s) {
1755 return ((s instanceof sc_Struct) && (s.name === name));
1758 /*** META ((export struct-field)
1759 (peephole (hole 3 0 "[" 2 "]")))
1761 function sc_getStructField(s, name, field) {
1762 return s[field];
1765 /*** META ((export struct-field-set!)
1766 (peephole (hole 4 0 "[" 2 "] = " 3)))
1768 function sc_setStructFieldBang(s, name, field, val) {
1769 s[field] = val;
1772 /*** META ((export #t)
1773 (peephole (prefix "~")))
1775 function sc_bitNot(x) {
1776 return ~x;
1779 /*** META ((export #t)
1780 (peephole (infix 2 2 "&")))
1782 function sc_bitAnd(x, y) {
1783 return x & y;
1786 /*** META ((export #t)
1787 (peephole (infix 2 2 "|")))
1789 function sc_bitOr(x, y) {
1790 return x | y;
1793 /*** META ((export #t)
1794 (peephole (infix 2 2 "^")))
1796 function sc_bitXor(x, y) {
1797 return x ^ y;
1800 /*** META ((export #t)
1801 (peephole (infix 2 2 "<<")))
1803 function sc_bitLsh(x, y) {
1804 return x << y;
1807 /*** META ((export #t)
1808 (peephole (infix 2 2 ">>")))
1810 function sc_bitRsh(x, y) {
1811 return x >> y;
1814 /*** META ((export #t)
1815 (peephole (infix 2 2 ">>>")))
1817 function sc_bitUrsh(x, y) {
1818 return x >>> y;
1821 /*** META ((export js-field js-property)
1822 (peephole (hole 2 o "[" field "]")))
1824 function sc_jsField(o, field) {
1825 return o[field];
1828 /*** META ((export js-field-set! js-property-set!)
1829 (peephole (hole 3 o "[" field "] = " val)))
1831 function sc_setJsFieldBang(o, field, val) {
1832 return o[field] = val;
1835 /*** META ((export js-field-delete! js-property-delete!)
1836 (peephole (hole 2 "delete" o "[" field "]")))
1838 function sc_deleteJsFieldBang(o, field) {
1839 delete o[field];
1842 /*** META ((export #t)
1843 (peephole (jsCall)))
1845 function sc_jsCall(o, fun) {
1846 var args = new Array();
1847 for (var i = 2; i < arguments.length; i++)
1848 args[i-2] = arguments[i];
1849 return fun.apply(o, args);
1852 /*** META ((export #t)
1853 (peephole (jsMethodCall)))
1855 function sc_jsMethodCall(o, field) {
1856 var args = new Array();
1857 for (var i = 2; i < arguments.length; i++)
1858 args[i-2] = arguments[i];
1859 return o[field].apply(o, args);
1862 /*** META ((export new js-new)
1863 (peephole (jsNew)))
1865 function sc_jsNew(c) {
1866 var evalStr = "new c(";
1867 evalStr +=arguments.length > 1? "arguments[1]": "";
1868 for (var i = 2; i < arguments.length; i++)
1869 evalStr += ", arguments[" + i + "]";
1870 evalStr +=")";
1871 return eval(evalStr);
1874 // ======================== RegExp ====================
1875 /*** META ((export #t)) */
1876 function sc_pregexp(re) {
1877 return new RegExp(sc_string2jsstring(re));
1880 /*** META ((export #t)) */
1881 function sc_pregexpMatch(re, s) {
1882 var reg = (re instanceof RegExp) ? re : sc_pregexp(re);
1883 var tmp = reg.exec(sc_string2jsstring(s));
1885 if (tmp == null) return false;
1887 var res = null;
1888 for (var i = tmp.length-1; i >= 0; i--) {
1889 if (tmp[i] !== null) {
1890 res = sc_cons(sc_jsstring2string(tmp[i]), res);
1891 } else {
1892 res = sc_cons(false, res);
1895 return res;
1898 /*** META ((export #t)) */
1899 function sc_pregexpReplace(re, s1, s2) {
1900 var reg;
1901 var jss1 = sc_string2jsstring(s1);
1902 var jss2 = sc_string2jsstring(s2);
1904 if (re instanceof RegExp) {
1905 if (re.global)
1906 reg = re;
1907 else
1908 reg = new RegExp(re.source);
1909 } else {
1910 reg = new RegExp(sc_string2jsstring(re));
1913 return jss1.replace(reg, jss2);
1916 /*** META ((export pregexp-replace*)) */
1917 function sc_pregexpReplaceAll(re, s1, s2) {
1918 var reg;
1919 var jss1 = sc_string2jsstring(s1);
1920 var jss2 = sc_string2jsstring(s2);
1922 if (re instanceof RegExp) {
1923 if (re.global)
1924 reg = re;
1925 else
1926 reg = new RegExp(re.source, "g");
1927 } else {
1928 reg = new RegExp(sc_string2jsstring(re), "g");
1931 return jss1.replace(reg, jss2);
1934 /*** META ((export #t)) */
1935 function sc_pregexpSplit(re, s) {
1936 var reg = ((re instanceof RegExp) ?
1937 re :
1938 new RegExp(sc_string2jsstring(re)));
1939 var jss = sc_string2jsstring(s);
1940 var tmp = jss.split(reg);
1942 if (tmp == null) return false;
1944 return sc_vector2list(tmp);
1948 /* =========================================================================== */
1949 /* Other library stuff */
1950 /* =========================================================================== */
1952 /*** META ((export #t)
1953 (peephole (hole 1 "Math.floor(Math.random()*" 'n ")")))
1955 function sc_random(n) {
1956 return Math.floor(Math.random()*n);
1959 /*** META ((export current-date)
1960 (peephole (hole 0 "new Date()")))
1962 function sc_currentDate() {
1963 return new Date();
1966 function sc_Hashtable() {
1968 sc_Hashtable.prototype.toString = function() {
1969 return "#{%hashtable}";
1971 // sc_toWriteString == sc_toDisplayString == toString
1973 function sc_HashtableElement(key, val) {
1974 this.key = key;
1975 this.val = val;
1978 /*** META ((export #t)
1979 (peephole (hole 0 "new sc_Hashtable()")))
1981 function sc_makeHashtable() {
1982 return new sc_Hashtable();
1985 /*** META ((export #t)) */
1986 function sc_hashtablePutBang(ht, key, val) {
1987 var hash = sc_hash(key);
1988 ht[hash] = new sc_HashtableElement(key, val);
1991 /*** META ((export #t)) */
1992 function sc_hashtableGet(ht, key) {
1993 var hash = sc_hash(key);
1994 if (hash in ht)
1995 return ht[hash].val;
1996 else
1997 return false;
2000 /*** META ((export #t)) */
2001 function sc_hashtableForEach(ht, f) {
2002 for (var v in ht) {
2003 if (ht[v] instanceof sc_HashtableElement)
2004 f(ht[v].key, ht[v].val);
2008 /*** META ((export hashtable-contains?)
2009 (peephole (hole 2 "sc_hash(" 1 ") in " 0)))
2011 function sc_hashtableContains(ht, key) {
2012 var hash = sc_hash(key);
2013 if (hash in ht)
2014 return true;
2015 else
2016 return false;
2019 var SC_HASH_COUNTER = 0;
2021 function sc_hash(o) {
2022 if (o === null)
2023 return "null";
2024 else if (o === undefined)
2025 return "undefined";
2026 else if (o === true)
2027 return "true";
2028 else if (o === false)
2029 return "false";
2030 else if (typeof o === "number")
2031 return "num-" + o;
2032 else if (typeof o === "string")
2033 return "jsstr-" + o;
2034 else if (o.sc_getHash)
2035 return o.sc_getHash();
2036 else
2037 return sc_counterHash.call(o);
2039 function sc_counterHash() {
2040 if (!this.sc_hash) {
2041 this.sc_hash = "hash-" + SC_HASH_COUNTER;
2042 SC_HASH_COUNTER++;
2044 return this.sc_hash;
2047 function sc_Trampoline(args, maxTailCalls) {
2048 this['__trampoline return__'] = true;
2049 this.args = args;
2050 this.MAX_TAIL_CALLs = maxTailCalls;
2052 // TODO: call/cc stuff
2053 sc_Trampoline.prototype.restart = function() {
2054 var o = this;
2055 while (true) {
2056 // set both globals.
2057 SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1;
2058 var fun = o.args.callee;
2059 var res = fun.apply(SC_TAIL_OBJECT, o.args);
2060 if (res instanceof sc_Trampoline)
2061 o = res;
2062 else
2063 return res;
2067 /*** META ((export bind-exit-lambda)) */
2068 function sc_bindExitLambda(proc) {
2069 var escape_obj = new sc_BindExitException();
2070 var escape = function(res) {
2071 escape_obj.res = res;
2072 throw escape_obj;
2074 try {
2075 return proc(escape);
2076 } catch(e) {
2077 if (e === escape_obj) {
2078 return e.res;
2080 throw e;
2083 function sc_BindExitException() {
2084 this._internalException = true;
2087 var SC_SCM2JS_GLOBALS = new Object();
2089 // default tail-call depth.
2090 // normally the program should set it again. but just in case...
2091 var SC_TAIL_OBJECT = new Object();
2092 SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT;
2093 // ======================== I/O =======================
2095 /*------------------------------------------------------------------*/
2097 function sc_EOF() {
2099 var SC_EOF_OBJECT = new sc_EOF();
2101 function sc_Port() {
2104 /* --------------- Input ports -------------------------------------*/
2106 function sc_InputPort() {
2108 sc_InputPort.prototype = new sc_Port();
2110 sc_InputPort.prototype.peekChar = function() {
2111 if (!("peeked" in this))
2112 this.peeked = this.getNextChar();
2113 return this.peeked;
2115 sc_InputPort.prototype.readChar = function() {
2116 var tmp = this.peekChar();
2117 delete this.peeked;
2118 return tmp;
2120 sc_InputPort.prototype.isCharReady = function() {
2121 return true;
2123 sc_InputPort.prototype.close = function() {
2124 // do nothing
2127 /* .............. String port ..........................*/
2128 function sc_ErrorInputPort() {
2130 sc_ErrorInputPort.prototype = new sc_InputPort();
2131 sc_ErrorInputPort.prototype.getNextChar = function() {
2132 throw "can't read from error-port.";
2134 sc_ErrorInputPort.prototype.isCharReady = function() {
2135 return false;
2139 /* .............. String port ..........................*/
2141 function sc_StringInputPort(jsStr) {
2142 // we are going to do some charAts on the str.
2143 // instead of recreating all the time a String-object, we
2144 // create one in the beginning. (not sure, if this is really an optim)
2145 this.str = new String(jsStr);
2146 this.pos = 0;
2148 sc_StringInputPort.prototype = new sc_InputPort();
2149 sc_StringInputPort.prototype.getNextChar = function() {
2150 if (this.pos >= this.str.length)
2151 return SC_EOF_OBJECT;
2152 return this.str.charAt(this.pos++);
2155 /* ------------- Read and other lib-funs -------------------------------*/
2156 function sc_Token(type, val, pos) {
2157 this.type = type;
2158 this.val = val;
2159 this.pos = pos;
2161 sc_Token.EOF = 0/*EOF*/;
2162 sc_Token.OPEN_PAR = 1/*OPEN_PAR*/;
2163 sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/;
2164 sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/;
2165 sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/;
2166 sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/;
2167 sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/;
2168 sc_Token.WHITESPACE = 7/*WHITESPACE*/;
2169 sc_Token.QUOTE = 8/*QUOTE*/;
2170 sc_Token.ID = 9/*ID*/;
2171 sc_Token.DOT = 10/*DOT*/;
2172 sc_Token.STRING = 11/*STRING*/;
2173 sc_Token.NUMBER = 12/*NUMBER*/;
2174 sc_Token.ERROR = 13/*ERROR*/;
2175 sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/;
2176 sc_Token.TRUE = 15/*TRUE*/;
2177 sc_Token.FALSE = 16/*FALSE*/;
2178 sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/;
2179 sc_Token.REFERENCE = 18/*REFERENCE*/;
2180 sc_Token.STORE = 19/*STORE*/;
2181 sc_Token.CHAR = 20/*CHAR*/;
2183 var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~";
2184 function sc_Tokenizer(port) {
2185 this.port = port;
2187 sc_Tokenizer.prototype.peekToken = function() {
2188 if (this.peeked)
2189 return this.peeked;
2190 var newToken = this.nextToken();
2191 this.peeked = newToken;
2192 return newToken;
2194 sc_Tokenizer.prototype.readToken = function() {
2195 var tmp = this.peekToken();
2196 delete this.peeked;
2197 return tmp;
2199 sc_Tokenizer.prototype.nextToken = function() {
2200 var port = this.port;
2202 function isNumberChar(c) {
2203 return (c >= "0" && c <= "9");
2205 function isIdOrNumberChar(c) {
2206 return SC_ID_CLASS.indexOf(c) != -1 || // ID-char
2207 (c >= "0" && c <= "9");
2209 function isWhitespace(c) {
2210 return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f";
2212 function isWhitespaceOrEOF(c) {
2213 return isWhitespace(c) || c === SC_EOF_OBJECT;
2216 function readString() {
2217 res = "";
2218 while (true) {
2219 var c = port.readChar();
2220 switch (c) {
2221 case '"':
2222 return new sc_Token(11/*STRING*/, res);
2223 case "\\":
2224 var tmp = port.readChar();
2225 switch (tmp) {
2226 case '0': res += "\0"; break;
2227 case 'a': res += "\a"; break;
2228 case 'b': res += "\b"; break;
2229 case 'f': res += "\f"; break;
2230 case 'n': res += "\n"; break;
2231 case 'r': res += "\r"; break;
2232 case 't': res += "\t"; break;
2233 case 'v': res += "\v"; break;
2234 case '"': res += '"'; break;
2235 case '\\': res += '\\'; break;
2236 case 'x':
2237 /* hexa-number */
2238 var nb = 0;
2239 while (true) {
2240 var hexC = port.peekChar();
2241 if (hexC >= '0' && hexC <= '9') {
2242 port.readChar();
2243 nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0);
2244 } else if (hexC >= 'a' && hexC <= 'f') {
2245 port.readChar();
2246 nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0);
2247 } else if (hexC >= 'A' && hexC <= 'F') {
2248 port.readChar();
2249 nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0);
2250 } else {
2251 // next char isn't part of hex.
2252 res += String.fromCharCode(nb);
2253 break;
2256 break;
2257 default:
2258 if (tmp === SC_EOF_OBJECT) {
2259 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res);
2261 res += tmp;
2263 break;
2264 default:
2265 if (c === SC_EOF_OBJECT) {
2266 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res);
2268 res += c;
2272 function readIdOrNumber(firstChar) {
2273 var res = firstChar;
2274 while (isIdOrNumberChar(port.peekChar()))
2275 res += port.readChar();
2276 if (isNaN(res))
2277 return new sc_Token(9/*ID*/, res);
2278 else
2279 return new sc_Token(12/*NUMBER*/, res - 0);
2282 function skipWhitespaceAndComments() {
2283 var done = false;
2284 while (!done) {
2285 done = true;
2286 while (isWhitespace(port.peekChar()))
2287 port.readChar();
2288 if (port.peekChar() === ';') {
2289 port.readChar();
2290 done = false;
2291 while (true) {
2292 curChar = port.readChar();
2293 if (curChar === SC_EOF_OBJECT ||
2294 curChar === '\n')
2295 break;
2301 function readDot() {
2302 if (isWhitespace(port.peekChar()))
2303 return new sc_Token(10/*DOT*/);
2304 else
2305 return readIdOrNumber(".");
2308 function readSharp() {
2309 var c = port.readChar();
2310 if (isWhitespace(c))
2311 return new sc_Token(13/*ERROR*/, "bad #-pattern0.");
2313 // reference
2314 if (isNumberChar(c)) {
2315 var nb = c - 0;
2316 while (isNumberChar(port.peekChar()))
2317 nb = nb*10 + (port.readChar() - 0);
2318 switch (port.readChar()) {
2319 case '#':
2320 return new sc_Token(18/*REFERENCE*/, nb);
2321 case '=':
2322 return new sc_Token(19/*STORE*/, nb);
2323 default:
2324 return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb);
2328 if (c === "(")
2329 return new sc_Token(14/*VECTOR_BEGIN*/);
2331 if (c === "\\") { // character
2332 var tmp = ""
2333 while (!isWhitespaceOrEOF(port.peekChar()))
2334 tmp += port.readChar();
2335 switch (tmp.length) {
2336 case 0: // it's escaping a whitespace char:
2337 if (sc_isEOFObject(port.peekChar))
2338 return new sc_Token(13/*ERROR*/, "bad #-pattern2.");
2339 else
2340 return new sc_Token(20/*CHAR*/, port.readChar());
2341 case 1:
2342 return new sc_Token(20/*CHAR*/, tmp);
2343 default:
2344 var entry = sc_Char.readable2char[tmp.toLowerCase()];
2345 if (entry)
2346 return new sc_Token(20/*CHAR*/, entry);
2347 else
2348 return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp);
2352 // some constants (#t, #f, #unspecified)
2353 var res;
2354 var needing;
2355 switch (c) {
2356 case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break;
2357 case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break;
2358 case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break;
2359 default:
2360 return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c);
2362 while(true) {
2363 c = port.peekChar();
2364 if ((isWhitespaceOrEOF(c) || c === ')') &&
2365 needing == "")
2366 return res;
2367 else if (isWhitespace(c) || needing == "")
2368 return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing);
2369 else if (needing.charAt(0) == c) {
2370 port.readChar(); // consume
2371 needing = needing.slice(1);
2372 } else
2373 return new sc_Token(13/*ERROR*/, "bad #-pattern5");
2378 skipWhitespaceAndComments();
2379 var curChar = port.readChar();
2380 if (curChar === SC_EOF_OBJECT)
2381 return new sc_Token(0/*EOF*/, curChar);
2382 switch (curChar)
2384 case " ":
2385 case "\n":
2386 case "\t":
2387 return readWhitespace();
2388 case "(":
2389 return new sc_Token(1/*OPEN_PAR*/);
2390 case ")":
2391 return new sc_Token(2/*CLOSE_PAR*/);
2392 case "{":
2393 return new sc_Token(3/*OPEN_BRACE*/);
2394 case "}":
2395 return new sc_Token(4/*CLOSE_BRACE*/);
2396 case "[":
2397 return new sc_Token(5/*OPEN_BRACKET*/);
2398 case "]":
2399 return new sc_Token(6/*CLOSE_BRACKET*/);
2400 case "'":
2401 return new sc_Token(8/*QUOTE*/);
2402 case "#":
2403 return readSharp();
2404 case ".":
2405 return readDot();
2406 case '"':
2407 return readString();
2408 default:
2409 if (isIdOrNumberChar(curChar))
2410 return readIdOrNumber(curChar);
2411 throw "unexpected character: " + curChar;
2415 function sc_Reader(tokenizer) {
2416 this.tokenizer = tokenizer;
2417 this.backref = new Array();
2419 sc_Reader.prototype.read = function() {
2420 function readList(listBeginType) {
2421 function matchesPeer(open, close) {
2422 return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/
2423 || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/
2424 || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/;
2426 var res = null;
2428 while (true) {
2429 var token = tokenizer.peekToken();
2431 switch (token.type) {
2432 case 2/*CLOSE_PAR*/:
2433 case 4/*CLOSE_BRACE*/:
2434 case 6/*CLOSE_BRACKET*/:
2435 if (matchesPeer(listBeginType, token.type)) {
2436 tokenizer.readToken(); // consume token
2437 return sc_reverseBang(res);
2438 } else
2439 throw "closing par doesn't match: " + listBeginType
2440 + " " + listEndType;
2442 case 0/*EOF*/:
2443 throw "unexpected end of file";
2445 case 10/*DOT*/:
2446 tokenizer.readToken(); // consume token
2447 var cdr = this.read();
2448 var par = tokenizer.readToken();
2449 if (!matchesPeer(listBeginType, par.type))
2450 throw "closing par doesn't match: " + listBeginType
2451 + " " + par.type;
2452 else
2453 return sc_reverseAppendBang(res, cdr);
2456 default:
2457 res = sc_cons(this.read(), res);
2461 function readQuote() {
2462 return sc_cons("quote", sc_cons(this.read(), null));
2464 function readVector() {
2465 // opening-parenthesis is already consumed
2466 var a = new Array();
2467 while (true) {
2468 var token = tokenizer.peekToken();
2469 switch (token.type) {
2470 case 2/*CLOSE_PAR*/:
2471 tokenizer.readToken();
2472 return a;
2474 default:
2475 a.push(this.read());
2480 function storeRefence(nb) {
2481 var tmp = this.read();
2482 this.backref[nb] = tmp;
2483 return tmp;
2486 function readReference(nb) {
2487 if (nb in this.backref)
2488 return this.backref[nb];
2489 else
2490 throw "bad reference: " + nb;
2493 var tokenizer = this.tokenizer;
2495 var token = tokenizer.readToken();
2497 // handle error
2498 if (token.type === 13/*ERROR*/)
2499 throw token.val;
2501 switch (token.type) {
2502 case 1/*OPEN_PAR*/:
2503 case 3/*OPEN_BRACE*/:
2504 case 5/*OPEN_BRACKET*/:
2505 return readList.call(this, token.type);
2506 case 8/*QUOTE*/:
2507 return readQuote.call(this);
2508 case 11/*STRING*/:
2509 return sc_jsstring2string(token.val);
2510 case 20/*CHAR*/:
2511 return new sc_Char(token.val);
2512 case 14/*VECTOR_BEGIN*/:
2513 return readVector.call(this);
2514 case 18/*REFERENCE*/:
2515 return readReference.call(this, token.val);
2516 case 19/*STORE*/:
2517 return storeRefence.call(this, token.val);
2518 case 9/*ID*/:
2519 return sc_jsstring2symbol(token.val);
2520 case 0/*EOF*/:
2521 case 12/*NUMBER*/:
2522 case 15/*TRUE*/:
2523 case 16/*FALSE*/:
2524 case 17/*UNSPECIFIED*/:
2525 return token.val;
2526 default:
2527 throw "unexpected token " + token.type + " " + token.val;
2531 /*** META ((export #t)) */
2532 function sc_read(port) {
2533 if (port === undefined) // we assume the port hasn't been given.
2534 port = SC_DEFAULT_IN; // THREAD: shared var...
2535 var reader = new sc_Reader(new sc_Tokenizer(port));
2536 return reader.read();
2538 /*** META ((export #t)) */
2539 function sc_readChar(port) {
2540 if (port === undefined) // we assume the port hasn't been given.
2541 port = SC_DEFAULT_IN; // THREAD: shared var...
2542 var t = port.readChar();
2543 return t === SC_EOF_OBJECT? t: new sc_Char(t);
2545 /*** META ((export #t)) */
2546 function sc_peekChar(port) {
2547 if (port === undefined) // we assume the port hasn't been given.
2548 port = SC_DEFAULT_IN; // THREAD: shared var...
2549 var t = port.peekChar();
2550 return t === SC_EOF_OBJECT? t: new sc_Char(t);
2552 /*** META ((export #t)
2553 (type bool))
2555 function sc_isCharReady(port) {
2556 if (port === undefined) // we assume the port hasn't been given.
2557 port = SC_DEFAULT_IN; // THREAD: shared var...
2558 return port.isCharReady();
2560 /*** META ((export #t)
2561 (peephole (postfix ".close()")))
2563 function sc_closeInputPort(p) {
2564 return p.close();
2567 /*** META ((export #t)
2568 (type bool)
2569 (peephole (postfix " instanceof sc_InputPort")))
2571 function sc_isInputPort(o) {
2572 return (o instanceof sc_InputPort);
2575 /*** META ((export eof-object?)
2576 (type bool)
2577 (peephole (postfix " === SC_EOF_OBJECT")))
2579 function sc_isEOFObject(o) {
2580 return o === SC_EOF_OBJECT;
2583 /*** META ((export #t)
2584 (peephole (hole 0 "SC_DEFAULT_IN")))
2586 function sc_currentInputPort() {
2587 return SC_DEFAULT_IN;
2590 /* ------------ file operations are not supported -----------*/
2591 /*** META ((export #t)) */
2592 function sc_callWithInputFile(s, proc) {
2593 throw "can't open " + s;
2596 /*** META ((export #t)) */
2597 function sc_callWithOutputFile(s, proc) {
2598 throw "can't open " + s;
2601 /*** META ((export #t)) */
2602 function sc_withInputFromFile(s, thunk) {
2603 throw "can't open " + s;
2606 /*** META ((export #t)) */
2607 function sc_withOutputToFile(s, thunk) {
2608 throw "can't open " + s;
2611 /*** META ((export #t)) */
2612 function sc_openInputFile(s) {
2613 throw "can't open " + s;
2616 /*** META ((export #t)) */
2617 function sc_openOutputFile(s) {
2618 throw "can't open " + s;
2621 /* ----------------------------------------------------------------------------*/
2622 /*** META ((export #t)) */
2623 function sc_basename(p) {
2624 var i = p.lastIndexOf('/');
2626 if(i >= 0)
2627 return p.substring(i + 1, p.length);
2628 else
2629 return '';
2632 /*** META ((export #t)) */
2633 function sc_dirname(p) {
2634 var i = p.lastIndexOf('/');
2636 if(i >= 0)
2637 return p.substring(0, i);
2638 else
2639 return '';
2642 /* ----------------------------------------------------------------------------*/
2644 /*** META ((export #t)) */
2645 function sc_withInputFromPort(p, thunk) {
2646 try {
2647 var tmp = SC_DEFAULT_IN; // THREAD: shared var.
2648 SC_DEFAULT_IN = p;
2649 return thunk();
2650 } finally {
2651 SC_DEFAULT_IN = tmp;
2655 /*** META ((export #t)) */
2656 function sc_withInputFromString(s, thunk) {
2657 return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk);
2660 /*** META ((export #t)) */
2661 function sc_withOutputToPort(p, thunk) {
2662 try {
2663 var tmp = SC_DEFAULT_OUT; // THREAD: shared var.
2664 SC_DEFAULT_OUT = p;
2665 return thunk();
2666 } finally {
2667 SC_DEFAULT_OUT = tmp;
2671 /*** META ((export #t)) */
2672 function sc_withOutputToString(thunk) {
2673 var p = new sc_StringOutputPort();
2674 sc_withOutputToPort(p, thunk);
2675 return p.close();
2678 /*** META ((export #t)) */
2679 function sc_withOutputToProcedure(proc, thunk) {
2680 var t = function(s) { proc(sc_jsstring2string(s)); };
2681 return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk);
2684 /*** META ((export #t)
2685 (peephole (hole 0 "new sc_StringOutputPort()")))
2687 function sc_openOutputString() {
2688 return new sc_StringOutputPort();
2691 /*** META ((export #t)) */
2692 function sc_openInputString(str) {
2693 return new sc_StringInputPort(sc_string2jsstring(str));
2696 /* ----------------------------------------------------------------------------*/
2698 function sc_OutputPort() {
2700 sc_OutputPort.prototype = new sc_Port();
2701 sc_OutputPort.prototype.appendJSString = function(obj) {
2702 /* do nothing */
2704 sc_OutputPort.prototype.close = function() {
2705 /* do nothing */
2708 function sc_StringOutputPort() {
2709 this.res = "";
2711 sc_StringOutputPort.prototype = new sc_OutputPort();
2712 sc_StringOutputPort.prototype.appendJSString = function(s) {
2713 this.res += s;
2715 sc_StringOutputPort.prototype.close = function() {
2716 return sc_jsstring2string(this.res);
2719 /*** META ((export #t)) */
2720 function sc_getOutputString(sp) {
2721 return sc_jsstring2string(sp.res);
2725 function sc_ErrorOutputPort() {
2727 sc_ErrorOutputPort.prototype = new sc_OutputPort();
2728 sc_ErrorOutputPort.prototype.appendJSString = function(s) {
2729 throw "don't write on ErrorPort!";
2731 sc_ErrorOutputPort.prototype.close = function() {
2732 /* do nothing */
2735 function sc_GenericOutputPort(appendJSString, close) {
2736 this.appendJSString = appendJSString;
2737 if (close)
2738 this.close = close;
2740 sc_GenericOutputPort.prototype = new sc_OutputPort();
2742 /*** META ((export #t)
2743 (type bool)
2744 (peephole (postfix " instanceof sc_OutputPort")))
2746 function sc_isOutputPort(o) {
2747 return (o instanceof sc_OutputPort);
2750 /*** META ((export #t)
2751 (peephole (postfix ".close()")))
2753 function sc_closeOutputPort(p) {
2754 return p.close();
2757 /* ------------------ write ---------------------------------------------------*/
2759 /*** META ((export #t)) */
2760 function sc_write(o, p) {
2761 if (p === undefined) // we assume not given
2762 p = SC_DEFAULT_OUT;
2763 p.appendJSString(sc_toWriteString(o));
2766 function sc_toWriteString(o) {
2767 if (o === null)
2768 return "()";
2769 else if (o === true)
2770 return "#t";
2771 else if (o === false)
2772 return "#f";
2773 else if (o === undefined)
2774 return "#unspecified";
2775 else if (typeof o === 'function')
2776 return "#<procedure " + sc_hash(o) + ">";
2777 else if (o.sc_toWriteString)
2778 return o.sc_toWriteString();
2779 else
2780 return o.toString();
2783 function sc_escapeWriteString(s) {
2784 var res = "";
2785 var j = 0;
2786 for (i = 0; i < s.length; i++) {
2787 switch (s.charAt(i)) {
2788 case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break;
2789 case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break;
2790 case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break;
2791 case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break;
2792 case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break;
2793 case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break;
2794 case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break;
2795 case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break;
2796 case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break;
2797 default:
2798 var c = s.charAt(i);
2799 if ("\a" !== "a" && c == "\a") {
2800 res += s.substring(j, i) + "\\a"; j = i + 1; continue;
2802 if ("\v" !== "v" && c == "\v") {
2803 res += s.substring(j, i) + "\\v"; j = i + 1; continue;
2805 //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) {
2806 // CARE: Manuel is this OK with HOP?
2807 if (s.charAt(i) < ' ') {
2808 /* non printable character and special chars */
2809 res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16);
2810 j = i + 1;
2812 // else just let i increase...
2815 res += s.substring(j, i);
2816 return res;
2819 /* ------------------ display ---------------------------------------------------*/
2821 /*** META ((export #t)) */
2822 function sc_display(o, p) {
2823 if (p === undefined) // we assume not given
2824 p = SC_DEFAULT_OUT;
2825 p.appendJSString(sc_toDisplayString(o));
2828 function sc_toDisplayString(o) {
2829 if (o === null)
2830 return "()";
2831 else if (o === true)
2832 return "#t";
2833 else if (o === false)
2834 return "#f";
2835 else if (o === undefined)
2836 return "#unspecified";
2837 else if (typeof o === 'function')
2838 return "#<procedure " + sc_hash(o) + ">";
2839 else if (o.sc_toDisplayString)
2840 return o.sc_toDisplayString();
2841 else
2842 return o.toString();
2845 /* ------------------ newline ---------------------------------------------------*/
2847 /*** META ((export #t)) */
2848 function sc_newline(p) {
2849 if (p === undefined) // we assume not given
2850 p = SC_DEFAULT_OUT;
2851 p.appendJSString("\n");
2854 /* ------------------ write-char ---------------------------------------------------*/
2856 /*** META ((export #t)) */
2857 function sc_writeChar(c, p) {
2858 if (p === undefined) // we assume not given
2859 p = SC_DEFAULT_OUT;
2860 p.appendJSString(c.val);
2863 /* ------------------ write-circle ---------------------------------------------------*/
2865 /*** META ((export #t)) */
2866 function sc_writeCircle(o, p) {
2867 if (p === undefined) // we assume not given
2868 p = SC_DEFAULT_OUT;
2869 p.appendJSString(sc_toWriteCircleString(o));
2872 function sc_toWriteCircleString(o) {
2873 var symb = sc_gensym("writeCircle");
2874 var nbPointer = new Object();
2875 nbPointer.nb = 0;
2876 sc_prepWriteCircle(o, symb, nbPointer);
2877 return sc_genToWriteCircleString(o, symb);
2880 function sc_prepWriteCircle(o, symb, nbPointer) {
2881 // TODO sc_Struct
2882 if (o instanceof sc_Pair ||
2883 o instanceof sc_Vector) {
2884 if (o[symb] !== undefined) {
2885 // not the first visit.
2886 o[symb]++;
2887 // unless there is already a number, assign one.
2888 if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++;
2889 return;
2891 o[symb] = 0;
2892 if (o instanceof sc_Pair) {
2893 sc_prepWriteCircle(o.car, symb, nbPointer);
2894 sc_prepWriteCircle(o.cdr, symb, nbPointer);
2895 } else {
2896 for (var i = 0; i < o.length; i++)
2897 sc_prepWriteCircle(o[i], symb, nbPointer);
2902 function sc_genToWriteCircleString(o, symb) {
2903 if (!(o instanceof sc_Pair ||
2904 o instanceof sc_Vector))
2905 return sc_toWriteString(o);
2906 return o.sc_toWriteCircleString(symb);
2908 sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) {
2909 if (this[symb + "use"]) { // use-flag is set. Just use it.
2910 var nb = this[symb + "nb"];
2911 if (this[symb]-- === 0) { // if we are the last use. remove all fields.
2912 delete this[symb];
2913 delete this[symb + "nb"];
2914 delete this[symb + "use"];
2916 if (inList)
2917 return '. #' + nb + '#';
2918 else
2919 return '#' + nb + '#';
2921 if (this[symb]-- === 0) { // if we are the last use. remove all fields.
2922 delete this[symb];
2923 delete this[symb + "nb"];
2924 delete this[symb + "use"];
2927 var res = "";
2929 if (this[symb] !== undefined) { // implies > 0
2930 this[symb + "use"] = true;
2931 if (inList)
2932 res += '. #' + this[symb + "nb"] + '=';
2933 else
2934 res += '#' + this[symb + "nb"] + '=';
2935 inList = false;
2938 if (!inList)
2939 res += "(";
2941 // print car
2942 res += sc_genToWriteCircleString(this.car, symb);
2944 if (sc_isPair(this.cdr)) {
2945 res += " " + this.cdr.sc_toWriteCircleString(symb, true);
2946 } else if (this.cdr !== null) {
2947 res += " . " + sc_genToWriteCircleString(this.cdr, symb);
2949 if (!inList)
2950 res += ")";
2951 return res;
2953 sc_Vector.prototype.sc_toWriteCircleString = function(symb) {
2954 if (this[symb + "use"]) { // use-flag is set. Just use it.
2955 var nb = this[symb + "nb"];
2956 if (this[symb]-- === 0) { // if we are the last use. remove all fields.
2957 delete this[symb];
2958 delete this[symb + "nb"];
2959 delete this[symb + "use"];
2961 return '#' + nb + '#';
2963 if (this[symb]-- === 0) { // if we are the last use. remove all fields.
2964 delete this[symb];
2965 delete this[symb + "nb"];
2966 delete this[symb + "use"];
2969 var res = "";
2970 if (this[symb] !== undefined) { // implies > 0
2971 this[symb + "use"] = true;
2972 res += '#' + this[symb + "nb"] + '=';
2974 res += "#(";
2975 for (var i = 0; i < this.length; i++) {
2976 res += sc_genToWriteCircleString(this[i], symb);
2977 if (i < this.length - 1) res += " ";
2979 res += ")";
2980 return res;
2984 /* ------------------ print ---------------------------------------------------*/
2986 /*** META ((export #t)) */
2987 function sc_print(s) {
2988 if (arguments.length === 1) {
2989 sc_display(s);
2990 sc_newline();
2992 else {
2993 for (var i = 0; i < arguments.length; i++)
2994 sc_display(arguments[i]);
2995 sc_newline();
2999 /* ------------------ format ---------------------------------------------------*/
3000 /*** META ((export #t)) */
3001 function sc_format(s, args) {
3002 var len = s.length;
3003 var p = new sc_StringOutputPort();
3004 var i = 0, j = 1;
3006 while( i < len ) {
3007 var i2 = s.indexOf("~", i);
3009 if (i2 == -1) {
3010 p.appendJSString( s.substring( i, len ) );
3011 return p.close();
3012 } else {
3013 if (i2 > i) {
3014 if (i2 == (len - 1)) {
3015 p.appendJSString(s.substring(i, len));
3016 return p.close();
3017 } else {
3018 p.appendJSString(s.substring(i, i2));
3019 i = i2;
3023 switch(s.charCodeAt(i2 + 1)) {
3024 case 65:
3025 case 97:
3026 // a
3027 sc_display(arguments[j], p);
3028 i += 2; j++;
3029 break;
3031 case 83:
3032 case 115:
3033 // s
3034 sc_write(arguments[j], p);
3035 i += 2; j++;
3036 break;
3038 case 86:
3039 case 118:
3040 // v
3041 sc_display(arguments[j], p);
3042 p.appendJSString("\n");
3043 i += 2; j++;
3044 break;
3046 case 67:
3047 case 99:
3048 // c
3049 p.appendJSString(String.fromCharCode(arguments[j]));
3050 i += 2; j++;
3051 break;
3053 case 88:
3054 case 120:
3055 // x
3056 p.appendJSString(arguments[j].toString(6));
3057 i += 2; j++;
3058 break;
3060 case 79:
3061 case 111:
3062 // o
3063 p.appendJSString(arguments[j].toString(8));
3064 i += 2; j++;
3065 break;
3067 case 66:
3068 case 98:
3069 // b
3070 p.appendJSString(arguments[j].toString(2));
3071 i += 2; j++;
3072 break;
3074 case 37:
3075 case 110:
3076 // %, n
3077 p.appendJSString("\n");
3078 i += 2; break;
3080 case 114:
3081 // r
3082 p.appendJSString("\r");
3083 i += 2; break;
3085 case 126:
3086 // ~
3087 p.appendJSString("~");
3088 i += 2; break;
3090 default:
3091 sc_error( "format: illegal ~"
3092 + String.fromCharCode(s.charCodeAt(i2 + 1))
3093 + " sequence" );
3094 return "";
3099 return p.close();
3102 /* ------------------ global ports ---------------------------------------------------*/
3104 var SC_DEFAULT_IN = new sc_ErrorInputPort();
3105 var SC_DEFAULT_OUT = new sc_ErrorOutputPort();
3106 var SC_ERROR_OUT = new sc_ErrorOutputPort();
3108 var sc_SYMBOL_PREFIX = "\u1E9C";
3109 var sc_KEYWORD_PREFIX = "\u1E9D";
3111 /*** META ((export #t)
3112 (peephole (id))) */
3113 function sc_jsstring2string(s) {
3114 return s;
3117 /*** META ((export #t)
3118 (peephole (prefix "'\\u1E9C' +")))
3120 function sc_jsstring2symbol(s) {
3121 return sc_SYMBOL_PREFIX + s;
3124 /*** META ((export #t)
3125 (peephole (id)))
3127 function sc_string2jsstring(s) {
3128 return s;
3131 /*** META ((export #t)
3132 (peephole (symbol2jsstring_immutable)))
3134 function sc_symbol2jsstring(s) {
3135 return s.slice(1);
3138 /*** META ((export #t)
3139 (peephole (postfix ".slice(1)")))
3141 function sc_keyword2jsstring(k) {
3142 return k.slice(1);
3145 /*** META ((export #t)
3146 (peephole (prefix "'\\u1E9D' +")))
3148 function sc_jsstring2keyword(s) {
3149 return sc_KEYWORD_PREFIX + s;
3152 /*** META ((export #t)
3153 (type bool))
3155 function sc_isKeyword(s) {
3156 return (typeof s === "string") &&
3157 (s.charAt(0) === sc_KEYWORD_PREFIX);
3161 /*** META ((export #t)) */
3162 var sc_gensym = function() {
3163 var counter = 1000;
3164 return function(sym) {
3165 counter++;
3166 if (!sym) sym = sc_SYMBOL_PREFIX;
3167 return sym + "s" + counter + "~" + "^sC-GeNsYm ";
3169 }();
3172 /*** META ((export #t)
3173 (type bool))
3175 function sc_isEqual(o1, o2) {
3176 return ((o1 === o2) ||
3177 (sc_isPair(o1) && sc_isPair(o2)
3178 && sc_isPairEqual(o1, o2, sc_isEqual)) ||
3179 (sc_isVector(o1) && sc_isVector(o2)
3180 && sc_isVectorEqual(o1, o2, sc_isEqual)));
3183 /*** META ((export number->symbol integer->symbol)) */
3184 function sc_number2symbol(x, radix) {
3185 return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix);
3188 /*** META ((export number->string integer->string)) */
3189 var sc_number2string = sc_number2jsstring;
3191 /*** META ((export #t)) */
3192 function sc_symbol2number(s, radix) {
3193 return sc_jsstring2number(s.slice(1), radix);
3196 /*** META ((export #t)) */
3197 var sc_string2number = sc_jsstring2number;
3199 /*** META ((export #t)
3200 (peephole (prefix "+" s)))
3201 ;; peephole will only apply if no radix is given.
3203 function sc_string2integer(s, radix) {
3204 if (!radix) return +s;
3205 return parseInt(s, radix);
3208 /*** META ((export #t)
3209 (peephole (prefix "+")))
3211 function sc_string2real(s) {
3212 return +s;
3216 /*** META ((export #t)
3217 (type bool))
3219 function sc_isSymbol(s) {
3220 return (typeof s === "string") &&
3221 (s.charAt(0) === sc_SYMBOL_PREFIX);
3224 /*** META ((export #t)
3225 (peephole (symbol2string_immutable)))
3227 function sc_symbol2string(s) {
3228 return s.slice(1);
3231 /*** META ((export #t)
3232 (peephole (prefix "'\\u1E9C' +")))
3234 function sc_string2symbol(s) {
3235 return sc_SYMBOL_PREFIX + s;
3238 /*** META ((export symbol-append)
3239 (peephole (symbolAppend_immutable)))
3241 function sc_symbolAppend() {
3242 var res = sc_SYMBOL_PREFIX;
3243 for (var i = 0; i < arguments.length; i++)
3244 res += arguments[i].slice(1);
3245 return res;
3248 /*** META ((export #t)
3249 (peephole (postfix ".val")))
3251 function sc_char2string(c) { return c.val; }
3253 /*** META ((export #t)
3254 (peephole (hole 1 "'\\u1E9C' + " c ".val")))
3256 function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; }
3258 /*** META ((export #t)
3259 (type bool))
3261 function sc_isString(s) {
3262 return (typeof s === "string") &&
3263 (s.charAt(0) !== sc_SYMBOL_PREFIX);
3266 /*** META ((export #t)) */
3267 var sc_makeString = sc_makejsString;
3270 /*** META ((export #t)) */
3271 function sc_string() {
3272 for (var i = 0; i < arguments.length; i++)
3273 arguments[i] = arguments[i].val;
3274 return "".concat.apply("", arguments);
3277 /*** META ((export #t)
3278 (peephole (postfix ".length")))
3280 function sc_stringLength(s) { return s.length; }
3282 /*** META ((export #t)) */
3283 function sc_stringRef(s, k) {
3284 return new sc_Char(s.charAt(k));
3287 /* there's no stringSet in the immutable version
3288 function sc_stringSet(s, k, c)
3292 /*** META ((export string=?)
3293 (type bool)
3294 (peephole (hole 2 str1 " === " str2)))
3296 function sc_isStringEqual(s1, s2) {
3297 return s1 === s2;
3299 /*** META ((export string<?)
3300 (type bool)
3301 (peephole (hole 2 str1 " < " str2)))
3303 function sc_isStringLess(s1, s2) {
3304 return s1 < s2;
3306 /*** META ((export string>?)
3307 (type bool)
3308 (peephole (hole 2 str1 " > " str2)))
3310 function sc_isStringGreater(s1, s2) {
3311 return s1 > s2;
3313 /*** META ((export string<=?)
3314 (type bool)
3315 (peephole (hole 2 str1 " <= " str2)))
3317 function sc_isStringLessEqual(s1, s2) {
3318 return s1 <= s2;
3320 /*** META ((export string>=?)
3321 (type bool)
3322 (peephole (hole 2 str1 " >= " str2)))
3324 function sc_isStringGreaterEqual(s1, s2) {
3325 return s1 >= s2;
3327 /*** META ((export string-ci=?)
3328 (type bool)
3329 (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()")))
3331 function sc_isStringCIEqual(s1, s2) {
3332 return s1.toLowerCase() === s2.toLowerCase();
3334 /*** META ((export string-ci<?)
3335 (type bool)
3336 (peephole (hole 2 str1 ".toLowerCase() < " str2 ".toLowerCase()")))
3338 function sc_isStringCILess(s1, s2) {
3339 return s1.toLowerCase() < s2.toLowerCase();
3341 /*** META ((export string-ci>?)
3342 (type bool)
3343 (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()")))
3345 function sc_isStringCIGreater(s1, s2) {
3346 return s1.toLowerCase() > s2.toLowerCase();
3348 /*** META ((export string-ci<=?)
3349 (type bool)
3350 (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()")))
3352 function sc_isStringCILessEqual(s1, s2) {
3353 return s1.toLowerCase() <= s2.toLowerCase();
3355 /*** META ((export string-ci>=?)
3356 (type bool)
3357 (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()")))
3359 function sc_isStringCIGreaterEqual(s1, s2) {
3360 return s1.toLowerCase() >= s2.toLowerCase();
3363 /*** META ((export #t)
3364 (peephole (hole 3 s ".substring(" start ", " end ")")))
3366 function sc_substring(s, start, end) {
3367 return s.substring(start, end);
3370 /*** META ((export #t))
3372 function sc_isSubstring_at(s1, s2, i) {
3373 return s2 == s1.substring(i, i+ s2.length);
3376 /*** META ((export #t)
3377 (peephole (infix 0 #f "+" "''")))
3379 function sc_stringAppend() {
3380 return "".concat.apply("", arguments);
3383 /*** META ((export #t)) */
3384 var sc_string2list = sc_jsstring2list;
3386 /*** META ((export #t)) */
3387 var sc_list2string = sc_list2jsstring;
3389 /*** META ((export #t)
3390 (peephole (id)))
3392 function sc_stringCopy(s) {
3393 return s;
3396 /* there's no string-fill in the immutable version
3397 function sc_stringFill(s, c)
3400 /*** META ((export #t)
3401 (peephole (postfix ".slice(1)")))
3403 function sc_keyword2string(o) {
3404 return o.slice(1);
3407 /*** META ((export #t)
3408 (peephole (prefix "'\\u1E9D' +")))
3410 function sc_string2keyword(o) {
3411 return sc_KEYWORD_PREFIX + o;
3414 String.prototype.sc_toDisplayString = function() {
3415 if (this.charAt(0) === sc_SYMBOL_PREFIX)
3416 // TODO: care for symbols with spaces (escape-chars symbols).
3417 return this.slice(1);
3418 else if (this.charAt(0) === sc_KEYWORD_PREFIX)
3419 return ":" + this.slice(1);
3420 else
3421 return this.toString();
3424 String.prototype.sc_toWriteString = function() {
3425 if (this.charAt(0) === sc_SYMBOL_PREFIX)
3426 // TODO: care for symbols with spaces (escape-chars symbols).
3427 return this.slice(1);
3428 else if (this.charAt(0) === sc_KEYWORD_PREFIX)
3429 return ":" + this.slice(1);
3430 else
3431 return '"' + sc_escapeWriteString(this) + '"';
3433 /* Exported Variables */
3434 var BgL_testzd2boyerzd2;
3435 var BgL_nboyerzd2benchmarkzd2;
3436 var BgL_setupzd2boyerzd2;
3437 /* End Exports */
3439 var translate_term_nboyer;
3440 var translate_args_nboyer;
3441 var untranslate_term_nboyer;
3442 var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer;
3443 var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer;
3444 var translate_alist_nboyer;
3445 var apply_subst_nboyer;
3446 var apply_subst_lst_nboyer;
3447 var tautologyp_nboyer;
3448 var if_constructor_nboyer;
3449 var rewrite_count_nboyer;
3450 var rewrite_nboyer;
3451 var rewrite_args_nboyer;
3452 var unify_subst_nboyer;
3453 var one_way_unify1_nboyer;
3454 var false_term_nboyer;
3455 var true_term_nboyer;
3456 var trans_of_implies1_nboyer;
3457 var is_term_equal_nboyer;
3458 var is_term_member_nboyer;
3459 var const_nboyer;
3460 var sc_const_3_nboyer;
3461 var sc_const_4_nboyer;
3463 (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null)))))));
3464 (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null))))))));
3465 (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null)))))))))));
3466 BgL_nboyerzd2benchmarkzd2 = function() {
3467 var args = null;
3468 for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) {
3469 args = sc_cons(arguments[sc_tmp], args);
3471 var n;
3472 return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() {
3473 return (BgL_testzd2boyerzd2(n));
3474 }, function(rewrites) {
3475 if ((sc_isNumber(rewrites)))
3476 switch (n) {
3477 case (0):
3478 return (rewrites===(95024));
3479 break;
3480 case (1):
3481 return (rewrites===(591777));
3482 break;
3483 case (2):
3484 return (rewrites===(1813975));
3485 break;
3486 case (3):
3487 return (rewrites===(5375678));
3488 break;
3489 case (4):
3490 return (rewrites===(16445406));
3491 break;
3492 case (5):
3493 return (rewrites===(51507739));
3494 break;
3495 default:
3496 return true;
3497 break;
3499 else
3500 return false;
3501 })));
3503 BgL_setupzd2boyerzd2 = function() {
3504 return true;
3506 BgL_testzd2boyerzd2 = function() {
3507 return true;
3509 translate_term_nboyer = function(term) {
3510 var lst;
3511 return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr))))))))));
3513 translate_args_nboyer = function(lst) {
3514 var sc_lst_5;
3515 var term;
3516 return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr))))))))));
3518 untranslate_term_nboyer = function(term) {
3519 var optrOpnd;
3520 var tail1131;
3521 var L1127;
3522 var falseHead1130;
3523 var symbol_record;
3524 if (!(term instanceof sc_Pair))
3525 return term;
3526 else
3528 (falseHead1130 = (new sc_Pair(null, null)));
3529 (L1127 = (term.cdr));
3530 (tail1131 = falseHead1130);
3531 while (!(L1127 === null)) {
3533 (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null)));
3534 (tail1131 = (tail1131.cdr));
3535 (L1127 = (L1127.cdr));
3538 (optrOpnd = (falseHead1130.cdr));
3539 return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd));
3542 BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) {
3543 var r;
3544 var x;
3545 return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r)));
3547 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null);
3548 translate_alist_nboyer = function(alist) {
3549 var sc_alist_6;
3550 var term;
3551 return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr))))))))));
3553 apply_subst_nboyer = function(alist, term) {
3554 var lst;
3555 var temp_temp;
3556 return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr))))))))));
3558 apply_subst_lst_nboyer = function(alist, lst) {
3559 var sc_lst_7;
3560 return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr))))))))));
3562 tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) {
3563 var tmp1125;
3564 var x;
3565 var tmp1126;
3566 var sc_x_8;
3567 var sc_tmp1125_9;
3568 var sc_tmp1126_10;
3569 var sc_x_11;
3570 var true_lst;
3571 var false_lst;
3572 while (true) {
3573 if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false))
3574 return true;
3575 else
3576 if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false))
3577 return false;
3578 else
3579 if (!(sc_x_11 instanceof sc_Pair))
3580 return false;
3581 else
3582 if (((sc_x_11.car)===if_constructor_nboyer))
3583 if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false))
3584 (sc_x_11 = (sc_x_11.cdr.cdr.car));
3585 else
3586 if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false))
3587 (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car));
3588 else
3589 if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false))
3591 (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst)));
3592 (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car));
3594 else
3595 return false;
3596 else
3597 return false;
3600 (if_constructor_nboyer = "\u1E9C*");
3601 (rewrite_count_nboyer = (0));
3602 rewrite_nboyer = function(term) {
3603 var term2;
3604 var sc_term_12;
3605 var lst;
3606 var symbol_record;
3607 var sc_lst_13;
3609 (++rewrite_count_nboyer);
3610 if (!(term instanceof sc_Pair))
3611 return term;
3612 else
3614 (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr))))))))));
3615 (lst = ((symbol_record = (term.car)), (symbol_record[(1)])));
3616 while (true) {
3617 if ((lst === null))
3618 return sc_term_12;
3619 else
3620 if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false))
3621 return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car)))));
3622 else
3623 (lst = (lst.cdr));
3628 rewrite_args_nboyer = function(lst) {
3629 var sc_lst_14;
3630 return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr))))))))));
3632 (unify_subst_nboyer = "\u1E9C*");
3633 one_way_unify1_nboyer = function(term1, term2) {
3634 var lst1;
3635 var lst2;
3636 var temp_temp;
3637 if (!(term2 instanceof sc_Pair))
3639 (temp_temp = (sc_assq(term2, unify_subst_nboyer)));
3640 if ((temp_temp!== false))
3641 return (is_term_equal_nboyer(term1, (temp_temp.cdr)));
3642 else
3643 if ((sc_isNumber(term2)))
3644 return (sc_isEqual(term1, term2));
3645 else
3647 (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer)));
3648 return true;
3651 else
3652 if (!(term1 instanceof sc_Pair))
3653 return false;
3654 else
3655 if (((term1.car)===(term2.car)))
3657 (lst1 = (term1.cdr));
3658 (lst2 = (term2.cdr));
3659 while (true) {
3660 if ((lst1 === null))
3661 return (lst2 === null);
3662 else
3663 if ((lst2 === null))
3664 return false;
3665 else
3666 if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false))
3668 (lst1 = (lst1.cdr));
3669 (lst2 = (lst2.cdr));
3671 else
3672 return false;
3675 else
3676 return false;
3678 (false_term_nboyer = "\u1E9C*");
3679 (true_term_nboyer = "\u1E9C*");
3680 trans_of_implies1_nboyer = function(n) {
3681 var sc_n_15;
3682 return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1)))))))))));
3684 is_term_equal_nboyer = function(x, y) {
3685 var lst1;
3686 var lst2;
3687 var r2;
3688 var r1;
3689 if ((x instanceof sc_Pair))
3690 if ((y instanceof sc_Pair))
3691 if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false))
3693 (lst1 = (x.cdr));
3694 (lst2 = (y.cdr));
3695 while (true) {
3696 if ((lst1 === null))
3697 return (lst2 === null);
3698 else
3699 if ((lst2 === null))
3700 return false;
3701 else
3702 if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false))
3704 (lst1 = (lst1.cdr));
3705 (lst2 = (lst2.cdr));
3707 else
3708 return false;
3711 else
3712 return false;
3713 else
3714 return false;
3715 else
3716 return (sc_isEqual(x, y));
3718 is_term_member_nboyer = function(x, lst) {
3719 var x;
3720 var lst;
3721 while (true) {
3722 if ((lst === null))
3723 return false;
3724 else
3725 if (((is_term_equal_nboyer(x, (lst.car)))!== false))
3726 return true;
3727 else
3728 (lst = (lst.cdr));
3731 BgL_setupzd2boyerzd2 = function() {
3732 var symbol_record;
3733 var value;
3734 var BgL_sc_symbolzd2record_16zd2;
3735 var sym;
3736 var sc_sym_17;
3737 var term;
3738 var lst;
3739 var sc_term_18;
3740 var sc_term_19;
3742 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null);
3743 (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif")));
3744 (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr))))))));
3745 (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr))))))));
3746 (lst = sc_const_3_nboyer);
3747 while (!(lst === null)) {
3749 (term = (lst.car));
3750 if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair))))
3752 (sc_sym_17 = ((term.cdr.car).car));
3753 (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)])))));
3754 (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17)));
3755 (symbol_record[(1)] = value);
3757 else
3758 (sc_error("ADD-LEMMA did not like term: ", term));
3759 (lst = (lst.cdr));
3762 return true;
3765 BgL_testzd2boyerzd2 = function(n) {
3766 var optrOpnd;
3767 var term;
3768 var sc_n_20;
3769 var answer;
3770 var sc_term_21;
3771 var sc_term_22;
3773 (rewrite_count_nboyer = (0));
3774 (term = sc_const_4_nboyer);
3775 (sc_n_20 = n);
3776 while (!(sc_n_20=== 0)) {
3778 (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null)))));
3779 (--sc_n_20);
3782 (sc_term_22 = term);
3783 if (!(sc_term_22 instanceof sc_Pair))
3784 (optrOpnd = sc_term_22);
3785 else
3786 (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr))))));
3787 (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd)));
3788 (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null)));
3789 (sc_write(rewrite_count_nboyer));
3790 (sc_display(" rewrites"));
3791 (sc_newline());
3792 if ((answer!== false))
3793 return rewrite_count_nboyer;
3794 else
3795 return false;
3799 /* Exported Variables */
3800 var BgL_parsezd2ze3nbzd2treesze3;
3801 var BgL_earleyzd2benchmarkzd2;
3802 var BgL_parsezd2ze3parsedzf3zc2;
3803 var test2;
3804 var BgL_parsezd2ze3treesz31;
3805 var BgL_makezd2parserzd2;
3806 /* End Exports */
3808 var const_earley;
3810 (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null)));
3811 BgL_makezd2parserzd2 = function(grammar, lexer) {
3812 var i;
3813 var parser_descr;
3814 var def_loop;
3815 var nb_nts;
3816 var names;
3817 var steps;
3818 var predictors;
3819 var enders;
3820 var starters;
3821 var nts;
3822 var sc_names_1;
3823 var sc_steps_2;
3824 var sc_predictors_3;
3825 var sc_enders_4;
3826 var sc_starters_5;
3827 var nb_confs;
3828 var BgL_sc_defzd2loop_6zd2;
3829 var BgL_sc_nbzd2nts_7zd2;
3830 var sc_nts_8;
3831 var BgL_sc_defzd2loop_9zd2;
3832 var ind;
3834 ind = function(nt, sc_nts_10) {
3835 var i;
3837 (i = ((sc_nts_10.length)-(1)));
3838 while (true) {
3839 if ((i>=(0)))
3840 if ((sc_isEqual((sc_nts_10[i]), nt)))
3841 return i;
3842 else
3843 (--i);
3844 else
3845 return false;
3849 (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) {
3850 var rule_loop;
3851 var head;
3852 var def;
3853 return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) {
3854 var nt;
3855 var l;
3856 var sc_nts_13;
3857 var rule;
3858 if ((rules instanceof sc_Pair))
3860 (rule = (rules.car));
3861 (l = rule);
3862 (sc_nts_13 = sc_nts_12);
3863 while ((l instanceof sc_Pair)) {
3865 (nt = (l.car));
3866 (l = (l.cdr));
3867 (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13))));
3870 return (rule_loop((rules.cdr), sc_nts_13));
3872 else
3873 return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12));
3874 }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11)))));
3875 }), (BgL_sc_defzd2loop_9zd2(grammar, null))));
3876 (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length));
3877 (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) {
3878 var rule_loop;
3879 var def;
3880 return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) {
3881 var l;
3882 var BgL_sc_nbzd2confs_16zd2;
3883 var rule;
3884 if ((rules instanceof sc_Pair))
3886 (rule = (rules.car));
3887 (l = rule);
3888 (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2);
3889 while ((l instanceof sc_Pair)) {
3891 (l = (l.cdr));
3892 (++BgL_sc_nbzd2confs_16zd2);
3895 return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1))));
3897 else
3898 return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2));
3899 }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2);
3900 }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2));
3901 (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));
3902 (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));
3903 (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));
3904 (sc_steps_2 = (sc_makeVector(nb_confs, false)));
3905 (sc_names_1 = (sc_makeVector(nb_confs, false)));
3906 (nts = sc_nts_8);
3907 (starters = sc_starters_5);
3908 (enders = sc_enders_4);
3909 (predictors = sc_predictors_3);
3910 (steps = sc_steps_2);
3911 (names = sc_names_1);
3912 (nb_nts = (sc_nts_8.length));
3913 (i = (nb_nts-(1)));
3914 while ((i>=(0))) {
3916 (sc_steps_2[i] = (i-nb_nts));
3917 (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0))));
3918 (sc_enders_4[i] = (sc_list(i)));
3919 (--i);
3922 def_loop = function(defs, conf) {
3923 var rule_loop;
3924 var head;
3925 var def;
3926 return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) {
3927 var i;
3928 var sc_i_17;
3929 var nt;
3930 var l;
3931 var sc_conf_18;
3932 var sc_i_19;
3933 var rule;
3934 if ((rules instanceof sc_Pair))
3936 (rule = (rules.car));
3937 (names[conf] = (sc_list(head, rule_num)));
3938 (sc_i_19 = (ind(head, nts)));
3939 (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19]))));
3940 (l = rule);
3941 (sc_conf_18 = conf);
3942 while ((l instanceof sc_Pair)) {
3944 (nt = (l.car));
3945 (steps[sc_conf_18] = (ind(nt, nts)));
3946 (sc_i_17 = (ind(nt, nts)));
3947 (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17]))));
3948 (l = (l.cdr));
3949 (++sc_conf_18);
3952 (steps[sc_conf_18] = ((ind(head, nts))-nb_nts));
3953 (i = (ind(head, nts)));
3954 (enders[i] = (new sc_Pair(sc_conf_18, (enders[i]))));
3955 return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1))));
3957 else
3958 return (def_loop((defs.cdr), conf));
3959 }), (rule_loop((def.cdr), conf, (1)))):undefined);
3961 (def_loop(grammar, (sc_nts_8.length)));
3962 (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]);
3963 return function(input) {
3964 var optrOpnd;
3965 var sc_optrOpnd_20;
3966 var sc_optrOpnd_21;
3967 var sc_optrOpnd_22;
3968 var loop1;
3969 var BgL_sc_stateza2_23za2;
3970 var toks;
3971 var BgL_sc_nbzd2nts_24zd2;
3972 var sc_steps_25;
3973 var sc_enders_26;
3974 var state_num;
3975 var BgL_sc_statesza2_27za2;
3976 var states;
3977 var i;
3978 var conf;
3979 var l;
3980 var tok_nts;
3981 var sc_i_28;
3982 var sc_i_29;
3983 var l1;
3984 var l2;
3985 var tok;
3986 var tail1129;
3987 var L1125;
3988 var goal_enders;
3989 var BgL_sc_statesza2_30za2;
3990 var BgL_sc_nbzd2nts_31zd2;
3991 var BgL_sc_nbzd2confs_32zd2;
3992 var nb_toks;
3993 var goal_starters;
3994 var sc_states_33;
3995 var BgL_sc_nbzd2confs_34zd2;
3996 var BgL_sc_nbzd2toks_35zd2;
3997 var sc_toks_36;
3998 var falseHead1128;
3999 var sc_names_37;
4000 var sc_steps_38;
4001 var sc_predictors_39;
4002 var sc_enders_40;
4003 var sc_starters_41;
4004 var sc_nts_42;
4005 var lexer;
4006 var sc_ind_43;
4007 var make_states;
4008 var BgL_sc_confzd2setzd2getza2_44za2;
4009 var conf_set_merge_new_bang;
4010 var conf_set_adjoin;
4011 var BgL_sc_confzd2setzd2adjoinza2_45za2;
4012 var BgL_sc_confzd2setzd2adjoinza2za2_46z00;
4013 var conf_set_union;
4014 var forw;
4015 var is_parsed;
4016 var deriv_trees;
4017 var BgL_sc_derivzd2treesza2_47z70;
4018 var nb_deriv_trees;
4019 var BgL_sc_nbzd2derivzd2treesza2_48za2;
4021 sc_ind_43 = function(nt, sc_nts_49) {
4022 var i;
4024 (i = ((sc_nts_49.length)-(1)));
4025 while (true) {
4026 if ((i>=(0)))
4027 if ((sc_isEqual((sc_nts_49[i]), nt)))
4028 return i;
4029 else
4030 (--i);
4031 else
4032 return false;
4036 make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) {
4037 var v;
4038 var i;
4039 var sc_states_52;
4041 (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false)));
4042 (i = BgL_sc_nbzd2toks_50zd2);
4043 while ((i>=(0))) {
4045 (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false)));
4046 (v[(0)] = (-1));
4047 (sc_states_52[i] = v);
4048 (--i);
4051 return sc_states_52;
4054 BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) {
4055 var conf_set;
4056 var BgL_sc_confzd2set_55zd2;
4057 return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set)));
4059 conf_set_merge_new_bang = function(conf_set) {
4060 return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)));
4062 conf_set_adjoin = function(state, conf_set, sc_conf_56, i) {
4063 var tail;
4064 return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined));
4066 BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) {
4067 var conf_set;
4068 var sc_conf_59;
4069 var l1;
4070 var state;
4072 (state = (sc_states_57[BgL_sc_statezd2num_58zd2]));
4073 (l1 = l);
4074 while ((l1 instanceof sc_Pair)) {
4076 (sc_conf_59 = (l1.car));
4077 (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59)));
4078 if (((conf_set[(i+(5))])=== false))
4080 (conf_set_adjoin(state, conf_set, sc_conf_59, i));
4081 (l1 = (l1.cdr));
4083 else
4084 (l1 = (l1.cdr));
4087 return undefined;
4090 BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) {
4091 var BgL_sc_confzd2setza2_64z70;
4092 var BgL_sc_stateza2_65za2;
4093 var conf_set;
4094 var state;
4095 return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false));
4097 conf_set_union = function(state, conf_set, sc_conf_66, other_set) {
4098 var i;
4100 (i = (other_set[(2)]));
4101 while ((i>=(0))) {
4102 if (((conf_set[(i+(5))])=== false))
4104 (conf_set_adjoin(state, conf_set, sc_conf_66, i));
4105 (i = (other_set[(i+(5))]));
4107 else
4108 (i = (other_set[(i+(5))]));
4110 return undefined;
4113 forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) {
4114 var next_set;
4115 var next;
4116 var conf_set;
4117 var ender;
4118 var l;
4119 var starter_set;
4120 var starter;
4121 var sc_l_74;
4122 var sc_loop1_75;
4123 var head;
4124 var BgL_sc_confzd2set_76zd2;
4125 var BgL_sc_statezd2num_77zd2;
4126 var state;
4127 var sc_states_78;
4128 var preds;
4129 var BgL_sc_confzd2set_79zd2;
4130 var step;
4131 var sc_conf_80;
4132 var BgL_sc_nbzd2nts_81zd2;
4133 var sc_state_82;
4135 (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2]));
4136 (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length));
4137 while (true) {
4139 (sc_conf_80 = (sc_state_82[(0)]));
4140 if ((sc_conf_80>=(0)))
4142 (step = (sc_steps_72[sc_conf_80]));
4143 (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))]));
4144 (head = (BgL_sc_confzd2set_79zd2[(4)]));
4145 (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)]));
4146 (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2));
4147 if ((step>=(0)))
4149 (sc_l_74 = (sc_starters_69[step]));
4150 while ((sc_l_74 instanceof sc_Pair)) {
4152 (starter = (sc_l_74.car));
4153 (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter)));
4154 if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false))
4156 (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2));
4157 (sc_l_74 = (sc_l_74.cdr));
4159 else
4160 (sc_l_74 = (sc_l_74.cdr));
4163 (l = (sc_enders_70[step]));
4164 while ((l instanceof sc_Pair)) {
4166 (ender = (l.car));
4167 if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false))
4169 (next = (sc_conf_80+(1)));
4170 (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next)));
4171 (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2));
4172 (l = (l.cdr));
4174 else
4175 (l = (l.cdr));
4179 else
4181 (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)]));
4182 (sc_states_78 = sc_states_67);
4183 (state = sc_state_82);
4184 (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2);
4185 (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2);
4186 sc_loop1_75 = function(l) {
4187 var sc_state_83;
4188 var BgL_sc_nextzd2set_84zd2;
4189 var sc_next_85;
4190 var pred_set;
4191 var i;
4192 var pred;
4193 if ((l instanceof sc_Pair))
4195 (pred = (l.car));
4196 (i = head);
4197 while ((i>=(0))) {
4199 (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))])));
4200 if ((pred_set!== false))
4202 (sc_next_85 = (pred+(1)));
4203 (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85)));
4204 (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set));
4206 (i = (BgL_sc_confzd2set_76zd2[(i+(5))]));
4209 return (sc_loop1_75((l.cdr)));
4211 else
4212 return undefined;
4214 (sc_loop1_75(preds));
4217 else
4218 return undefined;
4223 is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) {
4224 var conf_set;
4225 var state;
4226 var sc_conf_89;
4227 var l;
4228 var BgL_sc_ntza2_90za2;
4230 (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86)));
4231 if ((BgL_sc_ntza2_90za2!== false))
4233 (sc_nts_86.length);
4234 (l = (sc_enders_87[BgL_sc_ntza2_90za2]));
4235 while (true) {
4236 if ((l instanceof sc_Pair))
4238 (sc_conf_89 = (l.car));
4239 if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))
4240 return true;
4241 else
4242 (l = (l.cdr));
4244 else
4245 return false;
4248 else
4249 return false;
4252 deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) {
4253 var sc_loop1_98;
4254 var prev;
4255 var name;
4256 return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91<BgL_sc_nbzd2nts_97zd2)?(sc_list((sc_list(name, ((sc_toks_95[i]).car))))):(sc_list((sc_list(name))))):((prev = (sc_conf_91-(1))), (sc_loop1_98 = function(l1, l2) {
4257 var loop2;
4258 var ender_set;
4259 var state;
4260 var ender;
4261 var l1;
4262 var l2;
4263 while (true) {
4264 if ((l1 instanceof sc_Pair))
4266 (ender = (l1.car));
4267 (ender_set = ((state = (sc_states_96[j])), (state[(ender+(1))])));
4268 if ((ender_set!== false))
4270 loop2 = function(k, l2) {
4271 var loop3;
4272 var ender_trees;
4273 var prev_trees;
4274 var conf_set;
4275 var sc_state_99;
4276 var k;
4277 var l2;
4278 while (true) {
4279 if ((k>=(0)))
4280 if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)))
4282 (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2)));
4283 (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2)));
4284 loop3 = function(l3, l2) {
4285 var l4;
4286 var sc_l2_100;
4287 var ender_tree;
4288 if ((l3 instanceof sc_Pair))
4290 (ender_tree = (sc_list((l3.car))));
4291 (l4 = prev_trees);
4292 (sc_l2_100 = l2);
4293 while ((l4 instanceof sc_Pair)) {
4295 (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100)));
4296 (l4 = (l4.cdr));
4299 return (loop3((l3.cdr), sc_l2_100));
4301 else
4302 return (loop2((ender_set[(k+(5))]), l2));
4304 return (loop3(ender_trees, l2));
4306 else
4307 (k = (ender_set[(k+(5))]));
4308 else
4309 return (sc_loop1_98((l1.cdr), l2));
4312 return (loop2((ender_set[(2)]), l2));
4314 else
4315 (l1 = (l1.cdr));
4317 else
4318 return l2;
4320 }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null)))));
4322 BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) {
4323 var conf_set;
4324 var state;
4325 var sc_conf_107;
4326 var l;
4327 var trees;
4328 var BgL_sc_nbzd2nts_108zd2;
4329 var BgL_sc_ntza2_109za2;
4331 (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101)));
4332 if ((BgL_sc_ntza2_109za2!== false))
4334 (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length));
4335 (l = (sc_enders_102[BgL_sc_ntza2_109za2]));
4336 (trees = null);
4337 while ((l instanceof sc_Pair)) {
4339 (sc_conf_107 = (l.car));
4340 if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))
4342 (l = (l.cdr));
4343 (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees)));
4345 else
4346 (l = (l.cdr));
4349 return trees;
4351 else
4352 return false;
4355 nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) {
4356 var sc_loop1_116;
4357 var tmp1124;
4358 var prev;
4359 return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110<BgL_sc_nbzd2nts_115zd2)), ((tmp1124!== false)?tmp1124:((sc_steps_112[prev])<(0))))!== false)?(1):((sc_loop1_116 = function(l, sc_n_118) {
4360 var nb_ender_trees;
4361 var nb_prev_trees;
4362 var conf_set;
4363 var state;
4364 var k;
4365 var n;
4366 var ender_set;
4367 var sc_state_117;
4368 var ender;
4369 var l;
4370 var sc_n_118;
4371 while (true) {
4372 if ((l instanceof sc_Pair))
4374 (ender = (l.car));
4375 (ender_set = ((sc_state_117 = (sc_states_114[j])), (sc_state_117[(ender+(1))])));
4376 if ((ender_set!== false))
4378 (k = (ender_set[(2)]));
4379 (n = sc_n_118);
4380 while ((k>=(0))) {
4381 if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)))
4383 (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2)));
4384 (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2)));
4385 (k = (ender_set[(k+(5))]));
4386 (n +=(nb_prev_trees*nb_ender_trees));
4388 else
4389 (k = (ender_set[(k+(5))]));
4391 return (sc_loop1_116((l.cdr), n));
4393 else
4394 (l = (l.cdr));
4396 else
4397 return sc_n_118;
4399 }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0))))));
4401 BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) {
4402 var conf_set;
4403 var state;
4404 var sc_conf_124;
4405 var l;
4406 var nb_trees;
4407 var BgL_sc_nbzd2nts_125zd2;
4408 var BgL_sc_ntza2_126za2;
4410 (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119)));
4411 if ((BgL_sc_ntza2_126za2!== false))
4413 (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length));
4414 (l = (sc_enders_120[BgL_sc_ntza2_126za2]));
4415 (nb_trees = (0));
4416 while ((l instanceof sc_Pair)) {
4418 (sc_conf_124 = (l.car));
4419 if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))
4421 (l = (l.cdr));
4422 (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees));
4424 else
4425 (l = (l.cdr));
4428 return nb_trees;
4430 else
4431 return false;
4434 (lexer = (parser_descr[(0)]));
4435 (sc_nts_42 = (parser_descr[(1)]));
4436 (sc_starters_41 = (parser_descr[(2)]));
4437 (sc_enders_40 = (parser_descr[(3)]));
4438 (sc_predictors_39 = (parser_descr[(4)]));
4439 (sc_steps_38 = (parser_descr[(5)]));
4440 (sc_names_37 = (parser_descr[(6)]));
4441 (falseHead1128 = (new sc_Pair(null, null)));
4442 (L1125 = (lexer(input)));
4443 (tail1129 = falseHead1128);
4444 while (!(L1125 === null)) {
4446 (tok = (L1125.car));
4447 (l1 = (tok.cdr));
4448 (l2 = null);
4449 while ((l1 instanceof sc_Pair)) {
4451 (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42)));
4452 if ((sc_i_29!== false))
4454 (l1 = (l1.cdr));
4455 (l2 = (new sc_Pair(sc_i_29, l2)));
4457 else
4458 (l1 = (l1.cdr));
4461 (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2)))));
4462 (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null)));
4463 (tail1129.cdr = sc_optrOpnd_21);
4464 (tail1129 = (tail1129.cdr));
4465 (L1125 = (L1125.cdr));
4468 (sc_optrOpnd_20 = (falseHead1128.cdr));
4469 (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20)));
4470 (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length));
4471 (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length));
4472 (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2)));
4473 (goal_starters = (sc_starters_41[(0)]));
4474 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0)));
4475 (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42));
4476 (sc_i_28 = (0));
4477 while ((sc_i_28<BgL_sc_nbzd2toks_35zd2)) {
4479 (tok_nts = ((sc_toks_36[sc_i_28]).cdr));
4480 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (sc_i_28+(1)), tok_nts, sc_i_28));
4481 (forw(sc_states_33, (sc_i_28+(1)), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42));
4482 (++sc_i_28);
4485 (nb_toks = (sc_toks_36.length));
4486 (BgL_sc_nbzd2confs_32zd2 = (sc_steps_38.length));
4487 (BgL_sc_nbzd2nts_31zd2 = (sc_nts_42.length));
4488 (BgL_sc_statesza2_30za2 = (make_states(nb_toks, BgL_sc_nbzd2confs_32zd2)));
4489 (goal_enders = (sc_enders_40[(0)]));
4490 (l = goal_enders);
4491 while ((l instanceof sc_Pair)) {
4493 (conf = (l.car));
4494 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_33, BgL_sc_statesza2_30za2, nb_toks, conf, (0)));
4495 (l = (l.cdr));
4498 (i = nb_toks);
4499 while ((i>=(0))) {
4501 (states = sc_states_33);
4502 (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2);
4503 (state_num = i);
4504 (sc_enders_26 = sc_enders_40);
4505 (sc_steps_25 = sc_steps_38);
4506 (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2);
4507 (toks = sc_toks_36);
4508 (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i]));
4509 loop1 = function() {
4510 var sc_loop1_127;
4511 var prev;
4512 var BgL_sc_statesza2_128za2;
4513 var sc_states_129;
4514 var j;
4515 var i;
4516 var sc_i_130;
4517 var head;
4518 var conf_set;
4519 var sc_conf_131;
4521 (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)]));
4522 if ((sc_conf_131>=(0)))
4524 (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))]));
4525 (head = (conf_set[(4)]));
4526 (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)]));
4527 (conf_set_merge_new_bang(conf_set));
4528 (sc_i_130 = head);
4529 while ((sc_i_130>=(0))) {
4531 (i = sc_i_130);
4532 (j = state_num);
4533 (sc_states_129 = states);
4534 (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2);
4535 (prev = (sc_conf_131-(1)));
4536 if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0))))
4538 sc_loop1_127 = function(l) {
4539 var k;
4540 var ender_set;
4541 var state;
4542 var ender;
4543 var l;
4544 while (true) {
4545 if ((l instanceof sc_Pair))
4547 (ender = (l.car));
4548 (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))])));
4549 if ((ender_set!== false))
4551 (k = (ender_set[(2)]));
4552 while ((k>=(0))) {
4554 if ((k>=i))
4555 if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false))
4556 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k));
4557 (k = (ender_set[(k+(5))]));
4560 return (sc_loop1_127((l.cdr)));
4562 else
4563 (l = (l.cdr));
4565 else
4566 return undefined;
4569 (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])])));
4571 (sc_i_130 = (conf_set[(sc_i_130+(5))]));
4574 return (loop1());
4576 else
4577 return undefined;
4580 (loop1());
4581 (--i);
4584 (optrOpnd = BgL_sc_statesza2_30za2);
4585 return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2];
4590 BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) {
4591 var is_parsed;
4592 var states;
4593 var enders;
4594 var nts;
4595 return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states)));
4597 BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) {
4598 var BgL_sc_derivzd2treesza2_132z70;
4599 var states;
4600 var toks;
4601 var names;
4602 var steps;
4603 var enders;
4604 var nts;
4605 return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states)));
4607 BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) {
4608 var BgL_sc_nbzd2derivzd2treesza2_133za2;
4609 var states;
4610 var toks;
4611 var steps;
4612 var enders;
4613 var nts;
4614 return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states)));
4616 test2 = function(k) {
4617 var x;
4618 var p;
4619 return ((p = (BgL_makezd2parserzd2(const_earley, function(l) {
4620 var sc_x_134;
4621 var tail1134;
4622 var L1130;
4623 var falseHead1133;
4625 (falseHead1133 = (new sc_Pair(null, null)));
4626 (tail1134 = falseHead1133);
4627 (L1130 = l);
4628 while (!(L1130 === null)) {
4630 (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null)));
4631 (tail1134 = (tail1134.cdr));
4632 (L1130 = (L1130.cdr));
4635 return (falseHead1133.cdr);
4637 }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k)))));
4639 BgL_earleyzd2benchmarkzd2 = function() {
4640 var args = null;
4641 for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) {
4642 args = sc_cons(arguments[sc_tmp], args);
4644 var k;
4645 return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() {
4646 return (test2(k));
4647 }, function(result) {
4648 return ((sc_display(result)), (sc_newline()), result == 132);
4649 })));
4654 /************* END OF GENERATED CODE *************/
4655 // Invoke this function to run a benchmark.
4656 // The first argument is a string identifying the benchmark.
4657 // The second argument is the number of times to run the benchmark.
4658 // The third argument is a function that runs the benchmark.
4659 // The fourth argument is a unary function that warns if the result
4660 // returned by the benchmark is incorrect.
4662 // Example:
4663 // RunBenchmark("new Array()",
4664 // 1,
4665 // function () { new Array(1000000); }
4666 // function (v) {
4667 // return (v instanceof Array) && (v.length == 1000000);
4668 // });
4670 SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {});
4671 SC_ERROR_OUT = SC_DEFAULT_OUT;
4673 function RunBenchmark(name, count, run, warn) {
4674 for (var n = 0; n < count; ++n) {
4675 result = run();
4676 if (!warn(result)) {
4677 throw new Error("Earley or Boyer did incorrect number of rewrites");
4682 var BgL_runzd2benchmarkzd2 = RunBenchmark;
4684 window.onload = function(){ startTest("v8-earley-boyer", 'd4c16950');
4686 test("Earley", BgL_earleyzd2benchmarkzd2);
4687 test("Boyer", BgL_nboyerzd2benchmarkzd2);
4689 endTest(); };
4690 </script>
4691 </head>
4692 <body></body>
4693 </html>