{eval(readFile("Worlds2_Library"));(Array["prototype"]["each"]=(function (f){for(var idx=(0);(idx < this["length"]);idx++){f(this[idx],idx)}}));WJSParser=objectThatDelegatesTo(BSJSParser,{ "isKeyword":function(){var $elf=this,_fromIdx=this.input.idx,x;return (function(){x=this._apply("anything");return this._or((function(){return this._pred((x == "thisWorld"))}),(function(){return BSJSParser._superApplyWithArgs(this,"isKeyword",x)}))}).call(this)}, "primExprHd":function(){var $elf=this,_fromIdx=this.input.idx;return this._or((function(){return (function(){this._applyWithArgs("token","thisWorld");return ["thisWorld"]}).call(this)}),(function(){return BSJSParser._superApplyWithArgs(this,"primExprHd")}))}, "stmt":function(){var $elf=this,_fromIdx=this.input.idx,w,b;return this._or((function(){return (function(){this._applyWithArgs("token","in");w=this._apply("expr");b=this._apply("block");return ["in",w,b]}).call(this)}),(function(){return BSJSParser._superApplyWithArgs(this,"stmt")}))}});(makeFunction=(function (fs,body){return ((((((((((((("(function() { var staticScope = thisScope;" + " var r = function() {") + " var oldScope = thisScope;") + " thisScope = staticScope.makeChild();") + " thisScope.set(\"arguments\", arguments);") + " thisWorld.set(arguments, \"length\", arguments.length);") + " for (var i = 0; i < arguments.length; i++) thisWorld.set(arguments, i, arguments[i]);") + " try { ") + fs) + body) + "}") + " finally { thisScope = oldScope }};") + " baseWorld.set(r, \"prototype\", {parent: Object.prototype});") + " return r })()")}));(makeIn=(function (w,body){return (((((("{ try { worldStack.push(thisWorld); thisWorld = " + w) + "; ") + body) + "} ") + "finally { thisWorld = worldStack.pop() }") + "undefined }")}));(makeForIn=(function (v,e,s,decl){{var p=tempnam();var ps=tempnam()};var r=(((((((((((((((((("for (var " + p) + " in ") + ps) + " = thisWorld.props(") + e) + ", {})) {") + "if (!") + ps) + ".hasOwnProperty(") + p) + ")) continue; ") + "thisScope.set(\"") + v) + "\", ") + p) + "); ") + s) + "}");if(decl){(r=((("thisScope.decl(\"" + v) + "\", undefined); ") + r))}else{undefined};(r=(((("{ var " + ps) + " = undefined; ") + r) + "}"));return r}));WJSTranslator=objectThatDelegatesTo(BSJSTranslator,{ "initialize":function(){var $elf=this,_fromIdx=this.input.idx;return ($elf["level"]=(0))}, "fargs":function(){var $elf=this,_fromIdx=this.input.idx,fs;return (function(){this._form((function(){return fs=this._many((function(){return this._apply("anything")}))}));return (function (){var ss=[];fs.each((function (v,i){ss.push((((("thisScope.decl(\"" + v) + "\", arguments[") + i) + "]);"))}));return ss.join("")}).call(this)}).call(this)}, "thisWorld":function(){var $elf=this,_fromIdx=this.input.idx;return "thisWorld"}, "var":function(){var $elf=this,_fromIdx=this.input.idx,n,v;return (function(){n=this._apply("anything");v=this._apply("trans");return (((("thisScope.decl(\"" + n) + "\", ") + v) + ")")}).call(this)}, "get":function(){var $elf=this,_fromIdx=this.input.idx,n;return (function(){n=this._apply("anything");return (("thisScope.get(\"" + n) + "\")")}).call(this)}, "getp":function(){var $elf=this,_fromIdx=this.input.idx,p,p,x;return this._or((function(){return (function(){p=this._apply("trans");this._form((function(){return (function(){this._applyWithArgs("exactly","get");return this._applyWithArgs("exactly","arguments")}).call(this)}));return (("arguments[" + p) + "]")}).call(this)}),(function(){return (function(){p=this._apply("trans");x=this._apply("trans");return (((("thisWorld.get(" + x) + ", ") + p) + ")")}).call(this)}))}, "set":function(){var $elf=this,_fromIdx=this.input.idx,n,v,p,v,p,x,v;return this._or((function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","get");return n=this._apply("anything")}).call(this)}));v=this._apply("trans");return (((("thisScope.set(\"" + n) + "\", ") + v) + ")")}).call(this)}),(function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","getp");p=this._apply("trans");return this._form((function(){return (function(){this._applyWithArgs("exactly","get");return this._applyWithArgs("exactly","arguments")}).call(this)}))}).call(this)}));v=this._apply("trans");return "UNSUPPORTED OPERATION"}).call(this)}),(function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","getp");p=this._apply("trans");return x=this._apply("trans")}).call(this)}));v=this._apply("trans");return (((((("thisWorld.set(" + x) + ", ") + p) + ", ") + v) + ")")}).call(this)}))}, "mset":function(){var $elf=this,_fromIdx=this.input.idx,n,op,rhs,p,x,op,rhs;return this._or((function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","get");return n=this._apply("anything")}).call(this)}));op=this._apply("anything");rhs=this._apply("trans");return ((((((("thisScope.set(\"" + n) + "\", thisScope.get(\"") + n) + "\")") + op) + rhs) + ")")}).call(this)}),(function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","getp");p=this._apply("trans");return x=this._apply("trans")}).call(this)}));op=this._apply("anything");rhs=this._apply("trans");return (((((((("(function(r, p) { return thisWorld.set(r, p, thisWorld.get(r, p) " + op) + " ") + rhs) + ") })(") + x) + ", ") + p) + ")")}).call(this)}))}, "preop":function(){var $elf=this,_fromIdx=this.input.idx,op,n,op,p,x;return this._or((function(){return (function(){op=this._apply("anything");this._form((function(){return (function(){this._applyWithArgs("exactly","get");return n=this._apply("anything")}).call(this)}));return (((((("thisScope.set(\"" + n) + "\", thisScope.get(\"") + n) + "\")") + op[(0)]) + "1)")}).call(this)}),(function(){return (function(){op=this._apply("anything");this._form((function(){return (function(){this._applyWithArgs("exactly","getp");p=this._apply("trans");return x=this._apply("trans")}).call(this)}));return (((((("(function(r, p) { return thisWorld.set(r, p, thisWorld.get(r, p) " + op[(0)]) + " 1) })(") + x) + ", ") + p) + ")")}).call(this)}))}, "postop":function(){var $elf=this,_fromIdx=this.input.idx,op,n,op,p,x;return this._or((function(){return (function(){op=this._apply("anything");this._form((function(){return (function(){this._applyWithArgs("exactly","get");return n=this._apply("anything")}).call(this)}));return (((((("(function(n) { var ans = thisScope.get(n); " + "thisScope.set(n, ans ") + op[(0)]) + " 1); ") + "return ans })(\"") + n) + "\")")}).call(this)}),(function(){return (function(){op=this._apply("anything");this._form((function(){return (function(){this._applyWithArgs("exactly","getp");p=this._apply("trans");return x=this._apply("trans")}).call(this)}));return (((((((("(function(r, p) { var ans = thisWorld.get(r, p); " + "thisWorld.set(r, p, ans ") + op[(0)]) + " 1); ") + "return ans })(") + x) + ", ") + p) + ")")}).call(this)}))}, "binop":function(){var $elf=this,_fromIdx=this.input.idx,x,y,op,x,y;return this._or((function(){return (function(){switch(this._apply('anything')){case "instanceof":return (function(){x=this._apply("trans");y=this._apply("trans");return (((("instanceOf(" + x) + ", ") + y) + ")")}).call(this);default: throw fail}}).call(this)}),(function(){return (function(){op=this._apply("anything");x=this._apply("trans");y=this._apply("trans");return (((((("(" + x) + " ") + op) + " ") + y) + ")")}).call(this)}))}, "call":function(){var $elf=this,_fromIdx=this.input.idx,f,as;return (function(){f=this._apply("trans");as=this._many((function(){return this._apply("trans")}));return (((("(" + f) + ")(") + as.join(",")) + ")")}).call(this)}, "send":function(){var $elf=this,_fromIdx=this.input.idx,m,r,as;return (function(){m=this._apply("anything");r=this._apply("trans");as=this._many((function(){return this._apply("trans")}));return (((((("send(\"" + m) + "\", ") + r) + ", [") + as.join(",")) + "])")}).call(this)}, "new":function(){var $elf=this,_fromIdx=this.input.idx,x,as;return (function(){x=this._apply("anything");as=this._many((function(){return this._apply("trans")}));return (((("thisScope.get(\"" + x) + "\").worldsNew(") + as.join(",")) + ")")}).call(this)}, "func":function(){var $elf=this,_fromIdx=this.input.idx,fs,body;return (function(){fs=this._apply("fargs");$elf["level"]++;body=this._apply("trans");$elf["level"]--;return makeFunction(fs,body)}).call(this)}, "in":function(){var $elf=this,_fromIdx=this.input.idx,w,b;return (function(){w=this._apply("trans");b=this._apply("trans");return makeIn(w,b)}).call(this)}, "arr":function(){var $elf=this,_fromIdx=this.input.idx,xs;return (function(){xs=this._many((function(){return this._apply("trans")}));return (("[" + xs.join(",")) + "].toWJSArray()")}).call(this)}, "json":function(){var $elf=this,_fromIdx=this.input.idx,xs;return (function(){xs=this._many((function(){return this._apply("trans")}));return (("({" + xs.join(",")) + "}).toWJSObject()")}).call(this)}, "try":function(){var $elf=this,_fromIdx=this.input.idx,x,name,c,f;return (function(){x=this._apply("curlyTrans");name=this._apply("anything");c=this._apply("curlyTrans");f=this._apply("curlyTrans");return (function (){var e=tempnam();return (((((((((((("try " + x) + "catch(") + e) + ") {thisScope.decl(\"") + name) + "\", ") + e) + "); ") + c) + "}") + "finally") + f)}).call(this)}).call(this)}, "forIn":function(){var $elf=this,_fromIdx=this.input.idx,v,e,s,v,init,e,s;return this._or((function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","get");return v=this._apply("anything")}).call(this)}));e=this._apply("trans");s=this._apply("trans");return makeForIn(v,e,s,false)}).call(this)}),(function(){return (function(){this._form((function(){return (function(){this._applyWithArgs("exactly","var");v=this._apply("anything");return init=this._apply("anything")}).call(this)}));e=this._apply("trans");s=this._apply("trans");return makeForIn(v,e,s,true)}).call(this)}))}});(compileWJS=(function (code){var tree=WJSParser.matchAll(code,"topLevel",undefined,(function (m,i){throw objectThatDelegatesTo(fail,({"errorPos": i}))}));var code=WJSTranslator.match(tree,"trans");return code}));thisScope.decl("eval",(function (s){return eval(compileWJS(s))}));(oldPrint=print);(print=(function (x){oldPrint((((x == undefined) || (x == null))?x:send("toString",x)))}));(translateCode=compileWJS)}