-
Notifications
You must be signed in to change notification settings - Fork 1
/
lisp2js.min.js
38 lines (38 loc) · 18.2 KB
/
lisp2js.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var node_environment=!1,vm=null;"undefined"!=typeof module&&(vm=require("vm"),node_environment=!0);var $List,car,cdr,cons,list,list_module,slice=[].slice;
list_module=function(){var n,x,w;n=function(k,f){this.first=k;this.rest=f;return null};n.prototype.length=function(){var k;k=function(f,r){return null===f?r:k(f.rest,r+1)};return k(this,0)};n.prototype.toString=function(){function k(f,r){return null===f?r+")":f instanceof n?k(f.rest,r+(null===f.first?"()":f.first instanceof Array?"["+f.first.toString()+"]":f.first.toString())+(null===f.rest?"":", ")):r.slice(0,-2)+" . "+f.toString()+")"}return k(this,"(")};n.prototype.reverse=function(){var k;k=function(f,
r){return f instanceof n?k(f.rest,x(f.first,r)):null===f?r:x(f,r)};return k(this,null)};n.prototype.slice=function(k,f){var r,n,w;void 0===f&&(f=null);if(null===f)return 0>k&&(k=this.length()+k),n=function(f,k){return 0===k?f:n(f.rest,k-1)},n(this,k);if(0>k||0>f)r=this.length(),k=0>k?r+k:k,f=0>f?r+f:f;w=function(f,k,r){return 0===k?0===r||null===f?null:x(f.first,w(f.rest,k,r-1)):w(f.rest,k-1,r)};return w(this,k,f-k)};n.prototype.ref=function(k){var f;0>k&&(k=this.length()+k);f=function(k,n){return null===
k?null:0===n?k.first:f(k.rest,n-1)};return f(this,k)};n.prototype.append=function(){var k,f;f=1<=arguments.length?slice.call(arguments,0):[];f=w.apply(w,f);k=function(f,n){return null===f?n:x(f.first,k(f.rest,n))};return k(this,f)};n.prototype.toArray=function(){var k,f;k=[];f=function(r){if(null===r)return k;k.push(r.first);return f(r.rest)};return f(this)};n.prototype.forEach=function(k){var f;f=function(r){if(null===r)return null;k(r.first);return f(r.rest)};return f(this)};n.prototype.foreach=
n.prototype.forEach;n.prototype.map=function(k){var f;f=function(r){return null===r?null:x(k(r.first),f(r.rest))};return f(this)};n.prototype.filter=function(k){var f;f=function(r){return null===r?null:k(r.first)?x(r.first,f(r.rest)):f(r.rest)};return f(this)};x=function(k,f){return new n(k,f)};w=function(){var k,f;k=1<=arguments.length?slice.call(arguments,0):[];f=function(k,n){return n===k.length?null:x(k[n],f(k,n+1))};return f(k,0)};return{list:w,cons:x,List:n,car:function(k){return k.first},cdr:function(k){return k.rest}}}();
$List=list_module.List;list=list_module.list;cons=list_module.cons;car=list_module.car;cdr=list_module.cdr;"undefined"!==typeof module&&(module.exports.$List=$List,module.exports.list=list,module.exports.cons=cons,module.exports.car=car,module.exports.cdr=cdr);
var lisp_module=function(){function n(a){for(var d=[],e=0,b=0;b<a.length;b++)if("("===a[b])d.push("("),e++;else if("["===a[b]){if(0!==b&&" "!==a[b-1]&&"\n"!==a[b-1]&&"\t"!==a[b-1]&&"'"!==a[b-1]&&"`"!==a[b-1]&&"~"!==a[b-1]&&"("!==a[b-1]&&"{"!==a[b-1]&&"["!==a[b-1])if(g=d.length-1,h=")"===d[g]?1:0,0===h)d.push("get"),d.push(d[g]),d[g]="(";else{d.push("");d.push("");d[g+2]=d[g];for(--g;;){d[g+2]=d[g];")"===d[g]&&h++;"("===d[g]&&h--;if(0===h)break;g--}d[g]="(";d[g+1]="get"}else d.push("("),d.push("Array");
e++}else if("{"===a[b])d.push("("),d.push("Object"),e++;else if(")"===a[b]||"]"===a[b]||"}"===a[b])d.push(")"),e--;else if(" "!==a[b]&&"\n"!==a[b]&&"\t"!=a[b]&&","!=a[b])if("~"===a[b]&&"@"===a[b+1])d.push("~@"),b++;else if("`"===a[b]||"~"===a[b]||"'"===a[b])d.push(a[b]);else if(";"===a[b])for(;b!=a.length&&"\n"!==a[b];)b++;else if('"'===a[b]){for(var l=b+1;l!=a.length;)if("\\"===a[l])l+=2;else{if('"'===a[l])break;l++}d.push(a.slice(b,l+1));b=l}else{for(l=b+1;l!==a.length&&" "!==a[l]&&"\n"!==a[l]&&
"\t"!==a[l]&&","!==a[l]&&")"!==a[l]&&"("!==a[l]&&"]"!==a[l]&&"["!==a[l]&&"{"!==a[l]&&"}"!==a[l]&&"'"!==a[l]&&"`"!==a[l]&&"~"!==a[l]&&";"!==a[l]&&":"!==a[l]&&"."!==a[l];)l+=1;var f=a.slice(b,l);if("."===f[0]&&")"===d[d.length-1]&&" "!==a[b-1]&&"\n"!==a[b-1]&&"\t"!==a[b-1]){var h=1,g=d.length-1;d.push("");d.push("");d[g+2]=d[g];for(--g;;){d[g+2]=d[g];")"===d[g]&&h++;"("===d[g]&&h--;if(0===h)break;g--}d[g]="(";d[g+1]="get";d.push('"'+f.slice(1)+'"');d.push(")")}else"."===f[0]&&0<b&&" "!==a[b-1]&&"\t"!==
a[b-1]&&"\n"!==a[b-1]&&"{"!==a[b-1]&&"("!==a[b-1]&&"}"!==a[b-1]&&")"!==a[b-1]&&"["!==a[b-1]?(b=d[d.length-1],d[d.length-1]="(",d.push("get"),d.push(b),d.push('"'+f.slice(1)+'"'),d.push(")")):"."===f[0]&&'"'===a[b-1]?d[d.length-1]+=f:d.push(f);b=l-1}return 0!==e?null:d}function x(a){var d={"'":"quote","~":"unquote","~@":"unquote-splice","`":"quasiquote"};if(null===a)return null;var e=null,b,l=null,f=null;for(b=a.length-1;0<=b;b--)if(")"===a[b])l=cons(e,l),e=null;else if("("===a[b]){if(0===b||"~@"!==
a[b-1]&&"'"!==a[b-1]&&"~"!==a[b-1]&&"`"!==a[b-1])if(null!==e&&"Array"===e.first){f=[];for(e=e.rest;null!==e;)f.push(e.first),e=e.rest;e=cons(f,car(l))}else e=cons(e,car(l));else e=cons(cons(d[a[b-1]],cons(e,null)),car(l)),b--;l=cdr(l)}else f=a[b],0===b||"~@"!==a[b-1]&&"'"!==a[b-1]&&"~"!==a[b-1]&&"`"!==a[b-1]?e=cons(f,e):(e=cons(cons(d[a[b-1]],cons(f,null)),e),b--);return e}function w(a,d){for(var e=null,b=a.length-1;0<=b;b--)var f=a[b],e="number"===typeof f?cons(f,e):"string"===typeof f&&'"'===f[0]?
cons(f,e):"string"===typeof f?cons('"'+f+'"',e):f instanceof Array?cons(w(f),e):f instanceof $List?"unquote"===f.first&&d===r?cons(f.rest.first,e):cons(d(f),e):cons(f,e);return e}function k(a){if(null===a)return null;var d=a.first;return d instanceof $List?cons("cons",cons(k(d),cons(k(a.rest),null))):"string"===typeof d&&"."===d?cons("quote",cons(a.rest.first,null)):d instanceof Array?cons("cons",cons(cons("Array",w(d,k)),cons(k(a.rest),null))):cons("cons",cons(cons("quote",cons(d,null)),cons(k(a.rest),
null)))}function f(a){for(var d="",e=0;e<a.length;e++)var b=a.charCodeAt(e),d=47<b&&58>b||64<b&&91>b||96<b&&123>b||"$"===a[e]||"_"===a[e]||"."===a[e]||"&"===a[e]||255<b?d+a[e]:d+("_$"+b+"_");isNaN(d[0])||(d="_"+d);return d}function r(a){if(null===a)return null;v=a.first;return v instanceof $List?"string"===typeof v.first&&"unquote"===v.first?cons("cons",cons(v.rest.first,cons(r(cdr(a)),null))):"string"==typeof v.first&&"unquote-splice"===v.first?cons("append",cons(v.rest.first,cons(r(a.rest),null))):
cons("cons",cons(r(v),cons(r(a.rest),null))):"string"===typeof v&&"."===v?cons("quote",cons(a.rest.first,null)):v instanceof Array?cons("cons",cons(cons("Array",w(v,r)),cons(k(a.rest),null))):cons("cons",cons(cons("quote",cons(v,null)),cons(r(a.rest),null)))}function G(a,d,e){for(var b=0;;){if(b===a.length&&b===d.length)return e;if(b===a.length&&b!==d.length||b!==a.length&&b===d.length&&"."!==a[b])return 0;if(a[b]instanceof Array&&d[b]instanceof Array){if(!G(a[b],d[b],e))return 0;b+=1}else{if(a[b]instanceof
Array&&!(d[b]instanceof Array))return 0;if("string"===typeof a[b]&&"#"===a[b][0])if("string"===typeof d[b]&&a[b].slice(1)===d[b])b+=1;else return 0;else{if("string"===typeof a[b]&&"."===a[b])return e[a[b+1]]=d,e;e[a[b]]=d[b];b+=1}}}}function I(a,d){d=d.toArray();for(var e=function(a){if(null===a)return null;if(a.first instanceof $List)return cons(cons("list",e(a.first)),e(a.rest));if('"'===a.first[0]){for(var b="",d=0;d<a.first.length;d++)b='"'===a.first[d]?b+'\\"':"\\"===a.first[d]?b+"\\\\":"\n"===
a.first[d]?b+"\\n":"\t"===a.first[d]?b+"\\t":b+a.first[d];return cons('"'+b+'"',e(a.rest))}return null===a.first?cons(a.first,e(a.rest)):cons('"'+f(a.first)+'"',e(a.rest))};null!==a;){var b=G(a.first,d,{});if(b){var l="(function(){",k;for(k in b)l=b[k]instanceof $List?l+("var "+f(k)+" = "+m(cons("list",e(b[k])))+";"):null===b[k]?l+("var "+f(k)+" = null; "):l+("var "+f(k)+" = "+m('"'+b[k])+'";');l+="return ("+m(a.rest.first)+");";l+="})();";if(node_environment)try{return vm.runInContext(l,D,"lisp.vm")}catch(h){return y(h)}else try{return window.eval(l)}catch(g){return y(g)}}a=
a.rest.rest}return y("ERROR: Failed to expand macro\n")}function C(a){for(var d="",e=!1;null!==a;){var b=a.first,b=m(b,null,null,null,!0);if("string"===typeof b&&":"===b[0])for(!1===e?(d+="(",e=!0):d+=", ",d+="{"+b.slice(1)+": "+m(a.rest.first,null,null,null,!0),a=a.rest.rest;;){if(null===a){d+="}";break}b=m(a.first,null,null,null,!0);if(":"!==b[0]){d+="}, "+b;break}if(null===a.rest)return y("ERROR: Invalid parameter name");var f=m(a.rest.first,null,null,null,!0),d=d+(", "+b.slice(1)+": "+f);a=a.rest.rest}else!1===
e?(d+="(",e=!0):d+=", ",d+=b;if(null===a||null===a.rest)break;a=a.rest}e&&(d+=")");return 0===d.trim().length?"()":d}function J(a){return f(a)===a&&isNaN(a)?a:'"'+a+'"'}function K(a){if('"'===a[0]||"."==a[0]){var d="."===a[0]?a.slice(1):a.slice(1,-1);return d===f(d)&&isNaN(d)?"."+d:"["+a+"]"}return"["+a+"]"}function y(a){console.log(a);return""}function m(a,d,e,b,l,t){var h;if(null===a)return b?"return null":"null";if(a instanceof Array){c=b?"return [":"[";for(h=0;h<a.length;h++)c+=m(a[h],null,null,
null,!0),h!==a.length-1&&(c+=", ");return c+"]"}if(a instanceof $List){var g=car(a),c,n,u,p,q;if("def"===g||":="===g||"set!"===g||"const"===g)return n=car(cdr(a)),u=null===cdr(cdr(a))?null:null!==cdr(cdr(cdr(a)))?cons("fn",cons(car(cdr(cdr(a))),cdr(cdr(cdr(a))))):a.rest.rest.first,n=m(n),u=m(u,null,null,null,!0,n),c=("def"===g||":="===g?"var ":"const"===g?"const ":"")+n+" = "+u+" ",b?c+"; return "+n:c;if("Array"===g){c=b?"return [":"[";for(a=cdr(a);null!==a;)c+=m(car(a),null,null,null,!0),null!==
cdr(a)&&(c+=", "),a=cdr(a);return c+="]"}if("Object"===g){c=b?"return {":"{";for(a=a.rest;null!==a;){p=m(a.first,null,null,null,!0);if(":"===p[0])if(null!==a.rest&&":"!==a.rest.first[0])b=J(p.slice(1)),c+=b+": ";else{c+=p.slice(1)+(null===a.rest?"":", ");a=a.rest;continue}else c="'"===p[0]||'"'===p[0]?c+(p+": "):c+("["+p+"]: ");b=m(a.rest.first,null,null,null,!0);c+=b;null!==a.rest.rest&&(c+=", ");a=a.rest.rest}return c+="}"}if("quote"===g||"quasiquote"===g)return a.rest.first instanceof $List?(u=
m("quote"===g?k(a.rest.first):r(a.rest.first)),b?"return "+u:u):null===a.rest?b?"return null":"null":isNaN(a.rest.first)?(c='"'===a.rest.first[0]?a.rest.first:'"'+a.rest.first+'"',b?"return "+c:c):b?"return "+a.rest.first:a.rest.first;if("defn"===g||"fn"===g||"fn*"===g||"\u03bb"===g||"\u03bb*"===g||"=>"===g){c="defn"===g||"fn"===g||"\u03bb"===g?"function ":"fn*"===g||"\u03bb*"===g?"function* ":"";b&&(c="return "+c);b="";"string"===typeof a.rest.first?(t=a.rest.first,b+=a.rest.first+"(",q=a.rest.rest.first,
a=a.rest.rest.rest):(b+="(",q=a.rest.first,a=a.rest.rest);l=[];var w={};d=0;var x=!1,A=null;if(!(q instanceof Array))return y("Invalid experssion: ");for(h=0;h<q.length;h++)if(e=q[h],"string"!==typeof e){if("Object"!==e.first)return y("ERROR: Invalid parameters");d++;for(e=e.rest;null!==e;)n=m(e.first),n='"'===n[0]?n.slice(1,-1):n,n=":"===n[0]?n.slice(1):n,u=m(e.rest.first,null,null,null,!0),w[n]=u,e=e.rest.rest;b+="__lisp_args__";h<q.length-1&&h+1<q.length&&"&"!==q[h+1]&&"."!==q[h+1]&&(b+=", ");
l.push(w)}else if(e=m(e),"&"===e){d++;A=m(q[h+1]);break}else if("."===e){d++;A=m(q[h+1]);x=!0;break}else":"===e[0]?(d++,e=e.slice(1),b+=e,l.push([e,m(q[h+1],null,null,null,!0)]),h+=1):(d++,b+=e),h<q.length-1&&h+1<q.length&&"&"!==q[h+1]&&"."!==q[h+1]&&(b+=", ");e=[t?t:!1];b="=>"===g?b+")=>{":b+"){";A&&(b+="for(var "+A+" = [], $__0 = "+(d-1)+"; $__0 < arguments.length; $__0++)"+A+"[$__0 - "+(d-1)+"] = arguments[$__0];",x&&(b+=A+" = list.apply(null, "+A+");"));for(h=0;h<l.length;h++)if(u=l[h],u.constructor===
Array)n=u[0],b+=n+" = ("+n+" === void 0 ? "+u[1]+" : "+n+" );";else for(p in b+="var __lisp_args_v__;",b+="__lisp_args__ = (__lisp_args__ === void 0 ? {} : __lisp_args__); ",u)b+="var "+p+" = ((__lisp_args_v__ = __lisp_args__."+p+") === void 0 ? "+u[p]+" : __lisp_args_v__); ";b+=E(a,!0,null,e);!1!==e[0]&&e[0]!==t&&(c+=e[0]);return c+(b+"}")}if("let"===g){t={};e=a.rest.first;c="((function(){";for(h=0;h<e.length;h+=2)if(n=e[h],u=e[h+1],typeof("string"===n))n in t?c+=n+" = "+m(u)+";":(t[n]=!0,c+="var "+
n+" = "+m(u)+";");else return y("Invalid variable name in let statement: "+n);c+=m(cons("do",a.rest.rest),null,null,!0);c+="})())";return(b?"return ":"")+c}if("cond"===g){u=!1;p=a.rest;c="if(";l&&(c="(function(){"+c);h=m(p.first,null,null,null,!0,null);c=c+h+"){";a=p.rest.first;c+=m(a,!0,e,b||l,null,t);c+="}";for(p=p.rest.rest;null!==p;)if(c+=" else ","else"!==p.first)c+="if (",h=m(p.first,null,null,null,!0),c=c+h+"){",a=p.rest.first,c+=m(a,!0,e,b||l,null,t),c+="}",p=p.rest.rest;else{u=!0;c+="{";
a=p.rest.first;c+=m(a,!0,e,b||l,null,t);c+="}";break}!1===u&&b&&(c+=" else return null");l&&(c+="})()");return c}if("if"===g)return c="(",h=a.rest.first,t=a.rest.rest.first,a=null===a.rest.rest.rest?null:a.rest.rest.rest.first,l?(c+=m(h,null,null,null,!0)+" ? ",c+=m(t,d,e,null,!0,null)+" : ",c+=m(a,d,e,null,!0,null)+")"):null===a?m(list("cond",h,t),d,e,b,l):m(list("cond",h,t,"else",a),d,e,b,l);if("do"===g)return l?"(function (){"+E(a.rest,!0)+"})()":E(a.rest,b,null,e);if("apply"===g)return h=m(a.rest.first),
q=m(a.rest.rest.first,null,null,null,!0),(b?"return ":"")+"("+h+").apply(this, (function(){var temp = "+q+"; return temp instanceof $List ? temp.toArray() : temp})())";if("new"===g)return h=m(a.rest.first),c="(new "+h+""+C(a.rest.rest),c+=")",(b?"return ":"")+c;if("+"===g||"-"===g||"*"===g||"/"===g||"%"===g||"="===g||"<"===g||">"===g||"!="===g||"<="===g||">="===g||"&&"===g||"||"===g||"&"===g||"|"===g||"and"===g||"or"===g||"xor"===g){c="(";q=a.rest;if(null===q.rest)return"+"===g||"*"===g||"%"===g?
(b?"return ":"")+m(q.first,null,null,null,!0):"-"===g?(b?"return ":"")+"(-"+m(q.first,null,null,null,!0)+")":"/"===g?(b?"return ":"")+"(1/"+m(q.first,null,null,null,!0)+")":(b?"return ":"")+"true";e=m(q.first,null,null,null,!0);c+=e;for(q=q.rest;null!==q;)e=m(q.first,null,null,null,!0),"and"===g?g="&&":"or"===g?g="||":"="===g?g="===":"xor"===g&&(g="^"),c+=" "+g+" ",c+=e,null===q.rest||"==="!==g&&"<"!==g&&">"!==g&&"!="!==g&&"<="!==g&&">="!==g||(c+=" && "+e),q=q.rest;return(b?"return ":"")+c+")"}if("case"===
g){u=!1;c=a.rest.first;c=m(c,null,null,null,!0);p=a.rest.rest;c="switch ("+c+"){";for(l&&(c="(function(){"+c);null!==p;)if("else"!==p.first)c+=" case ",h=m(p.first,null,null,null,!0),c+=h+":",a=p.rest.first,c+=m(a,!0,e,b||l,null,t),c+=";"===c[c.length-1]?"":";",b||l||(c+=" break;"),p=p.rest.rest;else{u=!0;c+=" default: ";a=p.rest.first;c+=m(a,!0,e,b||l,null,t);c+=";"===c[c.length-1]?"":";";b||l||(c+=" break;");break}!1===u&&b&&(c+=" default: return null;");c+="}";l&&(c+="})()");return c}if("not"===
g)return(b?"return ":"")+"(!"+m(a.rest.first,null,null,null,!0)+")";if("instanceof"===g)return(b?"return ":"")+"("+m(a.rest.first)+" instanceof "+m(a.rest.rest.first)+")";if("get"===g){u=m(a.rest.first,null,null,null,!0);"super"===u&&(u="this.__super__");c=u;for(t=a.rest.rest;null!==t;)p=m(t.first,null,null,null,!0),c+=K(p),t=t.rest;return(b?"return ":"")+c}if("->"===g){u=m(a.rest.first,null,null,null,!0);"super"===u&&(u="this.__super__");c=u;for(t=a.rest.rest;null!==t;)e=!1,t.first instanceof $List?
(e=!0,p=m(t.first.first,null,null,null,!0)):p=m(t.first,null,null,null,!0),c+=K(p),e&&(q=t.first.rest,c+=C(q)),t=t.rest;return(b?"return ":"")+c}if("loop"===g){c=[];q=[];p=a.rest.first;a=a.rest.rest;for(h=0;h<p.length;h+=2)n=m(p[h]),u=m(p[h+1],null,null,null,!0),c.push(n),q.push(u);u=null;for(h=c.length-1;0<=h;h--)u=cons(q[h],u);return m(cons(cons("fn",cons(c,a)),u),d,e,b,l,t)}if("try"===g)return p=a.rest,a=p.first,c="try{"+m(a,!0,e,b||l,null,t),c+="}",p=p.rest,null!==p&&"catch"===p.first&&(c+="catch(",
a=m(p.rest.first),c+=a+"){",a=p.rest.rest.first,c+=m(a,!0,e,b||l,null,t),c+="}",p=p.rest.rest.rest),null!==p&&"finally"===p.first&&(a=p.rest.first,c+="finally {",c+=m(a,!0,e,b||l,null,t),c+="}"),c;if("throw"===g||"yield"===g)return g+" "+m(a.rest.first,null,null,null,!0)+(b?"; return;":"");if("in"===g)return(b?"return ":"")+"("+m(a.rest.first)+" in "+m(a.rest.rest.first)+")";if("class"===g){t=a.rest.first;u=e=null;c=t+".prototype = {constructor: "+t+"";"extends"===a.rest.rest.first&&(u=a.rest.rest.rest.first,
a=a.rest.rest,c+=", __proto__: "+u+".prototype");for(a=a.rest.rest;null!==a;){p=m(a.first,null,null,null,!0);if(":"===p[0])if(p=J(p.slice(1)),"constructor"===p){if(null!==e)return y("ERROR: redefine the constructor for class "+t);e=a.rest.first;a=a.rest.rest;continue}else c+=", ",c+=p+": ";else"'"===p[0]||'"'===p[0]?(c+=", ",c+=p+": "):(c+=", ",c+="["+p+"]: ");u=m(a.rest.first,null,null,null,!0);c+=u;a=a.rest.rest}c+="};";null!==e&&(h=m(list("def",t,e)));c=h+";"+c;return b?c+"; return "+t+";":l?"(function(){"+
c+" return "+t+";}())":c}if("defmacro"===g){c=m(a.rest.first);if("string"!==typeof c)return y("ERROR: Invalid macro name: "+c.toString());p=a.rest.rest;B[c]=p;return""}if("macroexpand"===g){c=a.rest.first;b=a.rest.rest;t=m(c);if(node_environment)try{z=vm.runInContext(t,D,"lisp.vm"),b=null===b?-1:vm.runInContext(b.first,D,"lisp.vm")}catch(F){return y(F)}else try{z=window.eval(t),b=null===b?-1:window.eval(b.first)}catch(G){return y(G)}if(z.first in B){c=z;for(h=0;;){c=I(B[c.first],c.rest);if(null===
c||!(c.first in B))break;h++;if(h===b)break}return m(list("quote",c),null,null,null,l)}return y("ERROR: macro-expand invalid macro: "+c.toString())}h=a.first;q=a.rest;h=m(h,null,null,null,!0);if("recur"===h&&d)!1===e[0]&&(e[0]="__lisp__recur__$"+H,H+=3),h=e[0],a.first=h;else{if("super"===h)return q=C(q),c="Object.defineProperty(this, '__super__', {value: this.__proto__.__proto__}); "+((b?"return ":"")+"this.__super__.constructor.call(this"+("()"===q?")":", "+q.slice(1)));if("string"===typeof h&&"this.__super__."===
h.slice(0,15)||"this.__super__["===h.slice(0,15))return q=C(q),c="this.__super__"+h.slice(14)+".call(this"+("()"===q?")":", "+q.slice(1)),(b?"return ":"")+c}c=h;"}"!==h[h.length-1]&&isNaN(h)||(c="("+c+")");if(h in B)return c=I(B[h],q),(b?"return ":"")+m(c,d,e,b,l,t);c+=C(q);return(b?"return ":"")+c}return isNaN(a)&&"'"!==a[0]&&'"'!==a[0]&&":"!==a[0]?(b?"return ":"")+f(a):(b?"return ":"")+a}function E(a,d,e,b,f){for(var k="",h,g=!1;null!==a;){d&&null===a.rest&&(g=!0);h=m(a.first,null===a.rest?!0:!1,
b,g);"string"===typeof h&&(h=h.trim());"string"===typeof h&&0!==h.length&&";"!==h[h.length-1]&&(h+=";");if(e)if(node_environment)try{z=vm.runInContext(h,D,"lisp.vm"),f&&console.log(z)}catch(c){return y(c)}else try{z=window.eval(h),f&&console.log(z)}catch(n){return y(n)}k+=h;a=a.rest}return k}var B={},z="",D=null,H=0,F=function(a,d){return null===a?d instanceof $List||null===d?d:cons(d,null):cons(a.first,F(a.rest,d))};node_environment?D=vm.createContext({cons:cons,car:car,cdr:cdr,list:list,$List:$List,
append:F,console:console}):window.append=F;return{lexer:n,parser:x,compiler:m,lisp_compiler:E,compile:function(a,d){var e=n(a);if(null===e)return null;e=x(e);return E(e,!1,!0,null,d)},getEvalResult:function(){return z}}},lisp=lisp_module();"undefined"!==typeof module&&(module.exports.compile=lisp.compile,module.exports.getEvalResult=lisp.getEvalResult);