Best JavaScript code snippet using cucumber-gherkin
earley-boyer.js
Source:earley-boyer.js
1// This file is automatically generated by scheme2js, except for the2// benchmark harness code at the beginning and end of the file.3var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 666463, [4 new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }),5 new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); })6]);7/************* GENERATED FILE - DO NOT EDIT *************/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/*16 * To use write/prints/... the default-output port has to be set first.17 * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values18 * should do the trick.19 * In the following example the std-out and error-port are redirected to20 * a DIV.21function initRuntime() {22 function escapeHTML(s) {23 var tmp = s;24 tmp = tmp.replace(/&/g, "&");25 tmp = tmp.replace(/</g, "<");26 tmp = tmp.replace(/>/g, ">");27 tmp = tmp.replace(/ /g, " ");28 tmp = tmp.replace(/\n/g, "<br />");29 tmp = tmp.replace(/\t/g, "  ");30 return tmp;31 32 }33 document.write("<div id='stdout'></div>");34 SC_DEFAULT_OUT = new sc_GenericOutputPort(35 function(s) {36 var stdout = document.getElementById('stdout');37 stdout.innerHTML = stdout.innerHTML + escapeHTML(s);38 });39 SC_ERROR_OUT = SC_DEFAULT_OUT;40}41*/42function sc_print_debug() {43 sc_print.apply(null, arguments);44}45/*** META ((export *js*)) */46var sc_JS_GLOBALS = this;47var __sc_LINE=-1;48var __sc_FILE="";49/*** META ((export #t)) */50function sc_alert() {51 var len = arguments.length;52 var s = "";53 var i;54 for( i = 0; i < len; i++ ) {55 s += sc_toDisplayString(arguments[ i ]);56 }57 return alert( s );58}59/*** META ((export #t)) */60function sc_typeof( x ) {61 return typeof x;62}63/*** META ((export #t)) */64function sc_error() {65 var a = [sc_jsstring2symbol("*error*")];66 for (var i = 0; i < arguments.length; i++) {67 a[i+1] = arguments[i];68 }69 throw a;70}71/*** META ((export #t)72 (peephole (prefix "throw ")))73*/74function sc_raise(obj) {75 throw obj;76}77/*** META ((export with-handler-lambda)) */78function sc_withHandlerLambda(handler, body) {79 try {80 return body();81 } catch(e) {82 if (!e._internalException)83 return handler(e);84 else85 throw e;86 }87}88var sc_properties = new Object();89/*** META ((export #t)) */90function sc_putpropBang(sym, key, val) {91 var ht = sc_properties[sym];92 if (!ht) {93 ht = new Object();94 sc_properties[sym] = ht;95 }96 ht[key] = val;97}98/*** META ((export #t)) */99function sc_getprop(sym, key) {100 var ht = sc_properties[sym];101 if (ht) {102 if (key in ht)103 return ht[key];104 else105 return false;106 } else107 return false;108}109/*** META ((export #t)) */110function sc_rempropBang(sym, key) {111 var ht = sc_properties[sym];112 if (ht)113 delete ht[key];114}115/*** META ((export #t)) */116function sc_any2String(o) {117 return jsstring2string(sc_toDisplayString(o));118}119/*** META ((export #t)120 (peephole (infix 2 2 "==="))121 (type bool))122*/123function sc_isEqv(o1, o2) {124 return (o1 === o2);125}126/*** META ((export #t)127 (peephole (infix 2 2 "==="))128 (type bool))129*/130function sc_isEq(o1, o2) {131 return (o1 === o2);132}133/*** META ((export #t)134 (type bool))135*/136function sc_isNumber(n) {137 return (typeof n === "number");138}139/*** META ((export #t)140 (type bool))141*/142function sc_isComplex(n) {143 return sc_isNumber(n);144}145/*** META ((export #t)146 (type bool))147*/148function sc_isReal(n) {149 return sc_isNumber(n);150}151/*** META ((export #t)152 (type bool))153*/154function sc_isRational(n) {155 return sc_isReal(n);156}157/*** META ((export #t)158 (type bool))159*/160function sc_isInteger(n) {161 return (parseInt(n) === n);162}163/*** META ((export #t)164 (type bool)165 (peephole (postfix ", false")))166*/167// we don't have exact numbers...168function sc_isExact(n) {169 return false;170}171/*** META ((export #t)172 (peephole (postfix ", true"))173 (type bool))174*/175function sc_isInexact(n) {176 return true;177}178/*** META ((export = =fx =fl)179 (type bool)180 (peephole (infix 2 2 "===")))181*/182function sc_equal(x) {183 for (var i = 1; i < arguments.length; i++)184 if (x !== arguments[i])185 return false;186 return true;187}188/*** META ((export < <fx <fl)189 (type bool)190 (peephole (infix 2 2 "<")))191*/192function sc_less(x) {193 for (var i = 1; i < arguments.length; i++) {194 if (x >= arguments[i])195 return false;196 x = arguments[i];197 }198 return true;199}200/*** META ((export > >fx >fl)201 (type bool)202 (peephole (infix 2 2 ">")))203*/204function sc_greater(x, y) {205 for (var i = 1; i < arguments.length; i++) {206 if (x <= arguments[i])207 return false;208 x = arguments[i];209 }210 return true;211}212/*** META ((export <= <=fx <=fl)213 (type bool)214 (peephole (infix 2 2 "<=")))215*/216function sc_lessEqual(x, y) {217 for (var i = 1; i < arguments.length; i++) {218 if (x > arguments[i])219 return false;220 x = arguments[i];221 }222 return true;223}224/*** META ((export >= >=fl >=fx)225 (type bool)226 (peephole (infix 2 2 ">=")))227*/228function sc_greaterEqual(x, y) {229 for (var i = 1; i < arguments.length; i++) {230 if (x < arguments[i])231 return false;232 x = arguments[i];233 }234 return true;235}236/*** META ((export #t)237 (type bool)238 (peephole (postfix "=== 0")))239*/240function sc_isZero(x) {241 return (x === 0);242}243/*** META ((export #t)244 (type bool)245 (peephole (postfix "> 0")))246*/247function sc_isPositive(x) {248 return (x > 0);249}250/*** META ((export #t)251 (type bool)252 (peephole (postfix "< 0")))253*/254function sc_isNegative(x) {255 return (x < 0);256}257/*** META ((export #t)258 (type bool)259 (peephole (postfix "%2===1")))260*/261function sc_isOdd(x) {262 return (x % 2 === 1);263}264/*** META ((export #t)265 (type bool)266 (peephole (postfix "%2===0")))267*/268function sc_isEven(x) {269 return (x % 2 === 0);270}271/*** META ((export #t)) */272var sc_max = Math.max;273/*** META ((export #t)) */274var sc_min = Math.min;275/*** META ((export + +fx +fl)276 (peephole (infix 0 #f "+" "0")))277*/278function sc_plus() {279 var sum = 0;280 for (var i = 0; i < arguments.length; i++)281 sum += arguments[i];282 return sum;283}284/*** META ((export * *fx *fl)285 (peephole (infix 0 #f "*" "1")))286*/287function sc_multi() {288 var product = 1;289 for (var i = 0; i < arguments.length; i++)290 product *= arguments[i];291 return product;292}293/*** META ((export - -fx -fl)294 (peephole (minus)))295*/296function sc_minus(x) {297 if (arguments.length === 1)298 return -x;299 else {300 var res = x;301 for (var i = 1; i < arguments.length; i++)302 res -= arguments[i];303 return res;304 }305}306/*** META ((export / /fl)307 (peephole (div)))308*/309function sc_div(x) {310 if (arguments.length === 1)311 return 1/x;312 else {313 var res = x;314 for (var i = 1; i < arguments.length; i++)315 res /= arguments[i];316 return res;317 }318}319/*** META ((export #t)) */320var sc_abs = Math.abs;321/*** META ((export quotient /fx)322 (peephole (hole 2 "parseInt(" x "/" y ")")))323*/324function sc_quotient(x, y) {325 return parseInt(x / y);326}327/*** META ((export #t)328 (peephole (infix 2 2 "%")))329*/330function sc_remainder(x, y) {331 return x % y;332}333/*** META ((export #t)334 (peephole (modulo)))335*/336function sc_modulo(x, y) {337 var remainder = x % y;338 // if they don't have the same sign339 if ((remainder * y) < 0)340 return remainder + y;341 else342 return remainder;343}344function sc_euclid_gcd(a, b) {345 var temp;346 if (a === 0) return b;347 if (b === 0) return a;348 if (a < 0) {a = -a;};349 if (b < 0) {b = -b;};350 if (b > a) {temp = a; a = b; b = temp;};351 while (true) {352 a %= b;353 if(a === 0) {return b;};354 b %= a;355 if(b === 0) {return a;};356 };357 return b;358}359/*** META ((export #t)) */360function sc_gcd() {361 var gcd = 0;362 for (var i = 0; i < arguments.length; i++)363 gcd = sc_euclid_gcd(gcd, arguments[i]);364 return gcd;365}366/*** META ((export #t)) */367function sc_lcm() {368 var lcm = 1;369 for (var i = 0; i < arguments.length; i++) {370 var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm));371 lcm *= Math.abs(f);372 }373 return lcm;374}375// LIMITATION: numerator and denominator don't make sense in floating point world.376//var SC_MAX_DECIMALS = 1000000377//378// function sc_numerator(x) {379// var rounded = Math.round(x * SC_MAX_DECIMALS);380// return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));381// }382// function sc_denominator(x) {383// var rounded = Math.round(x * SC_MAX_DECIMALS);384// return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));385// }386/*** META ((export #t)) */387var sc_floor = Math.floor;388/*** META ((export #t)) */389var sc_ceiling = Math.ceil;390/*** META ((export #t)) */391var sc_truncate = parseInt;392/*** META ((export #t)) */393var sc_round = Math.round;394// LIMITATION: sc_rationalize doesn't make sense in a floating point world.395/*** META ((export #t)) */396var sc_exp = Math.exp;397/*** META ((export #t)) */398var sc_log = Math.log;399/*** META ((export #t)) */400var sc_sin = Math.sin;401/*** META ((export #t)) */402var sc_cos = Math.cos;403/*** META ((export #t)) */404var sc_tan = Math.tan;405/*** META ((export #t)) */406var sc_asin = Math.asin;407/*** META ((export #t)) */408var sc_acos = Math.acos;409/*** META ((export #t)) */410var sc_atan = Math.atan;411/*** META ((export #t)) */412var sc_sqrt = Math.sqrt;413/*** META ((export #t)) */414var sc_expt = Math.pow;415// LIMITATION: we don't have complex numbers.416// LIMITATION: the following functions are hence not implemented.417// LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle418// LIMITATION: 2 argument atan419/*** META ((export #t)420 (peephole (id)))421*/422function sc_exact2inexact(x) {423 return x;424}425/*** META ((export #t)426 (peephole (id)))427*/428function sc_inexact2exact(x) {429 return x;430}431function sc_number2jsstring(x, radix) {432 if (radix)433 return x.toString(radix);434 else435 return x.toString();436}437function sc_jsstring2number(s, radix) {438 if (s === "") return false;439 if (radix) {440 var t = parseInt(s, radix);441 if (!t && t !== 0) return false;442 // verify that each char is in range. (parseInt ignores leading443 // white and trailing chars)444 var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1);445 if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s))446 return t;447 else return false;448 } else {449 var t = +s; // does not ignore trailing chars.450 if (!t && t !== 0) return false;451 // simply verify that first char is not whitespace.452 var c = s.charAt(0);453 // if +c is 0, but the char is not "0", then we have a whitespace.454 if (+c === 0 && c !== "0") return false;455 return t;456 }457}458/*** META ((export #t)459 (type bool)460 (peephole (not)))461*/462function sc_not(b) {463 return b === false;464}465/*** META ((export #t)466 (type bool))467*/468function sc_isBoolean(b) {469 return (b === true) || (b === false);470}471function sc_Pair(car, cdr) {472 this.car = car;473 this.cdr = cdr;474}475sc_Pair.prototype.toString = function() {476 return sc_toDisplayString(this);477};478sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {479 var current = this;480 var res = "(";481 while(true) {482 res += writeOrDisplay(current.car);483 if (sc_isPair(current.cdr)) {484 res += " ";485 current = current.cdr;486 } else if (current.cdr !== null) {487 res += " . " + writeOrDisplay(current.cdr);488 break;489 } else // current.cdr == null490 break;491 }492 493 res += ")";494 return res;495};496sc_Pair.prototype.sc_toDisplayString = function() {497 return this.sc_toWriteOrDisplayString(sc_toDisplayString);498};499sc_Pair.prototype.sc_toWriteString = function() {500 return this.sc_toWriteOrDisplayString(sc_toWriteString);501};502// sc_Pair.prototype.sc_toWriteCircleString in IO.js503/*** META ((export #t)504 (type bool)505 (peephole (postfix " instanceof sc_Pair")))506*/507function sc_isPair(p) {508 return (p instanceof sc_Pair);509}510function sc_isPairEqual(p1, p2, comp) {511 return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr));512}513/*** META ((export #t)514 (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))515*/516function sc_cons(car, cdr) {517 return new sc_Pair(car, cdr);518}519/*** META ((export cons*)) */520function sc_consStar() {521 var res = arguments[arguments.length - 1];522 for (var i = arguments.length-2; i >= 0; i--)523 res = new sc_Pair(arguments[i], res);524 return res;525}526/*** META ((export #t)527 (peephole (postfix ".car")))528*/529function sc_car(p) {530 return p.car;531}532/*** META ((export #t)533 (peephole (postfix ".cdr")))534*/535function sc_cdr(p) {536 return p.cdr;537}538/*** META ((export #t)539 (peephole (hole 2 p ".car = " val)))540*/541function sc_setCarBang(p, val) {542 p.car = val;543}544/*** META ((export #t)545 (peephole (hole 2 p ".cdr = " val)))546*/547function sc_setCdrBang(p, val) {548 p.cdr = val;549}550/*** META ((export #t)551 (peephole (postfix ".car.car")))552*/553function sc_caar(p) { return p.car.car; }554/*** META ((export #t)555 (peephole (postfix ".cdr.car")))556*/557function sc_cadr(p) { return p.cdr.car; }558/*** META ((export #t)559 (peephole (postfix ".car.cdr")))560*/561function sc_cdar(p) { return p.car.cdr; }562/*** META ((export #t)563 (peephole (postfix ".cdr.cdr")))564*/565function sc_cddr(p) { return p.cdr.cdr; }566/*** META ((export #t)567 (peephole (postfix ".car.car.car")))568*/569function sc_caaar(p) { return p.car.car.car; }570/*** META ((export #t)571 (peephole (postfix ".car.cdr.car")))572*/573function sc_cadar(p) { return p.car.cdr.car; }574/*** META ((export #t)575 (peephole (postfix ".cdr.car.car")))576*/577function sc_caadr(p) { return p.cdr.car.car; }578/*** META ((export #t)579 (peephole (postfix ".cdr.cdr.car")))580*/581function sc_caddr(p) { return p.cdr.cdr.car; }582/*** META ((export #t)583 (peephole (postfix ".car.car.cdr")))584*/585function sc_cdaar(p) { return p.car.car.cdr; }586/*** META ((export #t)587 (peephole (postfix ".cdr.car.cdr")))588*/589function sc_cdadr(p) { return p.cdr.car.cdr; }590/*** META ((export #t)591 (peephole (postfix ".car.cdr.cdr")))592*/593function sc_cddar(p) { return p.car.cdr.cdr; }594/*** META ((export #t)595 (peephole (postfix ".cdr.cdr.cdr")))596*/597function sc_cdddr(p) { return p.cdr.cdr.cdr; }598/*** META ((export #t)599 (peephole (postfix ".car.car.car.car")))600*/601function sc_caaaar(p) { return p.car.car.car.car; }602/*** META ((export #t)603 (peephole (postfix ".car.cdr.car.car")))604*/605function sc_caadar(p) { return p.car.cdr.car.car; }606/*** META ((export #t)607 (peephole (postfix ".cdr.car.car.car")))608*/609function sc_caaadr(p) { return p.cdr.car.car.car; }610/*** META ((export #t)611 (peephole (postfix ".cdr.cdr.car.car")))612*/613function sc_caaddr(p) { return p.cdr.cdr.car.car; }614/*** META ((export #t)615 (peephole (postfix ".car.car.car.cdr")))616*/617function sc_cdaaar(p) { return p.car.car.car.cdr; }618/*** META ((export #t)619 (peephole (postfix ".car.cdr.car.cdr")))620*/621function sc_cdadar(p) { return p.car.cdr.car.cdr; }622/*** META ((export #t)623 (peephole (postfix ".cdr.car.car.cdr")))624*/625function sc_cdaadr(p) { return p.cdr.car.car.cdr; }626/*** META ((export #t)627 (peephole (postfix ".cdr.cdr.car.cdr")))628*/629function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; }630/*** META ((export #t)631 (peephole (postfix ".car.car.cdr.car")))632*/633function sc_cadaar(p) { return p.car.car.cdr.car; }634/*** META ((export #t)635 (peephole (postfix ".car.cdr.cdr.car")))636*/637function sc_caddar(p) { return p.car.cdr.cdr.car; }638/*** META ((export #t)639 (peephole (postfix ".cdr.car.cdr.car")))640*/641function sc_cadadr(p) { return p.cdr.car.cdr.car; }642/*** META ((export #t)643 (peephole (postfix ".cdr.cdr.cdr.car")))644*/645function sc_cadddr(p) { return p.cdr.cdr.cdr.car; }646/*** META ((export #t)647 (peephole (postfix ".car.car.cdr.cdr")))648*/649function sc_cddaar(p) { return p.car.car.cdr.cdr; }650/*** META ((export #t)651 (peephole (postfix ".car.cdr.cdr.cdr")))652*/653function sc_cdddar(p) { return p.car.cdr.cdr.cdr; }654/*** META ((export #t)655 (peephole (postfix ".cdr.car.cdr.cdr")))656*/657function sc_cddadr(p) { return p.cdr.car.cdr.cdr; }658/*** META ((export #t)659 (peephole (postfix ".cdr.cdr.cdr.cdr")))660*/661function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; }662/*** META ((export #t)) */663function sc_lastPair(l) {664 if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected");665 var res = l;666 var cdr = l.cdr;667 while (sc_isPair(cdr)) {668 res = cdr;669 cdr = res.cdr;670 }671 return res;672}673/*** META ((export #t)674 (type bool)675 (peephole (postfix " === null")))676*/677function sc_isNull(o) {678 return (o === null);679}680/*** META ((export #t)681 (type bool))682*/683function sc_isList(o) {684 var rabbit;685 var turtle;686 var rabbit = o;687 var turtle = o;688 while (true) {689 if (rabbit === null ||690 (rabbit instanceof sc_Pair && rabbit.cdr === null))691 return true; // end of list692 else if ((rabbit instanceof sc_Pair) &&693 (rabbit.cdr instanceof sc_Pair)) {694 rabbit = rabbit.cdr.cdr;695 turtle = turtle.cdr;696 if (rabbit === turtle) return false; // cycle697 } else698 return false; // not pair699 }700}701/*** META ((export #t)) */702function sc_list() {703 var res = null;704 var a = arguments;705 for (var i = a.length-1; i >= 0; i--)706 res = new sc_Pair(a[i], res);707 return res;708}709/*** META ((export #t)) */710function sc_iota(num, init) {711 var res = null;712 if (!init) init = 0;713 for (var i = num - 1; i >= 0; i--)714 res = new sc_Pair(i + init, res);715 return res;716}717/*** META ((export #t)) */718function sc_makeList(nbEls, fill) {719 var res = null;720 for (var i = 0; i < nbEls; i++)721 res = new sc_Pair(fill, res);722 return res;723}724/*** META ((export #t)) */725function sc_length(l) {726 var res = 0;727 while (l !== null) {728 res++;729 l = l.cdr;730 }731 return res;732}733/*** META ((export #t)) */734function sc_remq(o, l) {735 var dummy = { cdr : null };736 var tail = dummy;737 while (l !== null) {738 if (l.car !== o) {739 tail.cdr = sc_cons(l.car, null);740 tail = tail.cdr;741 }742 l = l.cdr;743 }744 return dummy.cdr;745}746/*** META ((export #t)) */747function sc_remqBang(o, l) {748 var dummy = { cdr : null };749 var tail = dummy;750 var needsAssig = true;751 while (l !== null) {752 if (l.car === o) {753 needsAssig = true;754 } else {755 if (needsAssig) {756 tail.cdr = l;757 needsAssig = false;758 }759 tail = l;760 }761 l = l.cdr;762 }763 tail.cdr = null;764 return dummy.cdr;765}766/*** META ((export #t)) */767function sc_delete(o, l) {768 var dummy = { cdr : null };769 var tail = dummy;770 while (l !== null) {771 if (!sc_isEqual(l.car, o)) {772 tail.cdr = sc_cons(l.car, null);773 tail = tail.cdr;774 }775 l = l.cdr;776 }777 return dummy.cdr;778}779/*** META ((export #t)) */780function sc_deleteBang(o, l) {781 var dummy = { cdr : null };782 var tail = dummy;783 var needsAssig = true;784 while (l !== null) {785 if (sc_isEqual(l.car, o)) {786 needsAssig = true;787 } else {788 if (needsAssig) {789 tail.cdr = l;790 needsAssig = false;791 }792 tail = l;793 }794 l = l.cdr;795 }796 tail.cdr = null;797 return dummy.cdr;798}799function sc_reverseAppendBang(l1, l2) {800 var res = l2;801 while (l1 !== null) {802 var tmp = res;803 res = l1;804 l1 = l1.cdr;805 res.cdr = tmp;806 }807 return res;808}809 810function sc_dualAppend(l1, l2) {811 if (l1 === null) return l2;812 if (l2 === null) return l1;813 var rev = sc_reverse(l1);814 return sc_reverseAppendBang(rev, l2);815}816/*** META ((export #t)) */817function sc_append() {818 if (arguments.length === 0)819 return null;820 var res = arguments[arguments.length - 1];821 for (var i = arguments.length - 2; i >= 0; i--)822 res = sc_dualAppend(arguments[i], res);823 return res;824}825function sc_dualAppendBang(l1, l2) {826 if (l1 === null) return l2;827 if (l2 === null) return l1;828 var tmp = l1;829 while (tmp.cdr !== null) tmp=tmp.cdr;830 tmp.cdr = l2;831 return l1;832}833/*** META ((export #t)) */834function sc_appendBang() {835 var res = null;836 for (var i = 0; i < arguments.length; i++)837 res = sc_dualAppendBang(res, arguments[i]);838 return res;839}840/*** META ((export #t)) */841function sc_reverse(l1) {842 var res = null;843 while (l1 !== null) {844 res = sc_cons(l1.car, res);845 l1 = l1.cdr;846 }847 return res;848}849/*** META ((export #t)) */850function sc_reverseBang(l) {851 return sc_reverseAppendBang(l, null);852}853/*** META ((export #t)) */854function sc_listTail(l, k) {855 var res = l;856 for (var i = 0; i < k; i++) {857 res = res.cdr;858 }859 return res;860}861/*** META ((export #t)) */862function sc_listRef(l, k) {863 return sc_listTail(l, k).car;864}865/* // unoptimized generic versions866function sc_memX(o, l, comp) {867 while (l != null) {868 if (comp(l.car, o))869 return l;870 l = l.cdr;871 }872 return false;873}874function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); }875function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); }876function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); }877*/878/* optimized versions */879/*** META ((export #t)) */880function sc_memq(o, l) {881 while (l !== null) {882 if (l.car === o)883 return l;884 l = l.cdr;885 }886 return false;887}888/*** META ((export #t)) */889function sc_memv(o, l) {890 while (l !== null) {891 if (l.car === o)892 return l;893 l = l.cdr;894 }895 return false;896}897/*** META ((export #t)) */898function sc_member(o, l) {899 while (l !== null) {900 if (sc_isEqual(l.car,o))901 return l;902 l = l.cdr;903 }904 return false;905}906/* // generic unoptimized versions907function sc_assX(o, al, comp) {908 while (al != null) {909 if (comp(al.car.car, o))910 return al.car;911 al = al.cdr;912 }913 return false;914}915function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); }916function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); }917function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); }918*/919// optimized versions920/*** META ((export #t)) */921function sc_assq(o, al) {922 while (al !== null) {923 if (al.car.car === o)924 return al.car;925 al = al.cdr;926 }927 return false;928}929/*** META ((export #t)) */930function sc_assv(o, al) {931 while (al !== null) {932 if (al.car.car === o)933 return al.car;934 al = al.cdr;935 }936 return false;937}938/*** META ((export #t)) */939function sc_assoc(o, al) {940 while (al !== null) {941 if (sc_isEqual(al.car.car, o))942 return al.car;943 al = al.cdr;944 }945 return false;946}947/* can be used for mutable strings and characters */948function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; }949function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; }950function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; }951function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; }952function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; }953function sc_isCharStringCIEqual(cs1, cs2)954 { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); }955function sc_isCharStringCILess(cs1, cs2)956 { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); }957function sc_isCharStringCIGreater(cs1, cs2)958 { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); }959function sc_isCharStringCILessEqual(cs1, cs2)960 { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); }961function sc_isCharStringCIGreaterEqual(cs1, cs2)962 { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); }963function sc_Char(c) {964 var cached = sc_Char.lazy[c];965 if (cached)966 return cached;967 this.val = c;968 sc_Char.lazy[c] = this;969 // add return, so FF does not complain.970 return undefined;971}972sc_Char.lazy = new Object();973// thanks to Eric974sc_Char.char2readable = {975 "\000": "#\\null",976 "\007": "#\\bell",977 "\010": "#\\backspace",978 "\011": "#\\tab",979 "\012": "#\\newline",980 "\014": "#\\page",981 "\015": "#\\return",982 "\033": "#\\escape",983 "\040": "#\\space",984 "\177": "#\\delete",985 /* poeticless names */986 "\001": "#\\soh",987 "\002": "#\\stx",988 "\003": "#\\etx",989 "\004": "#\\eot",990 "\005": "#\\enq",991 "\006": "#\\ack",992 "\013": "#\\vt",993 "\016": "#\\so",994 "\017": "#\\si",995 "\020": "#\\dle",996 "\021": "#\\dc1",997 "\022": "#\\dc2",998 "\023": "#\\dc3",999 "\024": "#\\dc4",1000 "\025": "#\\nak",1001 "\026": "#\\syn",1002 "\027": "#\\etb",1003 "\030": "#\\can",1004 "\031": "#\\em",1005 "\032": "#\\sub",1006 "\033": "#\\esc",1007 "\034": "#\\fs",1008 "\035": "#\\gs",1009 "\036": "#\\rs",1010 "\037": "#\\us"};1011sc_Char.readable2char = {1012 "null": "\000",1013 "bell": "\007",1014 "backspace": "\010",1015 "tab": "\011",1016 "newline": "\012",1017 "page": "\014",1018 "return": "\015",1019 "escape": "\033",1020 "space": "\040",1021 "delete": "\000",1022 "soh": "\001",1023 "stx": "\002",1024 "etx": "\003",1025 "eot": "\004",1026 "enq": "\005",1027 "ack": "\006",1028 "bel": "\007",1029 "bs": "\010",1030 "ht": "\011",1031 "nl": "\012",1032 "vt": "\013",1033 "np": "\014",1034 "cr": "\015",1035 "so": "\016",1036 "si": "\017",1037 "dle": "\020",1038 "dc1": "\021",1039 "dc2": "\022",1040 "dc3": "\023",1041 "dc4": "\024",1042 "nak": "\025",1043 "syn": "\026",1044 "etb": "\027",1045 "can": "\030",1046 "em": "\031",1047 "sub": "\032",1048 "esc": "\033",1049 "fs": "\034",1050 "gs": "\035",1051 "rs": "\036",1052 "us": "\037",1053 "sp": "\040",1054 "del": "\177"};1055sc_Char.prototype.toString = function() {1056 return this.val;1057};1058// sc_toDisplayString == toString1059sc_Char.prototype.sc_toWriteString = function() {1060 var entry = sc_Char.char2readable[this.val];1061 if (entry)1062 return entry;1063 else1064 return "#\\" + this.val;1065};1066/*** META ((export #t)1067 (type bool)1068 (peephole (postfix "instanceof sc_Char")))1069*/1070function sc_isChar(c) {1071 return (c instanceof sc_Char);1072}1073/*** META ((export char=?)1074 (type bool)1075 (peephole (hole 2 c1 ".val === " c2 ".val")))1076*/1077var sc_isCharEqual = sc_isCharStringEqual;1078/*** META ((export char<?)1079 (type bool)1080 (peephole (hole 2 c1 ".val < " c2 ".val")))1081*/1082var sc_isCharLess = sc_isCharStringLess;1083/*** META ((export char>?)1084 (type bool)1085 (peephole (hole 2 c1 ".val > " c2 ".val")))1086*/1087var sc_isCharGreater = sc_isCharStringGreater;1088/*** META ((export char<=?)1089 (type bool)1090 (peephole (hole 2 c1 ".val <= " c2 ".val")))1091*/1092var sc_isCharLessEqual = sc_isCharStringLessEqual;1093/*** META ((export char>=?)1094 (type bool)1095 (peephole (hole 2 c1 ".val >= " c2 ".val")))1096*/1097var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual;1098/*** META ((export char-ci=?)1099 (type bool)1100 (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()")))1101*/1102var sc_isCharCIEqual = sc_isCharStringCIEqual;1103/*** META ((export char-ci<?)1104 (type bool)1105 (peephole (hole 2 c1 ".val.toLowerCase() < " c2 ".val.toLowerCase()")))1106*/1107var sc_isCharCILess = sc_isCharStringCILess;1108/*** META ((export char-ci>?)1109 (type bool)1110 (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()")))1111*/1112var sc_isCharCIGreater = sc_isCharStringCIGreater;1113/*** META ((export char-ci<=?)1114 (type bool)1115 (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()")))1116*/1117var sc_isCharCILessEqual = sc_isCharStringCILessEqual;1118/*** META ((export char-ci>=?)1119 (type bool)1120 (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()")))1121*/1122var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual;1123var SC_NUMBER_CLASS = "0123456789";1124var SC_WHITESPACE_CLASS = ' \r\n\t\f';1125var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz';1126var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';1127function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); }1128/*** META ((export #t)1129 (type bool))1130*/1131function sc_isCharAlphabetic(c)1132 { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) ||1133 sc_isCharOfClass(c.val, SC_UPPER_CLASS); }1134/*** META ((export #t)1135 (type bool)1136 (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1")))1137*/1138function sc_isCharNumeric(c)1139 { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); }1140/*** META ((export #t)1141 (type bool))1142*/1143function sc_isCharWhitespace(c) {1144 var tmp = c.val;1145 return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f";1146}1147/*** META ((export #t)1148 (type bool)1149 (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1")))1150*/1151function sc_isCharUpperCase(c)1152 { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); }1153/*** META ((export #t)1154 (type bool)1155 (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1")))1156*/1157function sc_isCharLowerCase(c)1158 { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); }1159/*** META ((export #t)1160 (peephole (postfix ".val.charCodeAt(0)")))1161*/1162function sc_char2integer(c)1163 { return c.val.charCodeAt(0); }1164/*** META ((export #t)1165 (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))")))1166*/1167function sc_integer2char(n)1168 { return new sc_Char(String.fromCharCode(n)); }1169/*** META ((export #t)1170 (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())")))1171*/1172function sc_charUpcase(c)1173 { return new sc_Char(c.val.toUpperCase()); }1174/*** META ((export #t)1175 (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())")))1176*/1177function sc_charDowncase(c)1178 { return new sc_Char(c.val.toLowerCase()); }1179function sc_makeJSStringOfLength(k, c) {1180 var fill;1181 if (c === undefined)1182 fill = " ";1183 else1184 fill = c;1185 var res = "";1186 var len = 1;1187 // every round doubles the size of fill.1188 while (k >= len) {1189 if (k & len)1190 res = res.concat(fill);1191 fill = fill.concat(fill);1192 len *= 2;1193 }1194 return res;1195}1196function sc_makejsString(k, c) {1197 var fill;1198 if (c)1199 fill = c.val;1200 else1201 fill = " ";1202 return sc_makeJSStringOfLength(k, fill);1203}1204function sc_jsstring2list(s) {1205 var res = null;1206 for (var i = s.length - 1; i >= 0; i--)1207 res = sc_cons(new sc_Char(s.charAt(i)), res);1208 return res;1209}1210function sc_list2jsstring(l) {1211 var a = new Array();1212 while(l !== null) {1213 a.push(l.car.val);1214 l = l.cdr;1215 }1216 return "".concat.apply("", a);1217}1218var sc_Vector = Array;1219sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {1220 if (this.length === 0) return "#()";1221 var res = "#(" + writeOrDisplay(this[0]);1222 for (var i = 1; i < this.length; i++)1223 res += " " + writeOrDisplay(this[i]);1224 res += ")";1225 return res;1226};1227sc_Vector.prototype.sc_toDisplayString = function() {1228 return this.sc_toWriteOrDisplayString(sc_toDisplayString);1229};1230sc_Vector.prototype.sc_toWriteString = function() {1231 return this.sc_toWriteOrDisplayString(sc_toWriteString);1232};1233/*** META ((export vector? array?)1234 (type bool)1235 (peephole (postfix " instanceof sc_Vector")))1236*/1237function sc_isVector(v) {1238 return (v instanceof sc_Vector);1239}1240// only applies to vectors1241function sc_isVectorEqual(v1, v2, comp) {1242 if (v1.length !== v2.length) return false;1243 for (var i = 0; i < v1.length; i++)1244 if (!comp(v1[i], v2[i])) return false;1245 return true;1246}1247/*** META ((export make-vector make-array)) */1248function sc_makeVector(size, fill) {1249 var a = new sc_Vector(size);1250 if (fill !== undefined)1251 sc_vectorFillBang(a, fill);1252 return a;1253}1254/*** META ((export vector array)1255 (peephole (vector)))1256*/1257function sc_vector() {1258 var a = new sc_Vector();1259 for (var i = 0; i < arguments.length; i++)1260 a.push(arguments[i]);1261 return a;1262}1263/*** META ((export vector-length array-length)1264 (peephole (postfix ".length")))1265*/1266function sc_vectorLength(v) {1267 return v.length;1268}1269/*** META ((export vector-ref array-ref)1270 (peephole (hole 2 v "[" pos "]")))1271*/1272function sc_vectorRef(v, pos) {1273 return v[pos];1274}1275/*** META ((export vector-set! array-set!)1276 (peephole (hole 3 v "[" pos "] = " val)))1277*/1278function sc_vectorSetBang(v, pos, val) {1279 v[pos] = val;1280}1281/*** META ((export vector->list array->list)) */1282function sc_vector2list(a) {1283 var res = null;1284 for (var i = a.length-1; i >= 0; i--)1285 res = sc_cons(a[i], res);1286 return res;1287}1288/*** META ((export list->vector list->array)) */1289function sc_list2vector(l) {1290 var a = new sc_Vector();1291 while(l !== null) {1292 a.push(l.car);1293 l = l.cdr;1294 }1295 return a;1296}1297/*** META ((export vector-fill! array-fill!)) */1298function sc_vectorFillBang(a, fill) {1299 for (var i = 0; i < a.length; i++)1300 a[i] = fill;1301}1302/*** META ((export #t)) */1303function sc_copyVector(a, len) {1304 if (len <= a.length)1305 return a.slice(0, len);1306 else {1307 var tmp = a.concat();1308 tmp.length = len;1309 return tmp;1310 }1311}1312/*** META ((export #t)1313 (peephole (hole 3 a ".slice(" start "," end ")")))1314*/1315function sc_vectorCopy(a, start, end) {1316 return a.slice(start, end);1317}1318/*** META ((export #t)) */1319function sc_vectorCopyBang(target, tstart, source, sstart, send) {1320 if (!sstart) sstart = 0;1321 if (!send) send = source.length;1322 // if target == source we don't want to overwrite not yet copied elements.1323 if (tstart <= sstart) {1324 for (var i = tstart, j = sstart; j < send; i++, j++) {1325 target[i] = source[j];1326 }1327 } else {1328 var diff = send - sstart;1329 for (var i = tstart + diff - 1, j = send - 1;1330 j >= sstart;1331 i--, j--) {1332 target[i] = source[j];1333 }1334 }1335 return target;1336}1337/*** META ((export #t)1338 (type bool)1339 (peephole (hole 1 "typeof " o " === 'function'")))1340*/1341function sc_isProcedure(o) {1342 return (typeof o === "function");1343}1344/*** META ((export #t)) */1345function sc_apply(proc) {1346 var args = new Array();1347 // first part of arguments are not in list-form.1348 for (var i = 1; i < arguments.length - 1; i++)1349 args.push(arguments[i]);1350 var l = arguments[arguments.length - 1];1351 while (l !== null) {1352 args.push(l.car);1353 l = l.cdr;1354 }1355 return proc.apply(null, args);1356}1357/*** META ((export #t)) */1358function sc_map(proc, l1) {1359 if (l1 === undefined)1360 return null;1361 // else1362 var nbApplyArgs = arguments.length - 1;1363 var applyArgs = new Array(nbApplyArgs);1364 var revres = null;1365 while (l1 !== null) {1366 for (var i = 0; i < nbApplyArgs; i++) {1367 applyArgs[i] = arguments[i + 1].car;1368 arguments[i + 1] = arguments[i + 1].cdr;1369 }1370 revres = sc_cons(proc.apply(null, applyArgs), revres);1371 }1372 return sc_reverseAppendBang(revres, null);1373}1374/*** META ((export #t)) */1375function sc_mapBang(proc, l1) {1376 if (l1 === undefined)1377 return null;1378 // else1379 var l1_orig = l1;1380 var nbApplyArgs = arguments.length - 1;1381 var applyArgs = new Array(nbApplyArgs);1382 while (l1 !== null) {1383 var tmp = l1;1384 for (var i = 0; i < nbApplyArgs; i++) {1385 applyArgs[i] = arguments[i + 1].car;1386 arguments[i + 1] = arguments[i + 1].cdr;1387 }1388 tmp.car = proc.apply(null, applyArgs);1389 }1390 return l1_orig;1391}1392/*** META ((export #t)) */1393function sc_forEach(proc, l1) {1394 if (l1 === undefined)1395 return undefined;1396 // else1397 var nbApplyArgs = arguments.length - 1;1398 var applyArgs = new Array(nbApplyArgs);1399 while (l1 !== null) {1400 for (var i = 0; i < nbApplyArgs; i++) {1401 applyArgs[i] = arguments[i + 1].car;1402 arguments[i + 1] = arguments[i + 1].cdr;1403 }1404 proc.apply(null, applyArgs);1405 }1406 // add return so FF does not complain.1407 return undefined;1408}1409/*** META ((export #t)) */1410function sc_filter(proc, l1) {1411 var dummy = { cdr : null };1412 var tail = dummy;1413 while (l1 !== null) {1414 if (proc(l1.car) !== false) {1415 tail.cdr = sc_cons(l1.car, null);1416 tail = tail.cdr;1417 }1418 l1 = l1.cdr;1419 }1420 return dummy.cdr;1421}1422/*** META ((export #t)) */1423function sc_filterBang(proc, l1) {1424 var head = sc_cons("dummy", l1);1425 var it = head;1426 var next = l1;1427 while (next !== null) {1428 if (proc(next.car) !== false) {1429 it.cdr = next1430 it = next;1431 }1432 next = next.cdr;1433 }1434 it.cdr = null;1435 return head.cdr;1436}1437function sc_filterMap1(proc, l1) {1438 var revres = null;1439 while (l1 !== null) {1440 var tmp = proc(l1.car)1441 if (tmp !== false) revres = sc_cons(tmp, revres);1442 l1 = l1.cdr;1443 }1444 return sc_reverseAppendBang(revres, null);1445}1446function sc_filterMap2(proc, l1, l2) {1447 var revres = null;1448 while (l1 !== null) {1449 var tmp = proc(l1.car, l2.car);1450 if(tmp !== false) revres = sc_cons(tmp, revres);1451 l1 = l1.cdr;1452 l2 = l2.cdr1453 }1454 return sc_reverseAppendBang(revres, null);1455}1456/*** META ((export #t)) */1457function sc_filterMap(proc, l1, l2, l3) {1458 if (l2 === undefined)1459 return sc_filterMap1(proc, l1);1460 else if (l3 === undefined)1461 return sc_filterMap2(proc, l1, l2);1462 // else1463 var nbApplyArgs = arguments.length - 1;1464 var applyArgs = new Array(nbApplyArgs);1465 var revres = null;1466 while (l1 !== null) {1467 for (var i = 0; i < nbApplyArgs; i++) {1468 applyArgs[i] = arguments[i + 1].car;1469 arguments[i + 1] = arguments[i + 1].cdr;1470 }1471 var tmp = proc.apply(null, applyArgs);1472 if(tmp !== false) revres = sc_cons(tmp, revres);1473 }1474 return sc_reverseAppendBang(revres, null);1475}1476/*** META ((export #t)) */1477function sc_any(proc, l) {1478 var revres = null;1479 while (l !== null) {1480 var tmp = proc(l.car);1481 if(tmp !== false) return tmp;1482 l = l.cdr;1483 }1484 return false;1485}1486/*** META ((export any?)1487 (peephole (hole 2 "sc_any(" proc "," l ") !== false")))1488*/1489function sc_anyPred(proc, l) {1490 return sc_any(proc, l)!== false;1491}1492/*** META ((export #t)) */1493function sc_every(proc, l) {1494 var revres = null;1495 var tmp = true;1496 while (l !== null) {1497 tmp = proc(l.car);1498 if (tmp === false) return false;1499 l = l.cdr;1500 }1501 return tmp;1502}1503/*** META ((export every?)1504 (peephole (hole 2 "sc_every(" proc "," l ") !== false")))1505*/1506function sc_everyPred(proc, l) {1507 var tmp = sc_every(proc, l);1508 if (tmp !== false) return true;1509 return false;1510}1511/*** META ((export #t)1512 (peephole (postfix "()")))1513*/1514function sc_force(o) {1515 return o();1516}1517/*** META ((export #t)) */1518function sc_makePromise(proc) {1519 var isResultReady = false;1520 var result = undefined;1521 return function() {1522 if (!isResultReady) {1523 var tmp = proc();1524 if (!isResultReady) {1525 isResultReady = true;1526 result = tmp;1527 }1528 }1529 return result;1530 };1531}1532function sc_Values(values) {1533 this.values = values;1534}1535/*** META ((export #t)1536 (peephole (values)))1537*/1538function sc_values() {1539 if (arguments.length === 1)1540 return arguments[0];1541 else1542 return new sc_Values(arguments);1543}1544/*** META ((export #t)) */1545function sc_callWithValues(producer, consumer) {1546 var produced = producer();1547 if (produced instanceof sc_Values)1548 return consumer.apply(null, produced.values);1549 else1550 return consumer(produced);1551}1552/*** META ((export #t)) */1553function sc_dynamicWind(before, thunk, after) {1554 before();1555 try {1556 var res = thunk();1557 return res;1558 } finally {1559 after();1560 }1561}1562// TODO: eval/scheme-report-environment/null-environment/interaction-environment1563// LIMITATION: 'load' doesn't exist without files.1564// LIMITATION: transcript-on/transcript-off doesn't exist without files.1565function sc_Struct(name) {1566 this.name = name;1567}1568sc_Struct.prototype.sc_toDisplayString = function() {1569 return "#<struct" + sc_hash(this) + ">";1570};1571sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString;1572/*** META ((export #t)1573 (peephole (hole 1 "new sc_Struct(" name ")")))1574*/1575function sc_makeStruct(name) {1576 return new sc_Struct(name);1577}1578/*** META ((export #t)1579 (type bool)1580 (peephole (postfix " instanceof sc_Struct")))1581*/1582function sc_isStruct(o) {1583 return (o instanceof sc_Struct);1584}1585/*** META ((export #t)1586 (type bool)1587 (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")")))1588*/1589function sc_isStructNamed(name, s) {1590 return ((s instanceof sc_Struct) && (s.name === name));1591}1592/*** META ((export struct-field)1593 (peephole (hole 3 0 "[" 2 "]")))1594*/1595function sc_getStructField(s, name, field) {1596 return s[field];1597}1598/*** META ((export struct-field-set!)1599 (peephole (hole 4 0 "[" 2 "] = " 3)))1600*/1601function sc_setStructFieldBang(s, name, field, val) {1602 s[field] = val;1603}1604/*** META ((export #t)1605 (peephole (prefix "~")))1606*/1607function sc_bitNot(x) {1608 return ~x;1609}1610/*** META ((export #t)1611 (peephole (infix 2 2 "&")))1612*/1613function sc_bitAnd(x, y) {1614 return x & y;1615}1616/*** META ((export #t)1617 (peephole (infix 2 2 "|")))1618*/1619function sc_bitOr(x, y) {1620 return x | y;1621}1622/*** META ((export #t)1623 (peephole (infix 2 2 "^")))1624*/1625function sc_bitXor(x, y) {1626 return x ^ y;1627}1628/*** META ((export #t)1629 (peephole (infix 2 2 "<<")))1630*/1631function sc_bitLsh(x, y) {1632 return x << y;1633}1634/*** META ((export #t)1635 (peephole (infix 2 2 ">>")))1636*/1637function sc_bitRsh(x, y) {1638 return x >> y;1639}1640/*** META ((export #t)1641 (peephole (infix 2 2 ">>>")))1642*/1643function sc_bitUrsh(x, y) {1644 return x >>> y;1645}1646/*** META ((export js-field js-property)1647 (peephole (hole 2 o "[" field "]")))1648*/1649function sc_jsField(o, field) {1650 return o[field];1651}1652/*** META ((export js-field-set! js-property-set!)1653 (peephole (hole 3 o "[" field "] = " val)))1654*/1655function sc_setJsFieldBang(o, field, val) {1656 return o[field] = val;1657}1658/*** META ((export js-field-delete! js-property-delete!)1659 (peephole (hole 2 "delete" o "[" field "]")))1660*/1661function sc_deleteJsFieldBang(o, field) {1662 delete o[field];1663}1664/*** META ((export #t)1665 (peephole (jsCall)))1666*/1667function sc_jsCall(o, fun) {1668 var args = new Array();1669 for (var i = 2; i < arguments.length; i++)1670 args[i-2] = arguments[i];1671 return fun.apply(o, args);1672}1673/*** META ((export #t)1674 (peephole (jsMethodCall)))1675*/1676function sc_jsMethodCall(o, field) {1677 var args = new Array();1678 for (var i = 2; i < arguments.length; i++)1679 args[i-2] = arguments[i];1680 return o[field].apply(o, args);1681}1682/*** META ((export new js-new)1683 (peephole (jsNew)))1684*/1685function sc_jsNew(c) {1686 var evalStr = "new c(";1687 evalStr +=arguments.length > 1? "arguments[1]": "";1688 for (var i = 2; i < arguments.length; i++)1689 evalStr += ", arguments[" + i + "]";1690 evalStr +=")";1691 return eval(evalStr);1692}1693// ======================== RegExp ====================1694/*** META ((export #t)) */1695function sc_pregexp(re) {1696 return new RegExp(sc_string2jsstring(re));1697}1698/*** META ((export #t)) */1699function sc_pregexpMatch(re, s) {1700 var reg = (re instanceof RegExp) ? re : sc_pregexp(re);1701 var tmp = reg.exec(sc_string2jsstring(s));1702 if (tmp == null) return false;1703 var res = null;1704 for (var i = tmp.length-1; i >= 0; i--) {1705 if (tmp[i] !== null) {1706 res = sc_cons(sc_jsstring2string(tmp[i]), res);1707 } else {1708 res = sc_cons(false, res);1709 }1710 }1711 return res;1712}1713/*** META ((export #t)) */1714function sc_pregexpReplace(re, s1, s2) {1715 var reg;1716 var jss1 = sc_string2jsstring(s1);1717 var jss2 = sc_string2jsstring(s2);1718 if (re instanceof RegExp) {1719 if (re.global)1720 reg = re;1721 else1722 reg = new RegExp(re.source);1723 } else {1724 reg = new RegExp(sc_string2jsstring(re));1725 }1726 return jss1.replace(reg, jss2);1727}1728/*** META ((export pregexp-replace*)) */1729function sc_pregexpReplaceAll(re, s1, s2) {1730 var reg;1731 var jss1 = sc_string2jsstring(s1);1732 var jss2 = sc_string2jsstring(s2);1733 if (re instanceof RegExp) {1734 if (re.global)1735 reg = re;1736 else1737 reg = new RegExp(re.source, "g");1738 } else {1739 reg = new RegExp(sc_string2jsstring(re), "g");1740 }1741 return jss1.replace(reg, jss2);1742}1743/*** META ((export #t)) */1744function sc_pregexpSplit(re, s) {1745 var reg = ((re instanceof RegExp) ?1746 re :1747 new RegExp(sc_string2jsstring(re)));1748 var jss = sc_string2jsstring(s);1749 var tmp = jss.split(reg);1750 if (tmp == null) return false;1751 return sc_vector2list(tmp);1752}1753/* =========================================================================== */1754/* Other library stuff */1755/* =========================================================================== */1756/*** META ((export #t)1757 (peephole (hole 1 "Math.floor(Math.random()*" 'n ")")))1758*/1759function sc_random(n) {1760 return Math.floor(Math.random()*n);1761}1762/*** META ((export current-date)1763 (peephole (hole 0 "new Date()")))1764*/1765function sc_currentDate() {1766 return new Date();1767}1768function sc_Hashtable() {1769}1770sc_Hashtable.prototype.toString = function() {1771 return "#{%hashtable}";1772};1773// sc_toWriteString == sc_toDisplayString == toString1774function sc_HashtableElement(key, val) {1775 this.key = key;1776 this.val = val;1777}1778/*** META ((export #t)1779 (peephole (hole 0 "new sc_Hashtable()")))1780*/1781function sc_makeHashtable() {1782 return new sc_Hashtable();1783}1784/*** META ((export #t)) */1785function sc_hashtablePutBang(ht, key, val) {1786 var hash = sc_hash(key);1787 ht[hash] = new sc_HashtableElement(key, val);1788}1789/*** META ((export #t)) */1790function sc_hashtableGet(ht, key) {1791 var hash = sc_hash(key);1792 if (hash in ht)1793 return ht[hash].val;1794 else1795 return false;1796}1797/*** META ((export #t)) */1798function sc_hashtableForEach(ht, f) {1799 for (var v in ht) {1800 if (ht[v] instanceof sc_HashtableElement)1801 f(ht[v].key, ht[v].val);1802 }1803}1804/*** META ((export hashtable-contains?)1805 (peephole (hole 2 "sc_hash(" 1 ") in " 0)))1806*/1807function sc_hashtableContains(ht, key) {1808 var hash = sc_hash(key);1809 if (hash in ht)1810 return true;1811 else1812 return false;1813}1814var SC_HASH_COUNTER = 0;1815function sc_hash(o) {1816 if (o === null)1817 return "null";1818 else if (o === undefined)1819 return "undefined";1820 else if (o === true)1821 return "true";1822 else if (o === false)1823 return "false";1824 else if (typeof o === "number")1825 return "num-" + o;1826 else if (typeof o === "string")1827 return "jsstr-" + o;1828 else if (o.sc_getHash)1829 return o.sc_getHash();1830 else1831 return sc_counterHash.call(o);1832}1833function sc_counterHash() {1834 if (!this.sc_hash) {1835 this.sc_hash = "hash-" + SC_HASH_COUNTER;1836 SC_HASH_COUNTER++;1837 }1838 return this.sc_hash;1839}1840function sc_Trampoline(args, maxTailCalls) {1841 this['__trampoline return__'] = true;1842 this.args = args;1843 this.MAX_TAIL_CALLs = maxTailCalls;1844}1845// TODO: call/cc stuff1846sc_Trampoline.prototype.restart = function() {1847 var o = this;1848 while (true) {1849 // set both globals.1850 SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1;1851 var fun = o.args.callee;1852 var res = fun.apply(SC_TAIL_OBJECT, o.args);1853 if (res instanceof sc_Trampoline)1854 o = res;1855 else1856 return res;1857 }1858}1859/*** META ((export bind-exit-lambda)) */1860function sc_bindExitLambda(proc) {1861 var escape_obj = new sc_BindExitException();1862 var escape = function(res) {1863 escape_obj.res = res;1864 throw escape_obj;1865 };1866 try {1867 return proc(escape);1868 } catch(e) {1869 if (e === escape_obj) {1870 return e.res;1871 }1872 throw e;1873 }1874}1875function sc_BindExitException() {1876 this._internalException = true;1877}1878var SC_SCM2JS_GLOBALS = new Object();1879// default tail-call depth.1880// normally the program should set it again. but just in case...1881var SC_TAIL_OBJECT = new Object();1882SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT;1883// ======================== I/O =======================1884/*------------------------------------------------------------------*/1885function sc_EOF() {1886}1887var SC_EOF_OBJECT = new sc_EOF();1888function sc_Port() {1889}1890/* --------------- Input ports -------------------------------------*/1891function sc_InputPort() {1892}1893sc_InputPort.prototype = new sc_Port();1894sc_InputPort.prototype.peekChar = function() {1895 if (!("peeked" in this))1896 this.peeked = this.getNextChar();1897 return this.peeked;1898}1899sc_InputPort.prototype.readChar = function() {1900 var tmp = this.peekChar();1901 delete this.peeked;1902 return tmp;1903}1904sc_InputPort.prototype.isCharReady = function() {1905 return true;1906}1907sc_InputPort.prototype.close = function() {1908 // do nothing1909}1910/* .............. String port ..........................*/1911function sc_ErrorInputPort() {1912};1913sc_ErrorInputPort.prototype = new sc_InputPort();1914sc_ErrorInputPort.prototype.getNextChar = function() {1915 throw "can't read from error-port.";1916};1917sc_ErrorInputPort.prototype.isCharReady = function() {1918 return false;1919};1920/* .............. String port ..........................*/1921function sc_StringInputPort(jsStr) {1922 // we are going to do some charAts on the str.1923 // instead of recreating all the time a String-object, we1924 // create one in the beginning. (not sure, if this is really an optim)1925 this.str = new String(jsStr);1926 this.pos = 0;1927}1928sc_StringInputPort.prototype = new sc_InputPort();1929sc_StringInputPort.prototype.getNextChar = function() {1930 if (this.pos >= this.str.length)1931 return SC_EOF_OBJECT;1932 return this.str.charAt(this.pos++);1933};1934/* ------------- Read and other lib-funs -------------------------------*/1935function sc_Token(type, val, pos) {1936 this.type = type;1937 this.val = val;1938 this.pos = pos;1939}1940sc_Token.EOF = 0/*EOF*/;1941sc_Token.OPEN_PAR = 1/*OPEN_PAR*/;1942sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/;1943sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/;1944sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/;1945sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/;1946sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/;1947sc_Token.WHITESPACE = 7/*WHITESPACE*/;1948sc_Token.QUOTE = 8/*QUOTE*/;1949sc_Token.ID = 9/*ID*/;1950sc_Token.DOT = 10/*DOT*/;1951sc_Token.STRING = 11/*STRING*/;1952sc_Token.NUMBER = 12/*NUMBER*/;1953sc_Token.ERROR = 13/*ERROR*/;1954sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/;1955sc_Token.TRUE = 15/*TRUE*/;1956sc_Token.FALSE = 16/*FALSE*/;1957sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/;1958sc_Token.REFERENCE = 18/*REFERENCE*/;1959sc_Token.STORE = 19/*STORE*/;1960sc_Token.CHAR = 20/*CHAR*/;1961var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~";1962function sc_Tokenizer(port) {1963 this.port = port;1964}1965sc_Tokenizer.prototype.peekToken = function() {1966 if (this.peeked)1967 return this.peeked;1968 var newToken = this.nextToken();1969 this.peeked = newToken;1970 return newToken;1971};1972sc_Tokenizer.prototype.readToken = function() {1973 var tmp = this.peekToken();1974 delete this.peeked;1975 return tmp;1976};1977sc_Tokenizer.prototype.nextToken = function() {1978 var port = this.port;1979 function isNumberChar(c) {1980 return (c >= "0" && c <= "9");1981 };1982 function isIdOrNumberChar(c) {1983 return SC_ID_CLASS.indexOf(c) != -1 || // ID-char1984 (c >= "0" && c <= "9");1985 }1986 function isWhitespace(c) {1987 return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f";1988 };1989 function isWhitespaceOrEOF(c) {1990 return isWhitespace(c) || c === SC_EOF_OBJECT;1991 };1992 function readString() {1993 res = "";1994 while (true) {1995 var c = port.readChar();1996 switch (c) {1997 case '"':1998 return new sc_Token(11/*STRING*/, res);1999 case "\\":2000 var tmp = port.readChar();2001 switch (tmp) {2002 case '0': res += "\0"; break;2003 case 'a': res += "\a"; break;2004 case 'b': res += "\b"; break;2005 case 'f': res += "\f"; break;2006 case 'n': res += "\n"; break;2007 case 'r': res += "\r"; break;2008 case 't': res += "\t"; break;2009 case 'v': res += "\v"; break;2010 case '"': res += '"'; break;2011 case '\\': res += '\\'; break;2012 case 'x':2013 /* hexa-number */2014 var nb = 0;2015 while (true) {2016 var hexC = port.peekChar();2017 if (hexC >= '0' && hexC <= '9') {2018 port.readChar();2019 nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0);2020 } else if (hexC >= 'a' && hexC <= 'f') {2021 port.readChar();2022 nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0);2023 } else if (hexC >= 'A' && hexC <= 'F') {2024 port.readChar();2025 nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0);2026 } else {2027 // next char isn't part of hex.2028 res += String.fromCharCode(nb);2029 break;2030 }2031 }2032 break;2033 default:2034 if (tmp === SC_EOF_OBJECT) {2035 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res);2036 }2037 res += tmp;2038 }2039 break;2040 default:2041 if (c === SC_EOF_OBJECT) {2042 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res);2043 }2044 res += c;2045 }2046 }2047 };2048 function readIdOrNumber(firstChar) {2049 var res = firstChar;2050 while (isIdOrNumberChar(port.peekChar()))2051 res += port.readChar();2052 if (isNaN(res))2053 return new sc_Token(9/*ID*/, res);2054 else2055 return new sc_Token(12/*NUMBER*/, res - 0);2056 };2057 function skipWhitespaceAndComments() {2058 var done = false;2059 while (!done) {2060 done = true;2061 while (isWhitespace(port.peekChar()))2062 port.readChar();2063 if (port.peekChar() === ';') {2064 port.readChar();2065 done = false;2066 while (true) {2067 curChar = port.readChar();2068 if (curChar === SC_EOF_OBJECT ||2069 curChar === '\n')2070 break;2071 }2072 }2073 }2074 };2075 function readDot() {2076 if (isWhitespace(port.peekChar()))2077 return new sc_Token(10/*DOT*/);2078 else2079 return readIdOrNumber(".");2080 };2081 function readSharp() {2082 var c = port.readChar();2083 if (isWhitespace(c))2084 return new sc_Token(13/*ERROR*/, "bad #-pattern0.");2085 // reference2086 if (isNumberChar(c)) {2087 var nb = c - 0;2088 while (isNumberChar(port.peekChar()))2089 nb = nb*10 + (port.readChar() - 0);2090 switch (port.readChar()) {2091 case '#':2092 return new sc_Token(18/*REFERENCE*/, nb);2093 case '=':2094 return new sc_Token(19/*STORE*/, nb);2095 default:2096 return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb);2097 }2098 }2099 if (c === "(")2100 return new sc_Token(14/*VECTOR_BEGIN*/);2101 2102 if (c === "\\") { // character2103 var tmp = ""2104 while (!isWhitespaceOrEOF(port.peekChar()))2105 tmp += port.readChar();2106 switch (tmp.length) {2107 case 0: // it's escaping a whitespace char:2108 if (sc_isEOFObject(port.peekChar))2109 return new sc_Token(13/*ERROR*/, "bad #-pattern2.");2110 else2111 return new sc_Token(20/*CHAR*/, port.readChar());2112 case 1:2113 return new sc_Token(20/*CHAR*/, tmp);2114 default:2115 var entry = sc_Char.readable2char[tmp.toLowerCase()];2116 if (entry)2117 return new sc_Token(20/*CHAR*/, entry);2118 else2119 return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp);2120 }2121 }2122 // some constants (#t, #f, #unspecified)2123 var res;2124 var needing;2125 switch (c) {2126 case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break;2127 case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break;2128 case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break;2129 default:2130 return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c);2131 }2132 while(true) {2133 c = port.peekChar();2134 if ((isWhitespaceOrEOF(c) || c === ')') &&2135 needing == "")2136 return res;2137 else if (isWhitespace(c) || needing == "")2138 return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing);2139 else if (needing.charAt(0) == c) {2140 port.readChar(); // consume2141 needing = needing.slice(1);2142 } else2143 return new sc_Token(13/*ERROR*/, "bad #-pattern5");2144 }2145 2146 };2147 skipWhitespaceAndComments();2148 var curChar = port.readChar();2149 if (curChar === SC_EOF_OBJECT)2150 return new sc_Token(0/*EOF*/, curChar);2151 switch (curChar)2152 {2153 case " ":2154 case "\n":2155 case "\t":2156 return readWhitespace();2157 case "(":2158 return new sc_Token(1/*OPEN_PAR*/);2159 case ")":2160 return new sc_Token(2/*CLOSE_PAR*/);2161 case "{":2162 return new sc_Token(3/*OPEN_BRACE*/);2163 case "}":2164 return new sc_Token(4/*CLOSE_BRACE*/);2165 case "[":2166 return new sc_Token(5/*OPEN_BRACKET*/);2167 case "]":2168 return new sc_Token(6/*CLOSE_BRACKET*/);2169 case "'":2170 return new sc_Token(8/*QUOTE*/);2171 case "#":2172 return readSharp();2173 case ".":2174 return readDot();2175 case '"':2176 return readString();2177 default:2178 if (isIdOrNumberChar(curChar))2179 return readIdOrNumber(curChar);2180 throw "unexpected character: " + curChar;2181 }2182};2183function sc_Reader(tokenizer) {2184 this.tokenizer = tokenizer;2185 this.backref = new Array();2186}2187sc_Reader.prototype.read = function() {2188 function readList(listBeginType) {2189 function matchesPeer(open, close) {2190 return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/2191 || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/2192 || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/;2193 };2194 var res = null;2195 while (true) {2196 var token = tokenizer.peekToken();2197 switch (token.type) {2198 case 2/*CLOSE_PAR*/:2199 case 4/*CLOSE_BRACE*/:2200 case 6/*CLOSE_BRACKET*/:2201 if (matchesPeer(listBeginType, token.type)) {2202 tokenizer.readToken(); // consume token2203 return sc_reverseBang(res);2204 } else2205 throw "closing par doesn't match: " + listBeginType2206 + " " + listEndType;2207 case 0/*EOF*/:2208 throw "unexpected end of file";2209 case 10/*DOT*/:2210 tokenizer.readToken(); // consume token2211 var cdr = this.read();2212 var par = tokenizer.readToken();2213 if (!matchesPeer(listBeginType, par.type))2214 throw "closing par doesn't match: " + listBeginType2215 + " " + par.type;2216 else2217 return sc_reverseAppendBang(res, cdr);2218 2219 default:2220 res = sc_cons(this.read(), res);2221 }2222 }2223 };2224 function readQuote() {2225 return sc_cons("quote", sc_cons(this.read(), null));2226 };2227 function readVector() {2228 // opening-parenthesis is already consumed2229 var a = new Array();2230 while (true) {2231 var token = tokenizer.peekToken();2232 switch (token.type) {2233 case 2/*CLOSE_PAR*/:2234 tokenizer.readToken();2235 return a;2236 2237 default:2238 a.push(this.read());2239 }2240 }2241 };2242 function storeRefence(nb) {2243 var tmp = this.read();2244 this.backref[nb] = tmp;2245 return tmp;2246 };2247 2248 function readReference(nb) {2249 if (nb in this.backref)2250 return this.backref[nb];2251 else2252 throw "bad reference: " + nb;2253 };2254 var tokenizer = this.tokenizer;2255 var token = tokenizer.readToken();2256 // handle error2257 if (token.type === 13/*ERROR*/)2258 throw token.val;2259 switch (token.type) {2260 case 1/*OPEN_PAR*/:2261 case 3/*OPEN_BRACE*/:2262 case 5/*OPEN_BRACKET*/:2263 return readList.call(this, token.type);2264 case 8/*QUOTE*/:2265 return readQuote.call(this);2266 case 11/*STRING*/:2267 return sc_jsstring2string(token.val);2268 case 20/*CHAR*/:2269 return new sc_Char(token.val);2270 case 14/*VECTOR_BEGIN*/:2271 return readVector.call(this);2272 case 18/*REFERENCE*/:2273 return readReference.call(this, token.val);2274 case 19/*STORE*/:2275 return storeRefence.call(this, token.val);2276 case 9/*ID*/:2277 return sc_jsstring2symbol(token.val);2278 case 0/*EOF*/:2279 case 12/*NUMBER*/:2280 case 15/*TRUE*/:2281 case 16/*FALSE*/:2282 case 17/*UNSPECIFIED*/:2283 return token.val;2284 default:2285 throw "unexpected token " + token.type + " " + token.val;2286 }2287};2288/*** META ((export #t)) */2289function sc_read(port) {2290 if (port === undefined) // we assume the port hasn't been given.2291 port = SC_DEFAULT_IN; // THREAD: shared var...2292 var reader = new sc_Reader(new sc_Tokenizer(port));2293 return reader.read();2294}2295/*** META ((export #t)) */2296function sc_readChar(port) {2297 if (port === undefined) // we assume the port hasn't been given.2298 port = SC_DEFAULT_IN; // THREAD: shared var...2299 var t = port.readChar();2300 return t === SC_EOF_OBJECT? t: new sc_Char(t);2301}2302/*** META ((export #t)) */2303function sc_peekChar(port) {2304 if (port === undefined) // we assume the port hasn't been given.2305 port = SC_DEFAULT_IN; // THREAD: shared var...2306 var t = port.peekChar();2307 return t === SC_EOF_OBJECT? t: new sc_Char(t);2308}2309/*** META ((export #t)2310 (type bool))2311*/2312function sc_isCharReady(port) {2313 if (port === undefined) // we assume the port hasn't been given.2314 port = SC_DEFAULT_IN; // THREAD: shared var...2315 return port.isCharReady();2316}2317/*** META ((export #t)2318 (peephole (postfix ".close()")))2319*/2320function sc_closeInputPort(p) {2321 return p.close();2322}2323/*** META ((export #t)2324 (type bool)2325 (peephole (postfix " instanceof sc_InputPort")))2326*/2327function sc_isInputPort(o) {2328 return (o instanceof sc_InputPort);2329}2330/*** META ((export eof-object?)2331 (type bool)2332 (peephole (postfix " === SC_EOF_OBJECT")))2333*/2334function sc_isEOFObject(o) {2335 return o === SC_EOF_OBJECT;2336}2337/*** META ((export #t)2338 (peephole (hole 0 "SC_DEFAULT_IN")))2339*/2340function sc_currentInputPort() {2341 return SC_DEFAULT_IN;2342}2343/* ------------ file operations are not supported -----------*/2344/*** META ((export #t)) */2345function sc_callWithInputFile(s, proc) {2346 throw "can't open " + s;2347}2348/*** META ((export #t)) */2349function sc_callWithOutputFile(s, proc) {2350 throw "can't open " + s;2351}2352/*** META ((export #t)) */2353function sc_withInputFromFile(s, thunk) {2354 throw "can't open " + s;2355}2356/*** META ((export #t)) */2357function sc_withOutputToFile(s, thunk) {2358 throw "can't open " + s;2359}2360/*** META ((export #t)) */2361function sc_openInputFile(s) {2362 throw "can't open " + s;2363}2364/*** META ((export #t)) */2365function sc_openOutputFile(s) {2366 throw "can't open " + s;2367}2368/* ----------------------------------------------------------------------------*/2369/*** META ((export #t)) */2370function sc_basename(p) {2371 var i = p.lastIndexOf('/');2372 if(i >= 0)2373 return p.substring(i + 1, p.length);2374 else2375 return '';2376}2377/*** META ((export #t)) */2378function sc_dirname(p) {2379 var i = p.lastIndexOf('/');2380 if(i >= 0)2381 return p.substring(0, i);2382 else2383 return '';2384}2385/* ----------------------------------------------------------------------------*/2386/*** META ((export #t)) */2387function sc_withInputFromPort(p, thunk) {2388 try {2389 var tmp = SC_DEFAULT_IN; // THREAD: shared var.2390 SC_DEFAULT_IN = p;2391 return thunk();2392 } finally {2393 SC_DEFAULT_IN = tmp;2394 }2395}2396/*** META ((export #t)) */2397function sc_withInputFromString(s, thunk) {2398 return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk);2399}2400/*** META ((export #t)) */2401function sc_withOutputToPort(p, thunk) {2402 try {2403 var tmp = SC_DEFAULT_OUT; // THREAD: shared var.2404 SC_DEFAULT_OUT = p;2405 return thunk();2406 } finally {2407 SC_DEFAULT_OUT = tmp;2408 }2409}2410/*** META ((export #t)) */2411function sc_withOutputToString(thunk) {2412 var p = new sc_StringOutputPort();2413 sc_withOutputToPort(p, thunk);2414 return p.close();2415}2416/*** META ((export #t)) */2417function sc_withOutputToProcedure(proc, thunk) {2418 var t = function(s) { proc(sc_jsstring2string(s)); };2419 return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk);2420}2421/*** META ((export #t)2422 (peephole (hole 0 "new sc_StringOutputPort()")))2423*/2424function sc_openOutputString() {2425 return new sc_StringOutputPort();2426}2427/*** META ((export #t)) */2428function sc_openInputString(str) {2429 return new sc_StringInputPort(sc_string2jsstring(str));2430}2431/* ----------------------------------------------------------------------------*/2432function sc_OutputPort() {2433}2434sc_OutputPort.prototype = new sc_Port();2435sc_OutputPort.prototype.appendJSString = function(obj) {2436 /* do nothing */2437}2438sc_OutputPort.prototype.close = function() {2439 /* do nothing */2440}2441function sc_StringOutputPort() {2442 this.res = "";2443}2444sc_StringOutputPort.prototype = new sc_OutputPort();2445sc_StringOutputPort.prototype.appendJSString = function(s) {2446 this.res += s;2447}2448sc_StringOutputPort.prototype.close = function() {2449 return sc_jsstring2string(this.res);2450}2451/*** META ((export #t)) */2452function sc_getOutputString(sp) {2453 return sc_jsstring2string(sp.res);2454}2455function sc_ErrorOutputPort() {2456}2457sc_ErrorOutputPort.prototype = new sc_OutputPort();2458sc_ErrorOutputPort.prototype.appendJSString = function(s) {2459 throw "don't write on ErrorPort!";2460}2461sc_ErrorOutputPort.prototype.close = function() {2462 /* do nothing */2463}2464function sc_GenericOutputPort(appendJSString, close) {2465 this.appendJSString = appendJSString;2466 if (close)2467 this.close = close;2468}2469sc_GenericOutputPort.prototype = new sc_OutputPort();2470/*** META ((export #t)2471 (type bool)2472 (peephole (postfix " instanceof sc_OutputPort")))2473*/2474function sc_isOutputPort(o) {2475 return (o instanceof sc_OutputPort);2476}2477/*** META ((export #t)2478 (peephole (postfix ".close()")))2479*/2480function sc_closeOutputPort(p) {2481 return p.close();2482}2483/* ------------------ write ---------------------------------------------------*/2484/*** META ((export #t)) */2485function sc_write(o, p) {2486 if (p === undefined) // we assume not given2487 p = SC_DEFAULT_OUT;2488 p.appendJSString(sc_toWriteString(o));2489}2490function sc_toWriteString(o) {2491 if (o === null)2492 return "()";2493 else if (o === true)2494 return "#t";2495 else if (o === false)2496 return "#f";2497 else if (o === undefined)2498 return "#unspecified";2499 else if (typeof o === 'function')2500 return "#<procedure " + sc_hash(o) + ">";2501 else if (o.sc_toWriteString)2502 return o.sc_toWriteString();2503 else2504 return o.toString();2505}2506function sc_escapeWriteString(s) {2507 var res = "";2508 var j = 0;2509 for (i = 0; i < s.length; i++) {2510 switch (s.charAt(i)) {2511 case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break;2512 case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break;2513 case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break;2514 case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break;2515 case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break;2516 case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break;2517 case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break;2518 case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break;2519 case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break;2520 default:2521 var c = s.charAt(i);2522 if ("\a" !== "a" && c == "\a") {2523 res += s.substring(j, i) + "\\a"; j = i + 1; continue;2524 }2525 if ("\v" !== "v" && c == "\v") {2526 res += s.substring(j, i) + "\\v"; j = i + 1; continue;2527 }2528 //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) {2529 // CARE: Manuel is this OK with HOP?2530 if (s.charAt(i) < ' ') {2531 /* non printable character and special chars */2532 res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16);2533 j = i + 1;2534 }2535 // else just let i increase...2536 }2537 }2538 res += s.substring(j, i);2539 return res;2540}2541/* ------------------ display ---------------------------------------------------*/2542/*** META ((export #t)) */2543function sc_display(o, p) {2544 if (p === undefined) // we assume not given2545 p = SC_DEFAULT_OUT;2546 p.appendJSString(sc_toDisplayString(o));2547}2548function sc_toDisplayString(o) {2549 if (o === null)2550 return "()";2551 else if (o === true)2552 return "#t";2553 else if (o === false)2554 return "#f";2555 else if (o === undefined)2556 return "#unspecified";2557 else if (typeof o === 'function')2558 return "#<procedure " + sc_hash(o) + ">";2559 else if (o.sc_toDisplayString)2560 return o.sc_toDisplayString();2561 else2562 return o.toString();2563}2564/* ------------------ newline ---------------------------------------------------*/2565/*** META ((export #t)) */2566function sc_newline(p) {2567 if (p === undefined) // we assume not given2568 p = SC_DEFAULT_OUT;2569 p.appendJSString("\n");2570}2571/* ------------------ write-char ---------------------------------------------------*/2572/*** META ((export #t)) */2573function sc_writeChar(c, p) {2574 if (p === undefined) // we assume not given2575 p = SC_DEFAULT_OUT;2576 p.appendJSString(c.val);2577}2578/* ------------------ write-circle ---------------------------------------------------*/2579/*** META ((export #t)) */2580function sc_writeCircle(o, p) {2581 if (p === undefined) // we assume not given2582 p = SC_DEFAULT_OUT;2583 p.appendJSString(sc_toWriteCircleString(o));2584}2585function sc_toWriteCircleString(o) {2586 var symb = sc_gensym("writeCircle");2587 var nbPointer = new Object();2588 nbPointer.nb = 0;2589 sc_prepWriteCircle(o, symb, nbPointer);2590 return sc_genToWriteCircleString(o, symb);2591}2592function sc_prepWriteCircle(o, symb, nbPointer) {2593 // TODO sc_Struct2594 if (o instanceof sc_Pair ||2595 o instanceof sc_Vector) {2596 if (o[symb] !== undefined) {2597 // not the first visit.2598 o[symb]++;2599 // unless there is already a number, assign one.2600 if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++;2601 return;2602 }2603 o[symb] = 0;2604 if (o instanceof sc_Pair) {2605 sc_prepWriteCircle(o.car, symb, nbPointer);2606 sc_prepWriteCircle(o.cdr, symb, nbPointer);2607 } else {2608 for (var i = 0; i < o.length; i++)2609 sc_prepWriteCircle(o[i], symb, nbPointer);2610 }2611 }2612}2613function sc_genToWriteCircleString(o, symb) {2614 if (!(o instanceof sc_Pair ||2615 o instanceof sc_Vector))2616 return sc_toWriteString(o);2617 return o.sc_toWriteCircleString(symb);2618}2619sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) {2620 if (this[symb + "use"]) { // use-flag is set. Just use it.2621 var nb = this[symb + "nb"];2622 if (this[symb]-- === 0) { // if we are the last use. remove all fields.2623 delete this[symb];2624 delete this[symb + "nb"];2625 delete this[symb + "use"];2626 }2627 if (inList)2628 return '. #' + nb + '#';2629 else2630 return '#' + nb + '#';2631 }2632 if (this[symb]-- === 0) { // if we are the last use. remove all fields.2633 delete this[symb];2634 delete this[symb + "nb"];2635 delete this[symb + "use"];2636 }2637 var res = "";2638 if (this[symb] !== undefined) { // implies > 02639 this[symb + "use"] = true;2640 if (inList)2641 res += '. #' + this[symb + "nb"] + '=';2642 else2643 res += '#' + this[symb + "nb"] + '=';2644 inList = false;2645 }2646 if (!inList)2647 res += "(";2648 // print car2649 res += sc_genToWriteCircleString(this.car, symb);2650 if (sc_isPair(this.cdr)) {2651 res += " " + this.cdr.sc_toWriteCircleString(symb, true);2652 } else if (this.cdr !== null) {2653 res += " . " + sc_genToWriteCircleString(this.cdr, symb);2654 }2655 if (!inList)2656 res += ")";2657 return res;2658};2659sc_Vector.prototype.sc_toWriteCircleString = function(symb) {2660 if (this[symb + "use"]) { // use-flag is set. Just use it.2661 var nb = this[symb + "nb"];2662 if (this[symb]-- === 0) { // if we are the last use. remove all fields.2663 delete this[symb];2664 delete this[symb + "nb"];2665 delete this[symb + "use"];2666 }2667 return '#' + nb + '#';2668 }2669 if (this[symb]-- === 0) { // if we are the last use. remove all fields.2670 delete this[symb];2671 delete this[symb + "nb"];2672 delete this[symb + "use"];2673 }2674 var res = "";2675 if (this[symb] !== undefined) { // implies > 02676 this[symb + "use"] = true;2677 res += '#' + this[symb + "nb"] + '=';2678 }2679 res += "#(";2680 for (var i = 0; i < this.length; i++) {2681 res += sc_genToWriteCircleString(this[i], symb);2682 if (i < this.length - 1) res += " ";2683 }2684 res += ")";2685 return res;2686};2687/* ------------------ print ---------------------------------------------------*/2688/*** META ((export #t)) */2689function sc_print(s) {2690 if (arguments.length === 1) {2691 sc_display(s);2692 sc_newline();2693 }2694 else {2695 for (var i = 0; i < arguments.length; i++)2696 sc_display(arguments[i]);2697 sc_newline();2698 }2699}2700/* ------------------ format ---------------------------------------------------*/2701/*** META ((export #t)) */2702function sc_format(s, args) {2703 var len = s.length;2704 var p = new sc_StringOutputPort();2705 var i = 0, j = 1;2706 while( i < len ) {2707 var i2 = s.indexOf("~", i);2708 if (i2 == -1) {2709 p.appendJSString( s.substring( i, len ) );2710 return p.close();2711 } else {2712 if (i2 > i) {2713 if (i2 == (len - 1)) {2714 p.appendJSString(s.substring(i, len));2715 return p.close();2716 } else {2717 p.appendJSString(s.substring(i, i2));2718 i = i2;2719 }2720 }2721 switch(s.charCodeAt(i2 + 1)) {2722 case 65:2723 case 97:2724 // a2725 sc_display(arguments[j], p);2726 i += 2; j++;2727 break;2728 case 83:2729 case 115:2730 // s2731 sc_write(arguments[j], p);2732 i += 2; j++;2733 break;2734 case 86:2735 case 118:2736 // v2737 sc_display(arguments[j], p);2738 p.appendJSString("\n");2739 i += 2; j++;2740 break;2741 case 67:2742 case 99:2743 // c2744 p.appendJSString(String.fromCharCode(arguments[j]));2745 i += 2; j++;2746 break;2747 case 88:2748 case 120:2749 // x2750 p.appendJSString(arguments[j].toString(6));2751 i += 2; j++;2752 break;2753 case 79:2754 case 111:2755 // o2756 p.appendJSString(arguments[j].toString(8));2757 i += 2; j++;2758 break;2759 case 66:2760 case 98:2761 // b2762 p.appendJSString(arguments[j].toString(2));2763 i += 2; j++;2764 break;2765 case 37:2766 case 110:2767 // %, n2768 p.appendJSString("\n");2769 i += 2; break;2770 case 114:2771 // r2772 p.appendJSString("\r");2773 i += 2; break;2774 case 126:2775 // ~2776 p.appendJSString("~");2777 i += 2; break;2778 default:2779 sc_error( "format: illegal ~"2780 + String.fromCharCode(s.charCodeAt(i2 + 1))2781 + " sequence" );2782 return "";2783 }2784 }2785 }2786 return p.close();2787}2788/* ------------------ global ports ---------------------------------------------------*/2789var SC_DEFAULT_IN = new sc_ErrorInputPort();2790var SC_DEFAULT_OUT = new sc_ErrorOutputPort();2791var SC_ERROR_OUT = new sc_ErrorOutputPort();2792var sc_SYMBOL_PREFIX = "\u1E9C";2793var sc_KEYWORD_PREFIX = "\u1E9D";2794/*** META ((export #t)2795 (peephole (id))) */2796function sc_jsstring2string(s) {2797 return s;2798}2799/*** META ((export #t)2800 (peephole (prefix "'\\u1E9C' +")))2801*/2802function sc_jsstring2symbol(s) {2803 return sc_SYMBOL_PREFIX + s;2804}2805/*** META ((export #t)2806 (peephole (id)))2807*/2808function sc_string2jsstring(s) {2809 return s;2810}2811/*** META ((export #t)2812 (peephole (symbol2jsstring_immutable)))2813*/2814function sc_symbol2jsstring(s) {2815 return s.slice(1);2816}2817/*** META ((export #t)2818 (peephole (postfix ".slice(1)")))2819*/2820function sc_keyword2jsstring(k) {2821 return k.slice(1);2822}2823/*** META ((export #t)2824 (peephole (prefix "'\\u1E9D' +")))2825*/2826function sc_jsstring2keyword(s) {2827 return sc_KEYWORD_PREFIX + s;2828}2829/*** META ((export #t)2830 (type bool))2831*/2832function sc_isKeyword(s) {2833 return (typeof s === "string") &&2834 (s.charAt(0) === sc_KEYWORD_PREFIX);2835}2836/*** META ((export #t)) */2837var sc_gensym = function() {2838 var counter = 1000;2839 return function(sym) {2840 counter++;2841 if (!sym) sym = sc_SYMBOL_PREFIX;2842 return sym + "s" + counter + "~" + "^sC-GeNsYm ";2843 };2844}();2845/*** META ((export #t)2846 (type bool))2847*/2848function sc_isEqual(o1, o2) {2849 return ((o1 === o2) ||2850 (sc_isPair(o1) && sc_isPair(o2)2851 && sc_isPairEqual(o1, o2, sc_isEqual)) ||2852 (sc_isVector(o1) && sc_isVector(o2)2853 && sc_isVectorEqual(o1, o2, sc_isEqual)));2854}2855/*** META ((export number->symbol integer->symbol)) */2856function sc_number2symbol(x, radix) {2857 return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix);2858}2859/*** META ((export number->string integer->string)) */2860var sc_number2string = sc_number2jsstring;2861/*** META ((export #t)) */2862function sc_symbol2number(s, radix) {2863 return sc_jsstring2number(s.slice(1), radix);2864}2865/*** META ((export #t)) */2866var sc_string2number = sc_jsstring2number;2867/*** META ((export #t)2868 (peephole (prefix "+" s)))2869 ;; peephole will only apply if no radix is given.2870*/2871function sc_string2integer(s, radix) {2872 if (!radix) return +s;2873 return parseInt(s, radix);2874}2875/*** META ((export #t)2876 (peephole (prefix "+")))2877*/2878function sc_string2real(s) {2879 return +s;2880}2881/*** META ((export #t)2882 (type bool))2883*/2884function sc_isSymbol(s) {2885 return (typeof s === "string") &&2886 (s.charAt(0) === sc_SYMBOL_PREFIX);2887}2888/*** META ((export #t)2889 (peephole (symbol2string_immutable)))2890*/2891function sc_symbol2string(s) {2892 return s.slice(1);2893}2894/*** META ((export #t)2895 (peephole (prefix "'\\u1E9C' +")))2896*/2897function sc_string2symbol(s) {2898 return sc_SYMBOL_PREFIX + s;2899}2900/*** META ((export symbol-append)2901 (peephole (symbolAppend_immutable)))2902*/2903function sc_symbolAppend() {2904 var res = sc_SYMBOL_PREFIX;2905 for (var i = 0; i < arguments.length; i++)2906 res += arguments[i].slice(1);2907 return res;2908}2909/*** META ((export #t)2910 (peephole (postfix ".val")))2911*/2912function sc_char2string(c) { return c.val; }2913/*** META ((export #t)2914 (peephole (hole 1 "'\\u1E9C' + " c ".val")))2915*/2916function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; }2917/*** META ((export #t)2918 (type bool))2919*/2920function sc_isString(s) {2921 return (typeof s === "string") &&2922 (s.charAt(0) !== sc_SYMBOL_PREFIX);2923}2924/*** META ((export #t)) */2925var sc_makeString = sc_makejsString;2926/*** META ((export #t)) */2927function sc_string() {2928 for (var i = 0; i < arguments.length; i++)2929 arguments[i] = arguments[i].val;2930 return "".concat.apply("", arguments);2931}2932/*** META ((export #t)2933 (peephole (postfix ".length")))2934*/2935function sc_stringLength(s) { return s.length; }2936/*** META ((export #t)) */2937function sc_stringRef(s, k) {2938 return new sc_Char(s.charAt(k));2939}2940/* there's no stringSet in the immutable version2941function sc_stringSet(s, k, c)2942*/2943/*** META ((export string=?)2944 (type bool)2945 (peephole (hole 2 str1 " === " str2)))2946*/2947function sc_isStringEqual(s1, s2) {2948 return s1 === s2;2949}2950/*** META ((export string<?)2951 (type bool)2952 (peephole (hole 2 str1 " < " str2)))2953*/2954function sc_isStringLess(s1, s2) {2955 return s1 < s2;2956}2957/*** META ((export string>?)2958 (type bool)2959 (peephole (hole 2 str1 " > " str2)))2960*/2961function sc_isStringGreater(s1, s2) {2962 return s1 > s2;2963}2964/*** META ((export string<=?)2965 (type bool)2966 (peephole (hole 2 str1 " <= " str2)))2967*/2968function sc_isStringLessEqual(s1, s2) {2969 return s1 <= s2;2970}2971/*** META ((export string>=?)2972 (type bool)2973 (peephole (hole 2 str1 " >= " str2)))2974*/2975function sc_isStringGreaterEqual(s1, s2) {2976 return s1 >= s2;2977}2978/*** META ((export string-ci=?)2979 (type bool)2980 (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()")))2981*/2982function sc_isStringCIEqual(s1, s2) {2983 return s1.toLowerCase() === s2.toLowerCase();2984}2985/*** META ((export string-ci<?)2986 (type bool)2987 (peephole (hole 2 str1 ".toLowerCase() < " str2 ".toLowerCase()")))2988*/2989function sc_isStringCILess(s1, s2) {2990 return s1.toLowerCase() < s2.toLowerCase();2991}2992/*** META ((export string-ci>?)2993 (type bool)2994 (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()")))2995*/2996function sc_isStringCIGreater(s1, s2) {2997 return s1.toLowerCase() > s2.toLowerCase();2998}2999/*** META ((export string-ci<=?)3000 (type bool)3001 (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()")))3002*/3003function sc_isStringCILessEqual(s1, s2) {3004 return s1.toLowerCase() <= s2.toLowerCase();3005}3006/*** META ((export string-ci>=?)3007 (type bool)3008 (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()")))3009*/3010function sc_isStringCIGreaterEqual(s1, s2) {3011 return s1.toLowerCase() >= s2.toLowerCase();3012}3013/*** META ((export #t)3014 (peephole (hole 3 s ".substring(" start ", " end ")")))3015*/3016function sc_substring(s, start, end) {3017 return s.substring(start, end);3018}3019/*** META ((export #t))3020*/3021function sc_isSubstring_at(s1, s2, i) {3022 return s2 == s1.substring(i, i+ s2.length);3023}3024/*** META ((export #t)3025 (peephole (infix 0 #f "+" "''")))3026*/3027function sc_stringAppend() {3028 return "".concat.apply("", arguments);3029}3030/*** META ((export #t)) */3031var sc_string2list = sc_jsstring2list;3032/*** META ((export #t)) */3033var sc_list2string = sc_list2jsstring;3034/*** META ((export #t)3035 (peephole (id)))3036*/3037function sc_stringCopy(s) {3038 return s;3039}3040/* there's no string-fill in the immutable version3041function sc_stringFill(s, c)3042*/3043/*** META ((export #t)3044 (peephole (postfix ".slice(1)")))3045*/3046function sc_keyword2string(o) {3047 return o.slice(1);3048}3049/*** META ((export #t)3050 (peephole (prefix "'\\u1E9D' +")))3051*/3052function sc_string2keyword(o) {3053 return sc_KEYWORD_PREFIX + o;3054}3055String.prototype.sc_toDisplayString = function() {3056 if (this.charAt(0) === sc_SYMBOL_PREFIX)3057 // TODO: care for symbols with spaces (escape-chars symbols).3058 return this.slice(1);3059 else if (this.charAt(0) === sc_KEYWORD_PREFIX)3060 return ":" + this.slice(1);3061 else3062 return this.toString();3063};3064String.prototype.sc_toWriteString = function() {3065 if (this.charAt(0) === sc_SYMBOL_PREFIX)3066 // TODO: care for symbols with spaces (escape-chars symbols).3067 return this.slice(1);3068 else if (this.charAt(0) === sc_KEYWORD_PREFIX)3069 return ":" + this.slice(1);3070 else3071 return '"' + sc_escapeWriteString(this) + '"';3072};3073/* Exported Variables */3074var BgL_testzd2boyerzd2;3075var BgL_nboyerzd2benchmarkzd2;3076var BgL_setupzd2boyerzd2;3077/* End Exports */3078var translate_term_nboyer;3079var translate_args_nboyer;3080var untranslate_term_nboyer;3081var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer;3082var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer;3083var translate_alist_nboyer;3084var apply_subst_nboyer;3085var apply_subst_lst_nboyer;3086var tautologyp_nboyer;3087var if_constructor_nboyer;3088var rewrite_count_nboyer;3089var rewrite_nboyer;3090var rewrite_args_nboyer;3091var unify_subst_nboyer;3092var one_way_unify1_nboyer;3093var false_term_nboyer;3094var true_term_nboyer;3095var trans_of_implies1_nboyer;3096var is_term_equal_nboyer;3097var is_term_member_nboyer;3098var const_nboyer;3099var sc_const_3_nboyer;3100var sc_const_4_nboyer;3101{3102 (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)))))));3103 (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))))))));3104 (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)))))))))));3105 BgL_nboyerzd2benchmarkzd2 = function() {3106 var args = null;3107 for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) {3108 args = sc_cons(arguments[sc_tmp], args);3109 }3110 var n;3111 return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() {3112 return (BgL_testzd2boyerzd2(n));3113 }, function(rewrites) {3114 if ((sc_isNumber(rewrites)))3115 switch (n) {3116 case (0):3117 return (rewrites===(95024));3118 break;3119 case (1):3120 return (rewrites===(591777));3121 break;3122 case (2):3123 return (rewrites===(1813975));3124 break;3125 case (3):3126 return (rewrites===(5375678));3127 break;3128 case (4):3129 return (rewrites===(16445406));3130 break;3131 case (5):3132 return (rewrites===(51507739));3133 break;3134 default:3135 return true;3136 break;3137 }3138 else3139 return false;3140 })));3141 };3142 BgL_setupzd2boyerzd2 = function() {3143 return true;3144 };3145 BgL_testzd2boyerzd2 = function() {3146 return true;3147 };3148 translate_term_nboyer = function(term) {3149 var lst;3150 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))))))))));3151 };3152 translate_args_nboyer = function(lst) {3153 var sc_lst_5;3154 var term;3155 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))))))))));3156 };3157 untranslate_term_nboyer = function(term) {3158 var optrOpnd;3159 var tail1131;3160 var L1127;3161 var falseHead1130;3162 var symbol_record;3163 if (!(term instanceof sc_Pair))3164 return term;3165 else3166 {3167 (falseHead1130 = (new sc_Pair(null, null)));3168 (L1127 = (term.cdr));3169 (tail1131 = falseHead1130);3170 while (!(L1127 === null)) {3171 {3172 (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null)));3173 (tail1131 = (tail1131.cdr));3174 (L1127 = (L1127.cdr));3175 }3176 }3177 (optrOpnd = (falseHead1130.cdr));3178 return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd));3179 }3180 };3181 BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) {3182 var r;3183 var x;3184 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)));3185 };3186 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null);3187 translate_alist_nboyer = function(alist) {3188 var sc_alist_6;3189 var term;3190 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))))))))));3191 };3192 apply_subst_nboyer = function(alist, term) {3193 var lst;3194 var temp_temp;3195 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))))))))));3196 };3197 apply_subst_lst_nboyer = function(alist, lst) {3198 var sc_lst_7;3199 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))))))))));3200 };3201 tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) {3202 var tmp1125;3203 var x;3204 var tmp1126;3205 var sc_x_8;3206 var sc_tmp1125_9;3207 var sc_tmp1126_10;3208 var sc_x_11;3209 var true_lst;3210 var false_lst;3211 while (true) {3212 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))3213 return true;3214 else3215 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))3216 return false;3217 else3218 if (!(sc_x_11 instanceof sc_Pair))3219 return false;3220 else3221 if (((sc_x_11.car)===if_constructor_nboyer))3222 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))3223 (sc_x_11 = (sc_x_11.cdr.cdr.car));3224 else3225 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))3226 (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car));3227 else3228 if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false))3229 {3230 (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst)));3231 (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car));3232 }3233 else3234 return false;3235 else3236 return false;3237 }3238 };3239 (if_constructor_nboyer = "\u1E9C*");3240 (rewrite_count_nboyer = (0));3241 rewrite_nboyer = function(term) {3242 var term2;3243 var sc_term_12;3244 var lst;3245 var symbol_record;3246 var sc_lst_13;3247 {3248 (++rewrite_count_nboyer);3249 if (!(term instanceof sc_Pair))3250 return term;3251 else3252 {3253 (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))))))))));3254 (lst = ((symbol_record = (term.car)), (symbol_record[(1)])));3255 while (true) {3256 if ((lst === null))3257 return sc_term_12;3258 else3259 if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false))3260 return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car)))));3261 else3262 (lst = (lst.cdr));3263 }3264 }3265 }3266 };3267 rewrite_args_nboyer = function(lst) {3268 var sc_lst_14;3269 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))))))))));3270 };3271 (unify_subst_nboyer = "\u1E9C*");3272 one_way_unify1_nboyer = function(term1, term2) {3273 var lst1;3274 var lst2;3275 var temp_temp;3276 if (!(term2 instanceof sc_Pair))3277 {3278 (temp_temp = (sc_assq(term2, unify_subst_nboyer)));3279 if ((temp_temp!== false))3280 return (is_term_equal_nboyer(term1, (temp_temp.cdr)));3281 else3282 if ((sc_isNumber(term2)))3283 return (sc_isEqual(term1, term2));3284 else3285 {3286 (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer)));3287 return true;3288 }3289 }3290 else3291 if (!(term1 instanceof sc_Pair))3292 return false;3293 else3294 if (((term1.car)===(term2.car)))3295 {3296 (lst1 = (term1.cdr));3297 (lst2 = (term2.cdr));3298 while (true) {3299 if ((lst1 === null))3300 return (lst2 === null);3301 else3302 if ((lst2 === null))3303 return false;3304 else3305 if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false))3306 {3307 (lst1 = (lst1.cdr));3308 (lst2 = (lst2.cdr));3309 }3310 else3311 return false;3312 }3313 }3314 else3315 return false;3316 };3317 (false_term_nboyer = "\u1E9C*");3318 (true_term_nboyer = "\u1E9C*");3319 trans_of_implies1_nboyer = function(n) {3320 var sc_n_15;3321 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)))))))))));3322 };3323 is_term_equal_nboyer = function(x, y) {3324 var lst1;3325 var lst2;3326 var r2;3327 var r1;3328 if ((x instanceof sc_Pair))3329 if ((y instanceof sc_Pair))3330 if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false))3331 {3332 (lst1 = (x.cdr));3333 (lst2 = (y.cdr));3334 while (true) {3335 if ((lst1 === null))3336 return (lst2 === null);3337 else3338 if ((lst2 === null))3339 return false;3340 else3341 if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false))3342 {3343 (lst1 = (lst1.cdr));3344 (lst2 = (lst2.cdr));3345 }3346 else3347 return false;3348 }3349 }3350 else3351 return false;3352 else3353 return false;3354 else3355 return (sc_isEqual(x, y));3356 };3357 is_term_member_nboyer = function(x, lst) {3358 var x;3359 var lst;3360 while (true) {3361 if ((lst === null))3362 return false;3363 else3364 if (((is_term_equal_nboyer(x, (lst.car)))!== false))3365 return true;3366 else3367 (lst = (lst.cdr));3368 }3369 };3370 BgL_setupzd2boyerzd2 = function() {3371 var symbol_record;3372 var value;3373 var BgL_sc_symbolzd2record_16zd2;3374 var sym;3375 var sc_sym_17;3376 var term;3377 var lst;3378 var sc_term_18;3379 var sc_term_19;3380 {3381 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null);3382 (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif")));3383 (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))))))));3384 (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))))))));3385 (lst = sc_const_3_nboyer);3386 while (!(lst === null)) {3387 {3388 (term = (lst.car));3389 if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair))))3390 {3391 (sc_sym_17 = ((term.cdr.car).car));3392 (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)])))));3393 (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17)));3394 (symbol_record[(1)] = value);3395 }3396 else3397 (sc_error("ADD-LEMMA did not like term: ", term));3398 (lst = (lst.cdr));3399 }3400 }3401 return true;3402 }3403 };3404 BgL_testzd2boyerzd2 = function(n) {3405 var optrOpnd;3406 var term;3407 var sc_n_20;3408 var answer;3409 var sc_term_21;3410 var sc_term_22;3411 {3412 (rewrite_count_nboyer = (0));3413 (term = sc_const_4_nboyer);3414 (sc_n_20 = n);3415 while (!(sc_n_20=== 0)) {3416 {3417 (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null)))));3418 (--sc_n_20);3419 }3420 }3421 (sc_term_22 = term);3422 if (!(sc_term_22 instanceof sc_Pair))3423 (optrOpnd = sc_term_22);3424 else3425 (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr))))));3426 (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)));3427 (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null)));3428 (sc_write(rewrite_count_nboyer));3429 (sc_display(" rewrites"));3430 (sc_newline());3431 if ((answer!== false))3432 return rewrite_count_nboyer;3433 else3434 return false;3435 }3436 };3437}3438/* Exported Variables */3439var BgL_parsezd2ze3nbzd2treesze3;3440var BgL_earleyzd2benchmarkzd2;3441var BgL_parsezd2ze3parsedzf3zc2;3442var test;3443var BgL_parsezd2ze3treesz31;3444var BgL_makezd2parserzd2;3445/* End Exports */3446var const_earley;3447{3448 (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)));3449 BgL_makezd2parserzd2 = function(grammar, lexer) {3450 var i;3451 var parser_descr;3452 var def_loop;3453 var nb_nts;3454 var names;3455 var steps;3456 var predictors;3457 var enders;3458 var starters;3459 var nts;3460 var sc_names_1;3461 var sc_steps_2;3462 var sc_predictors_3;3463 var sc_enders_4;3464 var sc_starters_5;3465 var nb_confs;3466 var BgL_sc_defzd2loop_6zd2;3467 var BgL_sc_nbzd2nts_7zd2;3468 var sc_nts_8;3469 var BgL_sc_defzd2loop_9zd2;3470 var ind;3471 {3472 ind = function(nt, sc_nts_10) {3473 var i;3474 {3475 (i = ((sc_nts_10.length)-(1)));3476 while (true) {3477 if ((i>=(0)))3478 if ((sc_isEqual((sc_nts_10[i]), nt)))3479 return i;3480 else3481 (--i);3482 else3483 return false;3484 }3485 }3486 };3487 (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) {3488 var rule_loop;3489 var head;3490 var def;3491 return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) {3492 var nt;3493 var l;3494 var sc_nts_13;3495 var rule;3496 if ((rules instanceof sc_Pair))3497 {3498 (rule = (rules.car));3499 (l = rule);3500 (sc_nts_13 = sc_nts_12);3501 while ((l instanceof sc_Pair)) {3502 {3503 (nt = (l.car));3504 (l = (l.cdr));3505 (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13))));3506 }3507 }3508 return (rule_loop((rules.cdr), sc_nts_13));3509 }3510 else3511 return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12));3512 }), (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)))));3513 }), (BgL_sc_defzd2loop_9zd2(grammar, null))));3514 (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length));3515 (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) {3516 var rule_loop;3517 var def;3518 return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) {3519 var l;3520 var BgL_sc_nbzd2confs_16zd2;3521 var rule;3522 if ((rules instanceof sc_Pair))3523 {3524 (rule = (rules.car));3525 (l = rule);3526 (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2);3527 while ((l instanceof sc_Pair)) {3528 {3529 (l = (l.cdr));3530 (++BgL_sc_nbzd2confs_16zd2);3531 }3532 }3533 return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1))));3534 }3535 else3536 return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2));3537 }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2);3538 }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2));3539 (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));3540 (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));3541 (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));3542 (sc_steps_2 = (sc_makeVector(nb_confs, false)));3543 (sc_names_1 = (sc_makeVector(nb_confs, false)));3544 (nts = sc_nts_8);3545 (starters = sc_starters_5);3546 (enders = sc_enders_4);3547 (predictors = sc_predictors_3);3548 (steps = sc_steps_2);3549 (names = sc_names_1);3550 (nb_nts = (sc_nts_8.length));3551 (i = (nb_nts-(1)));3552 while ((i>=(0))) {3553 {3554 (sc_steps_2[i] = (i-nb_nts));3555 (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0))));3556 (sc_enders_4[i] = (sc_list(i)));3557 (--i);3558 }3559 }3560 def_loop = function(defs, conf) {3561 var rule_loop;3562 var head;3563 var def;3564 return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) {3565 var i;3566 var sc_i_17;3567 var nt;3568 var l;3569 var sc_conf_18;3570 var sc_i_19;3571 var rule;3572 if ((rules instanceof sc_Pair))3573 {3574 (rule = (rules.car));3575 (names[conf] = (sc_list(head, rule_num)));3576 (sc_i_19 = (ind(head, nts)));3577 (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19]))));3578 (l = rule);3579 (sc_conf_18 = conf);3580 while ((l instanceof sc_Pair)) {3581 {3582 (nt = (l.car));3583 (steps[sc_conf_18] = (ind(nt, nts)));3584 (sc_i_17 = (ind(nt, nts)));3585 (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17]))));3586 (l = (l.cdr));3587 (++sc_conf_18);3588 }3589 }3590 (steps[sc_conf_18] = ((ind(head, nts))-nb_nts));3591 (i = (ind(head, nts)));3592 (enders[i] = (new sc_Pair(sc_conf_18, (enders[i]))));3593 return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1))));3594 }3595 else3596 return (def_loop((defs.cdr), conf));3597 }), (rule_loop((def.cdr), conf, (1)))):undefined);3598 };3599 (def_loop(grammar, (sc_nts_8.length)));3600 (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]);3601 return function(input) {3602 var optrOpnd;3603 var sc_optrOpnd_20;3604 var sc_optrOpnd_21;3605 var sc_optrOpnd_22;3606 var loop1;3607 var BgL_sc_stateza2_23za2;3608 var toks;3609 var BgL_sc_nbzd2nts_24zd2;3610 var sc_steps_25;3611 var sc_enders_26;3612 var state_num;3613 var BgL_sc_statesza2_27za2;3614 var states;3615 var i;3616 var conf;3617 var l;3618 var tok_nts;3619 var sc_i_28;3620 var sc_i_29;3621 var l1;3622 var l2;3623 var tok;3624 var tail1129;3625 var L1125;3626 var goal_enders;3627 var BgL_sc_statesza2_30za2;3628 var BgL_sc_nbzd2nts_31zd2;3629 var BgL_sc_nbzd2confs_32zd2;3630 var nb_toks;3631 var goal_starters;3632 var sc_states_33;3633 var BgL_sc_nbzd2confs_34zd2;3634 var BgL_sc_nbzd2toks_35zd2;3635 var sc_toks_36;3636 var falseHead1128;3637 var sc_names_37;3638 var sc_steps_38;3639 var sc_predictors_39;3640 var sc_enders_40;3641 var sc_starters_41;3642 var sc_nts_42;3643 var lexer;3644 var sc_ind_43;3645 var make_states;3646 var BgL_sc_confzd2setzd2getza2_44za2;3647 var conf_set_merge_new_bang;3648 var conf_set_adjoin;3649 var BgL_sc_confzd2setzd2adjoinza2_45za2;3650 var BgL_sc_confzd2setzd2adjoinza2za2_46z00;3651 var conf_set_union;3652 var forw;3653 var is_parsed;3654 var deriv_trees;3655 var BgL_sc_derivzd2treesza2_47z70;3656 var nb_deriv_trees;3657 var BgL_sc_nbzd2derivzd2treesza2_48za2;3658 {3659 sc_ind_43 = function(nt, sc_nts_49) {3660 var i;3661 {3662 (i = ((sc_nts_49.length)-(1)));3663 while (true) {3664 if ((i>=(0)))3665 if ((sc_isEqual((sc_nts_49[i]), nt)))3666 return i;3667 else3668 (--i);3669 else3670 return false;3671 }3672 }3673 };3674 make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) {3675 var v;3676 var i;3677 var sc_states_52;3678 {3679 (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false)));3680 (i = BgL_sc_nbzd2toks_50zd2);3681 while ((i>=(0))) {3682 {3683 (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false)));3684 (v[(0)] = (-1));3685 (sc_states_52[i] = v);3686 (--i);3687 }3688 }3689 return sc_states_52;3690 }3691 };3692 BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) {3693 var conf_set;3694 var BgL_sc_confzd2set_55zd2;3695 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)));3696 };3697 conf_set_merge_new_bang = function(conf_set) {3698 return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)));3699 };3700 conf_set_adjoin = function(state, conf_set, sc_conf_56, i) {3701 var tail;3702 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));3703 };3704 BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) {3705 var conf_set;3706 var sc_conf_59;3707 var l1;3708 var state;3709 {3710 (state = (sc_states_57[BgL_sc_statezd2num_58zd2]));3711 (l1 = l);3712 while ((l1 instanceof sc_Pair)) {3713 {3714 (sc_conf_59 = (l1.car));3715 (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59)));3716 if (((conf_set[(i+(5))])=== false))3717 {3718 (conf_set_adjoin(state, conf_set, sc_conf_59, i));3719 (l1 = (l1.cdr));3720 }3721 else3722 (l1 = (l1.cdr));3723 }3724 }3725 return undefined;3726 }3727 };3728 BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) {3729 var BgL_sc_confzd2setza2_64z70;3730 var BgL_sc_stateza2_65za2;3731 var conf_set;3732 var state;3733 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));3734 };3735 conf_set_union = function(state, conf_set, sc_conf_66, other_set) {3736 var i;3737 {3738 (i = (other_set[(2)]));3739 while ((i>=(0))) {3740 if (((conf_set[(i+(5))])=== false))3741 {3742 (conf_set_adjoin(state, conf_set, sc_conf_66, i));3743 (i = (other_set[(i+(5))]));3744 }3745 else3746 (i = (other_set[(i+(5))]));3747 }3748 return undefined;3749 }3750 };3751 forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) {3752 var next_set;3753 var next;3754 var conf_set;3755 var ender;3756 var l;3757 var starter_set;3758 var starter;3759 var sc_l_74;3760 var sc_loop1_75;3761 var head;3762 var BgL_sc_confzd2set_76zd2;3763 var BgL_sc_statezd2num_77zd2;3764 var state;3765 var sc_states_78;3766 var preds;3767 var BgL_sc_confzd2set_79zd2;3768 var step;3769 var sc_conf_80;3770 var BgL_sc_nbzd2nts_81zd2;3771 var sc_state_82;3772 {3773 (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2]));3774 (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length));3775 while (true) {3776 {3777 (sc_conf_80 = (sc_state_82[(0)]));3778 if ((sc_conf_80>=(0)))3779 {3780 (step = (sc_steps_72[sc_conf_80]));3781 (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))]));3782 (head = (BgL_sc_confzd2set_79zd2[(4)]));3783 (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)]));3784 (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2));3785 if ((step>=(0)))3786 {3787 (sc_l_74 = (sc_starters_69[step]));3788 while ((sc_l_74 instanceof sc_Pair)) {3789 {3790 (starter = (sc_l_74.car));3791 (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter)));3792 if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false))3793 {3794 (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2));3795 (sc_l_74 = (sc_l_74.cdr));3796 }3797 else3798 (sc_l_74 = (sc_l_74.cdr));3799 }3800 }3801 (l = (sc_enders_70[step]));3802 while ((l instanceof sc_Pair)) {3803 {3804 (ender = (l.car));3805 if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false))3806 {3807 (next = (sc_conf_80+(1)));3808 (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next)));3809 (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2));3810 (l = (l.cdr));3811 }3812 else3813 (l = (l.cdr));3814 }3815 }3816 }3817 else3818 {3819 (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)]));3820 (sc_states_78 = sc_states_67);3821 (state = sc_state_82);3822 (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2);3823 (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2);3824 sc_loop1_75 = function(l) {3825 var sc_state_83;3826 var BgL_sc_nextzd2set_84zd2;3827 var sc_next_85;3828 var pred_set;3829 var i;3830 var pred;3831 if ((l instanceof sc_Pair))3832 {3833 (pred = (l.car));3834 (i = head);3835 while ((i>=(0))) {3836 {3837 (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))])));3838 if ((pred_set!== false))3839 {3840 (sc_next_85 = (pred+(1)));3841 (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85)));3842 (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set));3843 }3844 (i = (BgL_sc_confzd2set_76zd2[(i+(5))]));3845 }3846 }3847 return (sc_loop1_75((l.cdr)));3848 }3849 else3850 return undefined;3851 };3852 (sc_loop1_75(preds));3853 }3854 }3855 else3856 return undefined;3857 }3858 }3859 }3860 };3861 is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) {3862 var conf_set;3863 var state;3864 var sc_conf_89;3865 var l;3866 var BgL_sc_ntza2_90za2;3867 {3868 (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86)));3869 if ((BgL_sc_ntza2_90za2!== false))3870 {3871 (sc_nts_86.length);3872 (l = (sc_enders_87[BgL_sc_ntza2_90za2]));3873 while (true) {3874 if ((l instanceof sc_Pair))3875 {3876 (sc_conf_89 = (l.car));3877 if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))3878 return true;3879 else3880 (l = (l.cdr));3881 }3882 else3883 return false;3884 }3885 }3886 else3887 return false;3888 }3889 };3890 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) {3891 var sc_loop1_98;3892 var prev;3893 var name;3894 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) {3895 var loop2;3896 var ender_set;3897 var state;3898 var ender;3899 var l1;3900 var l2;3901 while (true) {3902 if ((l1 instanceof sc_Pair))3903 {3904 (ender = (l1.car));3905 (ender_set = ((state = (sc_states_96[j])), (state[(ender+(1))])));3906 if ((ender_set!== false))3907 {3908 loop2 = function(k, l2) {3909 var loop3;3910 var ender_trees;3911 var prev_trees;3912 var conf_set;3913 var sc_state_99;3914 var k;3915 var l2;3916 while (true) {3917 if ((k>=(0)))3918 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)))3919 {3920 (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)));3921 (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)));3922 loop3 = function(l3, l2) {3923 var l4;3924 var sc_l2_100;3925 var ender_tree;3926 if ((l3 instanceof sc_Pair))3927 {3928 (ender_tree = (sc_list((l3.car))));3929 (l4 = prev_trees);3930 (sc_l2_100 = l2);3931 while ((l4 instanceof sc_Pair)) {3932 {3933 (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100)));3934 (l4 = (l4.cdr));3935 }3936 }3937 return (loop3((l3.cdr), sc_l2_100));3938 }3939 else3940 return (loop2((ender_set[(k+(5))]), l2));3941 };3942 return (loop3(ender_trees, l2));3943 }3944 else3945 (k = (ender_set[(k+(5))]));3946 else3947 return (sc_loop1_98((l1.cdr), l2));3948 }3949 };3950 return (loop2((ender_set[(2)]), l2));3951 }3952 else3953 (l1 = (l1.cdr));3954 }3955 else3956 return l2;3957 }3958 }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null)))));3959 };3960 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) {3961 var conf_set;3962 var state;3963 var sc_conf_107;3964 var l;3965 var trees;3966 var BgL_sc_nbzd2nts_108zd2;3967 var BgL_sc_ntza2_109za2;3968 {3969 (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101)));3970 if ((BgL_sc_ntza2_109za2!== false))3971 {3972 (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length));3973 (l = (sc_enders_102[BgL_sc_ntza2_109za2]));3974 (trees = null);3975 while ((l instanceof sc_Pair)) {3976 {3977 (sc_conf_107 = (l.car));3978 if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))3979 {3980 (l = (l.cdr));3981 (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)));3982 }3983 else3984 (l = (l.cdr));3985 }3986 }3987 return trees;3988 }3989 else3990 return false;3991 }3992 };3993 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) {3994 var sc_loop1_116;3995 var tmp1124;3996 var prev;3997 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) {3998 var nb_ender_trees;3999 var nb_prev_trees;4000 var conf_set;4001 var state;4002 var k;4003 var n;4004 var ender_set;4005 var sc_state_117;4006 var ender;4007 var l;4008 var sc_n_118;4009 while (true) {4010 if ((l instanceof sc_Pair))4011 {4012 (ender = (l.car));4013 (ender_set = ((sc_state_117 = (sc_states_114[j])), (sc_state_117[(ender+(1))])));4014 if ((ender_set!== false))4015 {4016 (k = (ender_set[(2)]));4017 (n = sc_n_118);4018 while ((k>=(0))) {4019 if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)))4020 {4021 (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)));4022 (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)));4023 (k = (ender_set[(k+(5))]));4024 (n +=(nb_prev_trees*nb_ender_trees));4025 }4026 else4027 (k = (ender_set[(k+(5))]));4028 }4029 return (sc_loop1_116((l.cdr), n));4030 }4031 else4032 (l = (l.cdr));4033 }4034 else4035 return sc_n_118;4036 }4037 }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0))))));4038 };4039 BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) {4040 var conf_set;4041 var state;4042 var sc_conf_124;4043 var l;4044 var nb_trees;4045 var BgL_sc_nbzd2nts_125zd2;4046 var BgL_sc_ntza2_126za2;4047 {4048 (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119)));4049 if ((BgL_sc_ntza2_126za2!== false))4050 {4051 (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length));4052 (l = (sc_enders_120[BgL_sc_ntza2_126za2]));4053 (nb_trees = (0));4054 while ((l instanceof sc_Pair)) {4055 {4056 (sc_conf_124 = (l.car));4057 if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))4058 {4059 (l = (l.cdr));4060 (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));4061 }4062 else4063 (l = (l.cdr));4064 }4065 }4066 return nb_trees;4067 }4068 else4069 return false;4070 }4071 };4072 (lexer = (parser_descr[(0)]));4073 (sc_nts_42 = (parser_descr[(1)]));4074 (sc_starters_41 = (parser_descr[(2)]));4075 (sc_enders_40 = (parser_descr[(3)]));4076 (sc_predictors_39 = (parser_descr[(4)]));4077 (sc_steps_38 = (parser_descr[(5)]));4078 (sc_names_37 = (parser_descr[(6)]));4079 (falseHead1128 = (new sc_Pair(null, null)));4080 (L1125 = (lexer(input)));4081 (tail1129 = falseHead1128);4082 while (!(L1125 === null)) {4083 {4084 (tok = (L1125.car));4085 (l1 = (tok.cdr));4086 (l2 = null);4087 while ((l1 instanceof sc_Pair)) {4088 {4089 (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42)));4090 if ((sc_i_29!== false))4091 {4092 (l1 = (l1.cdr));4093 (l2 = (new sc_Pair(sc_i_29, l2)));4094 }4095 else4096 (l1 = (l1.cdr));4097 }4098 }4099 (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2)))));4100 (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null)));4101 (tail1129.cdr = sc_optrOpnd_21);4102 (tail1129 = (tail1129.cdr));4103 (L1125 = (L1125.cdr));4104 }4105 }4106 (sc_optrOpnd_20 = (falseHead1128.cdr));4107 (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20)));4108 (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length));4109 (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length));4110 (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2)));4111 (goal_starters = (sc_starters_41[(0)]));4112 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0)));4113 (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42));4114 (sc_i_28 = (0));4115 while ((sc_i_28<BgL_sc_nbzd2toks_35zd2)) {4116 {4117 (tok_nts = ((sc_toks_36[sc_i_28]).cdr));4118 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (sc_i_28+(1)), tok_nts, sc_i_28));4119 (forw(sc_states_33, (sc_i_28+(1)), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42));4120 (++sc_i_28);4121 }4122 }4123 (nb_toks = (sc_toks_36.length));4124 (BgL_sc_nbzd2confs_32zd2 = (sc_steps_38.length));4125 (BgL_sc_nbzd2nts_31zd2 = (sc_nts_42.length));4126 (BgL_sc_statesza2_30za2 = (make_states(nb_toks, BgL_sc_nbzd2confs_32zd2)));4127 (goal_enders = (sc_enders_40[(0)]));4128 (l = goal_enders);4129 while ((l instanceof sc_Pair)) {4130 {4131 (conf = (l.car));4132 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_33, BgL_sc_statesza2_30za2, nb_toks, conf, (0)));4133 (l = (l.cdr));4134 }4135 }4136 (i = nb_toks);4137 while ((i>=(0))) {4138 {4139 (states = sc_states_33);4140 (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2);4141 (state_num = i);4142 (sc_enders_26 = sc_enders_40);4143 (sc_steps_25 = sc_steps_38);4144 (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2);4145 (toks = sc_toks_36);4146 (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i]));4147 loop1 = function() {4148 var sc_loop1_127;4149 var prev;4150 var BgL_sc_statesza2_128za2;4151 var sc_states_129;4152 var j;4153 var i;4154 var sc_i_130;4155 var head;4156 var conf_set;4157 var sc_conf_131;4158 {4159 (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)]));4160 if ((sc_conf_131>=(0)))4161 {4162 (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))]));4163 (head = (conf_set[(4)]));4164 (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)]));4165 (conf_set_merge_new_bang(conf_set));4166 (sc_i_130 = head);4167 while ((sc_i_130>=(0))) {4168 {4169 (i = sc_i_130);4170 (j = state_num);4171 (sc_states_129 = states);4172 (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2);4173 (prev = (sc_conf_131-(1)));4174 if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0))))4175 {4176 sc_loop1_127 = function(l) {4177 var k;4178 var ender_set;4179 var state;4180 var ender;4181 var l;4182 while (true) {4183 if ((l instanceof sc_Pair))4184 {4185 (ender = (l.car));4186 (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))])));4187 if ((ender_set!== false))4188 {4189 (k = (ender_set[(2)]));4190 while ((k>=(0))) {4191 {4192 if ((k>=i))4193 if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false))4194 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k));4195 (k = (ender_set[(k+(5))]));4196 }4197 }4198 return (sc_loop1_127((l.cdr)));4199 }4200 else4201 (l = (l.cdr));4202 }4203 else4204 return undefined;4205 }4206 };4207 (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])])));4208 }4209 (sc_i_130 = (conf_set[(sc_i_130+(5))]));4210 }4211 }4212 return (loop1());4213 }4214 else4215 return undefined;4216 }4217 };4218 (loop1());4219 (--i);4220 }4221 }4222 (optrOpnd = BgL_sc_statesza2_30za2);4223 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];4224 }4225 };4226 }4227 };4228 BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) {4229 var is_parsed;4230 var states;4231 var enders;4232 var nts;4233 return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states)));4234 };4235 BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) {4236 var BgL_sc_derivzd2treesza2_132z70;4237 var states;4238 var toks;4239 var names;4240 var steps;4241 var enders;4242 var nts;4243 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)));4244 };4245 BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) {4246 var BgL_sc_nbzd2derivzd2treesza2_133za2;4247 var states;4248 var toks;4249 var steps;4250 var enders;4251 var nts;4252 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)));4253 };4254 test = function(k) {4255 var x;4256 var p;4257 return ((p = (BgL_makezd2parserzd2(const_earley, function(l) {4258 var sc_x_134;4259 var tail1134;4260 var L1130;4261 var falseHead1133;4262 {4263 (falseHead1133 = (new sc_Pair(null, null)));4264 (tail1134 = falseHead1133);4265 (L1130 = l);4266 while (!(L1130 === null)) {4267 {4268 (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null)));4269 (tail1134 = (tail1134.cdr));4270 (L1130 = (L1130.cdr));4271 }4272 }4273 return (falseHead1133.cdr);4274 }4275 }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k)))));4276 };4277 BgL_earleyzd2benchmarkzd2 = function() {4278 var args = null;4279 for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) {4280 args = sc_cons(arguments[sc_tmp], args);4281 }4282 var k;4283 return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() {4284 return (test(k));4285 }, function(result) {4286 return ((sc_display(result)), (sc_newline()), result == 132);4287 })));4288 };4289}4290/************* END OF GENERATED CODE *************/4291// Invoke this function to run a benchmark.4292// The first argument is a string identifying the benchmark.4293// The second argument is the number of times to run the benchmark.4294// The third argument is a function that runs the benchmark.4295// The fourth argument is a unary function that warns if the result4296// returned by the benchmark is incorrect.4297//4298// Example:4299// RunBenchmark("new Array()",4300// 1,4301// function () { new Array(1000000); }4302// function (v) {4303// return (v instanceof Array) && (v.length == 1000000);4304// });4305SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {});4306SC_ERROR_OUT = SC_DEFAULT_OUT;4307function RunBenchmark(name, count, run, warn) {4308 for (var n = 0; n < count; ++n) {4309 result = run();4310 if (!warn(result)) {4311 throw new Error("Earley or Boyer did incorrect number of rewrites");4312 }4313 }4314}...
v8-earley-boyer.js
Source:v8-earley-boyer.js
1// This file is automatically generated by scheme2js, except for the2// benchmark harness code at the beginning and end of the file.3/************* GENERATED FILE - DO NOT EDIT *************/4/************* GENERATED FILE - DO NOT EDIT *************/5/************* GENERATED FILE - DO NOT EDIT *************/6/************* GENERATED FILE - DO NOT EDIT *************/7/************* GENERATED FILE - DO NOT EDIT *************/8/************* GENERATED FILE - DO NOT EDIT *************/9/************* GENERATED FILE - DO NOT EDIT *************/10/************* GENERATED FILE - DO NOT EDIT *************/11/*12 * To use write/prints/... the default-output port has to be set first.13 * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values14 * should do the trick.15 * In the following example the std-out and error-port are redirected to16 * a DIV.17function initRuntime() {18 function escapeHTML(s) {19 var tmp = s;20 tmp = tmp.replace(/&/g, "&");21 tmp = tmp.replace(/</g, "<");22 tmp = tmp.replace(/>/g, ">");23 tmp = tmp.replace(/ /g, " ");24 tmp = tmp.replace(/\n/g, "<br />");25 tmp = tmp.replace(/\t/g, "  ");26 return tmp;27 28 }29 document.write("<div id='stdout'></div>");30 SC_DEFAULT_OUT = new sc_GenericOutputPort(31 function(s) {32 var stdout = document.getElementById('stdout');33 stdout.innerHTML = stdout.innerHTML + escapeHTML(s);34 });35 SC_ERROR_OUT = SC_DEFAULT_OUT;36}37*/38function sc_print_debug() {39 sc_print.apply(null, arguments);40}41/*** META ((export *js*)) */42var sc_JS_GLOBALS = this;43var __sc_LINE=-1;44var __sc_FILE="";45/*** META ((export #t)) */46function sc_alert() {47 var len = arguments.length;48 var s = "";49 var i;50 for( i = 0; i < len; i++ ) {51 s += sc_toDisplayString(arguments[ i ]);52 }53 return alert( s );54}55/*** META ((export #t)) */56function sc_typeof( x ) {57 return typeof x;58}59/*** META ((export #t)) */60function sc_error() {61 var a = [sc_jsstring2symbol("*error*")];62 for (var i = 0; i < arguments.length; i++) {63 a[i+1] = arguments[i];64 }65 throw a;66}67/*** META ((export #t)68 (peephole (prefix "throw ")))69*/70function sc_raise(obj) {71 throw obj;72}73/*** META ((export with-handler-lambda)) */74function sc_withHandlerLambda(handler, body) {75 try {76 return body();77 } catch(e) {78 if (!e._internalException)79 return handler(e);80 else81 throw e;82 }83}84var sc_properties = new Object();85/*** META ((export #t)) */86function sc_putpropBang(sym, key, val) {87 var ht = sc_properties[sym];88 if (!ht) {89 ht = new Object();90 sc_properties[sym] = ht;91 }92 ht[key] = val;93}94/*** META ((export #t)) */95function sc_getprop(sym, key) {96 var ht = sc_properties[sym];97 if (ht) {98 if (key in ht)99 return ht[key];100 else101 return false;102 } else103 return false;104}105/*** META ((export #t)) */106function sc_rempropBang(sym, key) {107 var ht = sc_properties[sym];108 if (ht)109 delete ht[key];110}111/*** META ((export #t)) */112function sc_any2String(o) {113 return jsstring2string(sc_toDisplayString(o));114} 115/*** META ((export #t)116 (peephole (infix 2 2 "==="))117 (type bool))118*/119function sc_isEqv(o1, o2) {120 return (o1 === o2);121}122/*** META ((export #t)123 (peephole (infix 2 2 "==="))124 (type bool))125*/126function sc_isEq(o1, o2) {127 return (o1 === o2);128}129/*** META ((export #t)130 (type bool))131*/132function sc_isNumber(n) {133 return (typeof n === "number");134}135/*** META ((export #t)136 (type bool))137*/138function sc_isComplex(n) {139 return sc_isNumber(n);140}141/*** META ((export #t)142 (type bool))143*/144function sc_isReal(n) {145 return sc_isNumber(n);146}147/*** META ((export #t)148 (type bool))149*/150function sc_isRational(n) {151 return sc_isReal(n);152}153/*** META ((export #t)154 (type bool))155*/156function sc_isInteger(n) {157 return (parseInt(n) === n);158}159/*** META ((export #t)160 (type bool)161 (peephole (postfix ", false")))162*/163// we don't have exact numbers...164function sc_isExact(n) {165 return false;166}167/*** META ((export #t)168 (peephole (postfix ", true"))169 (type bool))170*/171function sc_isInexact(n) {172 return true;173}174/*** META ((export = =fx =fl)175 (type bool)176 (peephole (infix 2 2 "===")))177*/178function sc_equal(x) {179 for (var i = 1; i < arguments.length; i++)180 if (x !== arguments[i])181 return false;182 return true;183}184/*** META ((export < <fx <fl)185 (type bool)186 (peephole (infix 2 2 "<")))187*/188function sc_less(x) {189 for (var i = 1; i < arguments.length; i++) {190 if (x >= arguments[i])191 return false;192 x = arguments[i];193 }194 return true;195}196/*** META ((export > >fx >fl)197 (type bool)198 (peephole (infix 2 2 ">")))199*/200function sc_greater(x, y) {201 for (var i = 1; i < arguments.length; i++) {202 if (x <= arguments[i])203 return false;204 x = arguments[i];205 }206 return true;207}208/*** META ((export <= <=fx <=fl)209 (type bool)210 (peephole (infix 2 2 "<=")))211*/212function sc_lessEqual(x, y) {213 for (var i = 1; i < arguments.length; i++) {214 if (x > arguments[i])215 return false;216 x = arguments[i];217 }218 return true;219}220/*** META ((export >= >=fl >=fx)221 (type bool)222 (peephole (infix 2 2 ">=")))223*/224function sc_greaterEqual(x, y) {225 for (var i = 1; i < arguments.length; i++) {226 if (x < arguments[i])227 return false;228 x = arguments[i];229 }230 return true;231}232/*** META ((export #t)233 (type bool)234 (peephole (postfix "=== 0")))235*/236function sc_isZero(x) {237 return (x === 0);238}239/*** META ((export #t)240 (type bool)241 (peephole (postfix "> 0")))242*/243function sc_isPositive(x) {244 return (x > 0);245}246/*** META ((export #t)247 (type bool)248 (peephole (postfix "< 0")))249*/250function sc_isNegative(x) {251 return (x < 0);252}253/*** META ((export #t)254 (type bool)255 (peephole (postfix "%2===1")))256*/257function sc_isOdd(x) {258 return (x % 2 === 1);259}260/*** META ((export #t)261 (type bool)262 (peephole (postfix "%2===0")))263*/264function sc_isEven(x) {265 return (x % 2 === 0);266}267/*** META ((export #t)) */268var sc_max = Math.max;269/*** META ((export #t)) */270var sc_min = Math.min;271/*** META ((export + +fx +fl)272 (peephole (infix 0 #f "+" "0")))273*/274function sc_plus() {275 var sum = 0;276 for (var i = 0; i < arguments.length; i++)277 sum += arguments[i];278 return sum;279}280/*** META ((export * *fx *fl)281 (peephole (infix 0 #f "*" "1")))282*/283function sc_multi() {284 var product = 1;285 for (var i = 0; i < arguments.length; i++)286 product *= arguments[i];287 return product;288}289/*** META ((export - -fx -fl)290 (peephole (minus)))291*/292function sc_minus(x) {293 if (arguments.length === 1)294 return -x;295 else {296 var res = x;297 for (var i = 1; i < arguments.length; i++)298 res -= arguments[i];299 return res;300 }301}302/*** META ((export / /fl)303 (peephole (div)))304*/305function sc_div(x) {306 if (arguments.length === 1)307 return 1/x;308 else {309 var res = x;310 for (var i = 1; i < arguments.length; i++)311 res /= arguments[i];312 return res;313 }314}315/*** META ((export #t)) */316var sc_abs = Math.abs;317/*** META ((export quotient /fx)318 (peephole (hole 2 "parseInt(" x "/" y ")")))319*/320function sc_quotient(x, y) {321 return parseInt(x / y);322}323/*** META ((export #t)324 (peephole (infix 2 2 "%")))325*/326function sc_remainder(x, y) {327 return x % y;328}329/*** META ((export #t)330 (peephole (modulo)))331*/332function sc_modulo(x, y) {333 var remainder = x % y;334 // if they don't have the same sign335 if ((remainder * y) < 0)336 return remainder + y;337 else338 return remainder;339}340function sc_euclid_gcd(a, b) {341 var temp;342 if (a === 0) return b;343 if (b === 0) return a;344 if (a < 0) {a = -a;};345 if (b < 0) {b = -b;};346 if (b > a) {temp = a; a = b; b = temp;};347 while (true) {348 a %= b;349 if(a === 0) {return b;};350 b %= a;351 if(b === 0) {return a;};352 };353 return b;354}355/*** META ((export #t)) */356function sc_gcd() {357 var gcd = 0;358 for (var i = 0; i < arguments.length; i++)359 gcd = sc_euclid_gcd(gcd, arguments[i]);360 return gcd;361}362/*** META ((export #t)) */363function sc_lcm() {364 var lcm = 1;365 for (var i = 0; i < arguments.length; i++) {366 var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm));367 lcm *= Math.abs(f);368 }369 return lcm;370}371// LIMITATION: numerator and denominator don't make sense in floating point world.372//var SC_MAX_DECIMALS = 1000000373//374// function sc_numerator(x) {375// var rounded = Math.round(x * SC_MAX_DECIMALS);376// return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));377// }378// function sc_denominator(x) {379// var rounded = Math.round(x * SC_MAX_DECIMALS);380// return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));381// }382/*** META ((export #t)) */383var sc_floor = Math.floor;384/*** META ((export #t)) */385var sc_ceiling = Math.ceil;386/*** META ((export #t)) */387var sc_truncate = parseInt;388/*** META ((export #t)) */389var sc_round = Math.round;390// LIMITATION: sc_rationalize doesn't make sense in a floating point world.391/*** META ((export #t)) */392var sc_exp = Math.exp;393/*** META ((export #t)) */394var sc_log = Math.log;395/*** META ((export #t)) */396var sc_sin = Math.sin;397/*** META ((export #t)) */398var sc_cos = Math.cos;399/*** META ((export #t)) */400var sc_tan = Math.tan;401/*** META ((export #t)) */402var sc_asin = Math.asin;403/*** META ((export #t)) */404var sc_acos = Math.acos;405/*** META ((export #t)) */406var sc_atan = Math.atan;407/*** META ((export #t)) */408var sc_sqrt = Math.sqrt;409/*** META ((export #t)) */410var sc_expt = Math.pow;411// LIMITATION: we don't have complex numbers.412// LIMITATION: the following functions are hence not implemented.413// LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle414// LIMITATION: 2 argument atan415/*** META ((export #t)416 (peephole (id)))417*/418function sc_exact2inexact(x) {419 return x;420}421/*** META ((export #t)422 (peephole (id)))423*/424function sc_inexact2exact(x) {425 return x;426}427function sc_number2jsstring(x, radix) {428 if (radix)429 return x.toString(radix);430 else431 return x.toString();432}433function sc_jsstring2number(s, radix) {434 if (s === "") return false;435 if (radix) {436 var t = parseInt(s, radix);437 if (!t && t !== 0) return false;438 // verify that each char is in range. (parseInt ignores leading439 // white and trailing chars)440 var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1);441 if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s))442 return t;443 else return false;444 } else {445 var t = +s; // does not ignore trailing chars.446 if (!t && t !== 0) return false;447 // simply verify that first char is not whitespace.448 var c = s.charAt(0);449 // if +c is 0, but the char is not "0", then we have a whitespace.450 if (+c === 0 && c !== "0") return false;451 return t;452 }453}454/*** META ((export #t)455 (type bool)456 (peephole (not)))457*/458function sc_not(b) {459 return b === false;460}461/*** META ((export #t)462 (type bool))463*/464function sc_isBoolean(b) {465 return (b === true) || (b === false);466}467function sc_Pair(car, cdr) {468 this.car = car;469 this.cdr = cdr;470}471sc_Pair.prototype.toString = function() {472 return sc_toDisplayString(this);473};474sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {475 var current = this;476 var res = "(";477 while(true) {478 res += writeOrDisplay(current.car);479 if (sc_isPair(current.cdr)) {480 res += " ";481 current = current.cdr;482 } else if (current.cdr !== null) {483 res += " . " + writeOrDisplay(current.cdr);484 break;485 } else // current.cdr == null486 break;487 }488 489 res += ")";490 return res;491};492sc_Pair.prototype.sc_toDisplayString = function() {493 return this.sc_toWriteOrDisplayString(sc_toDisplayString);494};495sc_Pair.prototype.sc_toWriteString = function() {496 return this.sc_toWriteOrDisplayString(sc_toWriteString);497};498// sc_Pair.prototype.sc_toWriteCircleString in IO.js499/*** META ((export #t)500 (type bool)501 (peephole (postfix " instanceof sc_Pair")))502*/503function sc_isPair(p) {504 return (p instanceof sc_Pair);505}506function sc_isPairEqual(p1, p2, comp) {507 return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr));508}509/*** META ((export #t)510 (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))511*/512function sc_cons(car, cdr) {513 return new sc_Pair(car, cdr);514}515/*** META ((export cons*)) */516function sc_consStar() {517 var res = arguments[arguments.length - 1];518 for (var i = arguments.length-2; i >= 0; i--)519 res = new sc_Pair(arguments[i], res);520 return res;521}522/*** META ((export #t)523 (peephole (postfix ".car")))524*/525function sc_car(p) {526 return p.car;527}528/*** META ((export #t)529 (peephole (postfix ".cdr")))530*/531function sc_cdr(p) {532 return p.cdr;533}534/*** META ((export #t)535 (peephole (hole 2 p ".car = " val)))536*/537function sc_setCarBang(p, val) {538 p.car = val;539}540/*** META ((export #t)541 (peephole (hole 2 p ".cdr = " val)))542*/543function sc_setCdrBang(p, val) {544 p.cdr = val;545}546/*** META ((export #t)547 (peephole (postfix ".car.car")))548*/549function sc_caar(p) { return p.car.car; }550/*** META ((export #t)551 (peephole (postfix ".cdr.car")))552*/553function sc_cadr(p) { return p.cdr.car; }554/*** META ((export #t)555 (peephole (postfix ".car.cdr")))556*/557function sc_cdar(p) { return p.car.cdr; }558/*** META ((export #t)559 (peephole (postfix ".cdr.cdr")))560*/561function sc_cddr(p) { return p.cdr.cdr; }562/*** META ((export #t)563 (peephole (postfix ".car.car.car")))564*/565function sc_caaar(p) { return p.car.car.car; }566/*** META ((export #t)567 (peephole (postfix ".car.cdr.car")))568*/569function sc_cadar(p) { return p.car.cdr.car; }570/*** META ((export #t)571 (peephole (postfix ".cdr.car.car")))572*/573function sc_caadr(p) { return p.cdr.car.car; }574/*** META ((export #t)575 (peephole (postfix ".cdr.cdr.car")))576*/577function sc_caddr(p) { return p.cdr.cdr.car; }578/*** META ((export #t)579 (peephole (postfix ".car.car.cdr")))580*/581function sc_cdaar(p) { return p.car.car.cdr; }582/*** META ((export #t)583 (peephole (postfix ".cdr.car.cdr")))584*/585function sc_cdadr(p) { return p.cdr.car.cdr; }586/*** META ((export #t)587 (peephole (postfix ".car.cdr.cdr")))588*/589function sc_cddar(p) { return p.car.cdr.cdr; }590/*** META ((export #t)591 (peephole (postfix ".cdr.cdr.cdr")))592*/593function sc_cdddr(p) { return p.cdr.cdr.cdr; }594/*** META ((export #t)595 (peephole (postfix ".car.car.car.car")))596*/597function sc_caaaar(p) { return p.car.car.car.car; }598/*** META ((export #t)599 (peephole (postfix ".car.cdr.car.car")))600*/601function sc_caadar(p) { return p.car.cdr.car.car; }602/*** META ((export #t)603 (peephole (postfix ".cdr.car.car.car")))604*/605function sc_caaadr(p) { return p.cdr.car.car.car; }606/*** META ((export #t)607 (peephole (postfix ".cdr.cdr.car.car")))608*/609function sc_caaddr(p) { return p.cdr.cdr.car.car; }610/*** META ((export #t)611 (peephole (postfix ".car.car.car.cdr")))612*/613function sc_cdaaar(p) { return p.car.car.car.cdr; }614/*** META ((export #t)615 (peephole (postfix ".car.cdr.car.cdr")))616*/617function sc_cdadar(p) { return p.car.cdr.car.cdr; }618/*** META ((export #t)619 (peephole (postfix ".cdr.car.car.cdr")))620*/621function sc_cdaadr(p) { return p.cdr.car.car.cdr; }622/*** META ((export #t)623 (peephole (postfix ".cdr.cdr.car.cdr")))624*/625function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; }626/*** META ((export #t)627 (peephole (postfix ".car.car.cdr.car")))628*/629function sc_cadaar(p) { return p.car.car.cdr.car; }630/*** META ((export #t)631 (peephole (postfix ".car.cdr.cdr.car")))632*/633function sc_caddar(p) { return p.car.cdr.cdr.car; }634/*** META ((export #t)635 (peephole (postfix ".cdr.car.cdr.car")))636*/637function sc_cadadr(p) { return p.cdr.car.cdr.car; }638/*** META ((export #t)639 (peephole (postfix ".cdr.cdr.cdr.car")))640*/641function sc_cadddr(p) { return p.cdr.cdr.cdr.car; }642/*** META ((export #t)643 (peephole (postfix ".car.car.cdr.cdr")))644*/645function sc_cddaar(p) { return p.car.car.cdr.cdr; }646/*** META ((export #t)647 (peephole (postfix ".car.cdr.cdr.cdr")))648*/649function sc_cdddar(p) { return p.car.cdr.cdr.cdr; }650/*** META ((export #t)651 (peephole (postfix ".cdr.car.cdr.cdr")))652*/653function sc_cddadr(p) { return p.cdr.car.cdr.cdr; }654/*** META ((export #t)655 (peephole (postfix ".cdr.cdr.cdr.cdr")))656*/657function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; }658/*** META ((export #t)) */659function sc_lastPair(l) {660 if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected");661 var res = l;662 var cdr = l.cdr;663 while (sc_isPair(cdr)) {664 res = cdr;665 cdr = res.cdr;666 }667 return res;668}669/*** META ((export #t)670 (type bool)671 (peephole (postfix " === null")))672*/673function sc_isNull(o) {674 return (o === null);675}676/*** META ((export #t)677 (type bool))678*/679function sc_isList(o) {680 var rabbit;681 var turtle;682 var rabbit = o;683 var turtle = o;684 while (true) {685 if (rabbit === null ||686 (rabbit instanceof sc_Pair && rabbit.cdr === null))687 return true; // end of list688 else if ((rabbit instanceof sc_Pair) &&689 (rabbit.cdr instanceof sc_Pair)) {690 rabbit = rabbit.cdr.cdr;691 turtle = turtle.cdr;692 if (rabbit === turtle) return false; // cycle693 } else694 return false; // not pair695 }696}697/*** META ((export #t)) */698function sc_list() {699 var res = null;700 var a = arguments;701 for (var i = a.length-1; i >= 0; i--)702 res = new sc_Pair(a[i], res);703 return res;704}705/*** META ((export #t)) */706function sc_iota(num, init) {707 var res = null;708 if (!init) init = 0;709 for (var i = num - 1; i >= 0; i--)710 res = new sc_Pair(i + init, res);711 return res;712}713/*** META ((export #t)) */714function sc_makeList(nbEls, fill) {715 var res = null;716 for (var i = 0; i < nbEls; i++)717 res = new sc_Pair(fill, res);718 return res;719}720/*** META ((export #t)) */721function sc_length(l) {722 var res = 0;723 while (l !== null) {724 res++;725 l = l.cdr;726 }727 return res;728}729/*** META ((export #t)) */730function sc_remq(o, l) {731 var dummy = { cdr : null };732 var tail = dummy;733 while (l !== null) {734 if (l.car !== o) {735 tail.cdr = sc_cons(l.car, null);736 tail = tail.cdr;737 }738 l = l.cdr;739 }740 return dummy.cdr;741}742/*** META ((export #t)) */743function sc_remqBang(o, l) {744 var dummy = { cdr : null };745 var tail = dummy;746 var needsAssig = true;747 while (l !== null) {748 if (l.car === o) {749 needsAssig = true;750 } else {751 if (needsAssig) {752 tail.cdr = l;753 needsAssig = false;754 }755 tail = l;756 }757 l = l.cdr;758 }759 tail.cdr = null;760 return dummy.cdr;761}762/*** META ((export #t)) */763function sc_delete(o, l) {764 var dummy = { cdr : null };765 var tail = dummy;766 while (l !== null) {767 if (!sc_isEqual(l.car, o)) {768 tail.cdr = sc_cons(l.car, null);769 tail = tail.cdr;770 }771 l = l.cdr;772 }773 return dummy.cdr;774}775/*** META ((export #t)) */776function sc_deleteBang(o, l) {777 var dummy = { cdr : null };778 var tail = dummy;779 var needsAssig = true;780 while (l !== null) {781 if (sc_isEqual(l.car, o)) {782 needsAssig = true;783 } else {784 if (needsAssig) {785 tail.cdr = l;786 needsAssig = false;787 }788 tail = l;789 }790 l = l.cdr;791 }792 tail.cdr = null;793 return dummy.cdr;794}795function sc_reverseAppendBang(l1, l2) {796 var res = l2;797 while (l1 !== null) {