module('ometa/bs-ometa-compiler.js').requires('ometa.parser','ometa.bs-js-compiler').toRun(function() {
{BSOMetaParser=Object.delegated(Parser,{
"fromTo":function(){var $elf=this,x,y;return (function(){x=this._apply("anything");y=this._apply("anything");this._applyWithArgs("seq",x);this._many((function(){return (function(){this._not((function(){return this._applyWithArgs("seq",y)}));return this._apply("char")}).call(this)}));return this._applyWithArgs("seq",y)}).call(this)},
"space":function(){var $elf=this;return this._or((function(){return Parser._superApplyWithArgs(this,'space')}),(function(){return this._applyWithArgs("fromTo","//","\n")}),(function(){return this._applyWithArgs("fromTo","/*","*/")}))},
"nameFirst":function(){var $elf=this;return this._or((function(){return (function(){switch(this._apply('anything')){case "_":return "_";case "$":return "$";default: throw fail}}).call(this)}),(function(){return this._apply("letter")}))},
"nameRest":function(){var $elf=this;return this._or((function(){return this._apply("nameFirst")}),(function(){return this._apply("digit")}))},
"tsName":function(){var $elf=this,xs;return (function(){xs=this._applyWithArgs("firstAndRest","nameFirst","nameRest");return xs.join("")}).call(this)},
"name":function(){var $elf=this;return (function(){this._apply("spaces");return this._apply("tsName")}).call(this)},
"eChar":function(){var $elf=this,c;return this._or((function(){return (function(){switch(this._apply('anything')){case "\\":return (function(){c=this._apply("char");return unescape(("\\" + c))}).call(this);default: throw fail}}).call(this)}),(function(){return this._apply("char")}))},
"tsString":function(){var $elf=this,xs;return (function(){this._applyWithArgs("exactly","\'");xs=this._many((function(){return (function(){this._not((function(){return this._applyWithArgs("exactly","\'")}));return this._apply("eChar")}).call(this)}));this._applyWithArgs("exactly","\'");return xs.join("")}).call(this)},
"characters":function(){var $elf=this,xs;return (function(){this._applyWithArgs("exactly","`");this._applyWithArgs("exactly","`");xs=this._many((function(){return (function(){this._not((function(){return (function(){this._applyWithArgs("exactly","\'");return this._applyWithArgs("exactly","\'")}).call(this)}));return this._apply("eChar")}).call(this)}));this._applyWithArgs("exactly","\'");this._applyWithArgs("exactly","\'");return ["App","seq",xs.join("").toProgramString()]}).call(this)},
"sCharacters":function(){var $elf=this,xs;return (function(){this._applyWithArgs("exactly","\"");xs=this._many((function(){return (function(){this._not((function(){return this._applyWithArgs("exactly","\"")}));return this._apply("eChar")}).call(this)}));this._applyWithArgs("exactly","\"");return ["App","token",xs.join("").toProgramString()]}).call(this)},
"string":function(){var $elf=this,xs;return (function(){xs=this._or((function(){return (function(){(function(){switch(this._apply('anything')){case "#":return "#";case "`":return "`";default: throw fail}}).call(this);return this._apply("tsName")}).call(this)}),(function(){return this._apply("tsString")}));return ["App","exactly",xs.toProgramString()]}).call(this)},
"number":function(){var $elf=this,sign,ds;return (function(){sign=this._or((function(){return (function(){switch(this._apply('anything')){case "-":return "-";default: throw fail}}).call(this)}),(function(){return (function(){this._apply("empty");return ""}).call(this)}));ds=this._many1((function(){return this._apply("digit")}));return ["App","exactly",(sign + ds.join(""))]}).call(this)},
"keyword":function(){var $elf=this,xs;return (function(){xs=this._apply("anything");this._applyWithArgs("token",xs);this._not((function(){return this._apply("letterOrDigit")}));return xs}).call(this)},
"args":function(){var $elf=this,xs;return this._or((function(){return (function(){switch(this._apply('anything')){case "(":return (function(){xs=this._applyWithArgs("listOf","hostExpr",",");this._applyWithArgs("token",")");return xs}).call(this);default: throw fail}}).call(this)}),(function(){return (function(){this._apply("empty");return []}).call(this)}))},
"application":function(){var $elf=this,rule,as,grm,rule,as,rule,as;return this._or((function(){return (function(){this._applyWithArgs("token","^");rule=this._apply("name");as=this._apply("args");return ["App","super",(("\'" + rule) + "\'")].concat(as)}).call(this)}),(function(){return (function(){grm=this._apply("name");this._applyWithArgs("token",".");rule=this._apply("name");as=this._apply("args");return ["App","foreign",grm,(("\'" + rule) + "\'")].concat(as)}).call(this)}),(function(){return (function(){rule=this._apply("name");as=this._apply("args");return ["App",rule].concat(as)}).call(this)}))},
"hostExpr":function(){var $elf=this,r;return (function(){r=this._applyWithArgs("foreign",BSJSParser,'expr');return this._applyWithArgs("foreign",BSJSTranslator,'trans',r)}).call(this)},
"atomicHostExpr":function(){var $elf=this,r;return (function(){r=this._applyWithArgs("foreign",BSJSParser,'semAction');return this._applyWithArgs("foreign",BSJSTranslator,'trans',r)}).call(this)},
"curlyHostExpr":function(){var $elf=this,r;return (function(){r=this._applyWithArgs("foreign",BSJSParser,'curlySemAction');return this._applyWithArgs("foreign",BSJSTranslator,'trans',r)}).call(this)},
"semAction":function(){var $elf=this,x,x;return this._or((function(){return (function(){this._or((function(){return this._applyWithArgs("token","!")}),(function(){return this._applyWithArgs("token","->")}));x=this._apply("atomicHostExpr");return ["Act",x]}).call(this)}),(function(){return (function(){x=this._apply("curlyHostExpr");return ["Act",x]}).call(this)}))},
"semPred":function(){var $elf=this,x;return (function(){this._applyWithArgs("token","?");x=this._apply("atomicHostExpr");return ["Pred",x]}).call(this)},
"expr":function(){var $elf=this,x,xs,x,xs;return this._or((function(){return (function(){x=this._apply("expr4ne");xs=this._many1((function(){return (function(){this._applyWithArgs("token","|");return this._apply("expr4ne")}).call(this)}));return ["Or",x].concat(xs)}).call(this)}),(function(){return (function(){x=this._apply("expr4ne");xs=this._many1((function(){return (function(){this._applyWithArgs("token","||");return this._apply("expr4ne")}).call(this)}));return ["XOr",x].concat(xs)}).call(this)}),(function(){return this._apply("expr4")}))},
"expr4ne":function(){var $elf=this,xs;return (function(){xs=this._many1((function(){return this._apply("expr3")}));return ["And"].concat(xs)}).call(this)},
"expr4":function(){var $elf=this,xs;return (function(){xs=this._many((function(){return this._apply("expr3")}));return ["And"].concat(xs)}).call(this)},
"optIter":function(){var $elf=this,x;return (function(){x=this._apply("anything");return this._or((function(){return (function(){this._applyWithArgs("token","*");return ["Many",x]}).call(this)}),(function(){return (function(){this._applyWithArgs("token","+");return ["Many1",x]}).call(this)}),(function(){return (function(){this._apply("empty");return x}).call(this)}))}).call(this)},
"expr3":function(){var $elf=this,x,x,n,n;return this._or((function(){return (function(){x=this._apply("expr2");x=this._applyWithArgs("optIter",x);return this._or((function(){return (function(){switch(this._apply('anything')){case ":":return (function(){n=this._apply("name");return (function (){this["locals"].push(n);return ["Set",n,x]}).call(this)}).call(this);default: throw fail}}).call(this)}),(function(){return (function(){this._apply("empty");return x}).call(this)}))}).call(this)}),(function(){return (function(){this._applyWithArgs("token",":");n=this._apply("name");return (function (){this["locals"].push(n);return ["Set",n,["App","anything"]]}).call(this)}).call(this)}))},
"expr2":function(){var $elf=this,x,x;return this._or((function(){return (function(){this._applyWithArgs("token","~");x=this._apply("expr2");return ["Not",x]}).call(this)}),(function(){return (function(){this._applyWithArgs("token","&");x=this._apply("expr1");return ["Lookahead",x]}).call(this)}),(function(){return this._apply("expr1")}))},
"expr1":function(){var $elf=this,x,x,x;return this._or((function(){return this._apply("application")}),(function(){return this._apply("semAction")}),(function(){return this._apply("semPred")}),(function(){return (function(){x=this._or((function(){return this._applyWithArgs("keyword","undefined")}),(function(){return this._applyWithArgs("keyword","nil")}),(function(){return this._applyWithArgs("keyword","true")}),(function(){return this._applyWithArgs("keyword","false")}));return ["App","exactly",x]}).call(this)}),(function(){return (function(){this._apply("spaces");return this._or((function(){return this._apply("characters")}),(function(){return this._apply("sCharacters")}),(function(){return this._apply("string")}),(function(){return this._apply("number")}))}).call(this)}),(function(){return (function(){this._applyWithArgs("token","[");x=this._apply("expr");this._applyWithArgs("token","]");return ["Form",x]}).call(this)}),(function(){return (function(){this._applyWithArgs("token","(");x=this._apply("expr");this._applyWithArgs("token",")");return x}).call(this)}))},
"ruleName":function(){var $elf=this;return this._or((function(){return this._apply("name")}),(function(){return (function(){this._apply("spaces");return this._apply("tsString")}).call(this)}))},
"rule":function(){var $elf=this,n,x,xs;return (function(){this._lookahead((function(){return n=this._apply("ruleName")}));(this["locals"]=["$elf=this"]);x=this._applyWithArgs("rulePart",n);xs=this._many((function(){return (function(){this._applyWithArgs("token",",");return this._applyWithArgs("rulePart",n)}).call(this)}));return ["Rule",n,this["locals"],["Or",x].concat(xs)]}).call(this)},
"rulePart":function(){var $elf=this,rn,n,b1,b2;return (function(){rn=this._apply("anything");n=this._apply("ruleName");this._pred((n == rn));b1=this._apply("expr4");return this._or((function(){return (function(){this._applyWithArgs("token","=");b2=this._apply("expr");return ["And",b1,b2]}).call(this)}),(function(){return (function(){this._apply("empty");return b1}).call(this)}))}).call(this)},
"grammar":function(){var $elf=this,n,sn,rs;return (function(){this._applyWithArgs("keyword","ometa");n=this._apply("name");sn=this._or((function(){return (function(){this._applyWithArgs("token","<:");return this._apply("name")}).call(this)}),(function(){return (function(){this._apply("empty");return "OMeta"}).call(this)}));this._applyWithArgs("token","{");rs=this._applyWithArgs("listOf","rule",",");this._applyWithArgs("token","}");return this._applyWithArgs("foreign",BSOMetaOptimizer,'optimizeGrammar',["Grammar",n,sn].concat(rs))}).call(this)}});BSOMetaTranslator=Object.delegated(OMeta,{
"trans":function(){var $elf=this,t,ans;return (function(){this._form((function(){return (function(){t=this._apply("anything");return ans=this._applyWithArgs("apply",t)}).call(this)}));return ans}).call(this)},
"App":function(){var $elf=this,args,rule,args,rule;return this._or((function(){return (function(){switch(this._apply('anything')){case "super":return (function(){args=this._many1((function(){return this._apply("anything")}));return [this["sName"],"._superApplyWithArgs(this,",args.join(","),")"].join("")}).call(this);default: throw fail}}).call(this)}),(function(){return (function(){rule=this._apply("anything");args=this._many1((function(){return this._apply("anything")}));return ["this._applyWithArgs(\"",rule,"\",",args.join(","),")"].join("")}).call(this)}),(function(){return (function(){rule=this._apply("anything");return ["this._apply(\"",rule,"\")"].join("")}).call(this)}))},
"Act":function(){var $elf=this,expr;return (function(){expr=this._apply("anything");return expr}).call(this)},
"Pred":function(){var $elf=this,expr;return (function(){expr=this._apply("anything");return ["this._pred(",expr,")"].join("")}).call(this)},
"Or":function(){var $elf=this,xs;return (function(){xs=this._many((function(){return this._apply("transFn")}));return ["this._or(",xs.join(","),")"].join("")}).call(this)},
"XOr":function(){var $elf=this,xs;return (function(){xs=this._many((function(){return this._apply("transFn")}));xs.unshift(((this["name"] + ".") + this["rName"]).toProgramString());return ["this._xor(",xs.join(","),")"].join("")}).call(this)},
"And":function(){var $elf=this,xs,y;return this._or((function(){return (function(){xs=this._many((function(){return this._applyWithArgs("notLast","trans")}));y=this._apply("trans");xs.push(("return " + y));return ["(function(){",xs.join(";"),"}).call(this)"].join("")}).call(this)}),(function(){return "undefined"}))},
"Many":function(){var $elf=this,x;return (function(){x=this._apply("transFn");return ["this._many(",x,")"].join("")}).call(this)},
"Many1":function(){var $elf=this,x;return (function(){x=this._apply("transFn");return ["this._many1(",x,")"].join("")}).call(this)},
"Set":function(){var $elf=this,n,v;return (function(){n=this._apply("anything");v=this._apply("trans");return [n,"=",v].join("")}).call(this)},
"Not":function(){var $elf=this,x;return (function(){x=this._apply("transFn");return ["this._not(",x,")"].join("")}).call(this)},
"Lookahead":function(){var $elf=this,x;return (function(){x=this._apply("transFn");return ["this._lookahead(",x,")"].join("")}).call(this)},
"Form":function(){var $elf=this,x;return (function(){x=this._apply("transFn");return ["this._form(",x,")"].join("")}).call(this)},
"JumpTable":function(){var $elf=this,cases;return (function(){cases=this._many((function(){return this._apply("jtCase")}));return this.jumpTableCode(cases)}).call(this)},
"Rule":function(){var $elf=this,name,ls,body;return (function(){name=this._apply("anything");(this["rName"]=name);ls=this._apply("locals");body=this._apply("trans");return ["\n\"",name,"\":function(){",ls,"return ",body,"}"].join("")}).call(this)},
"Grammar":function(){var $elf=this,name,sName,rules;return (function(){name=this._apply("anything");sName=this._apply("anything");(this["name"]=name);(this["sName"]=sName);rules=this._many((function(){return this._apply("trans")}));return [name,"=","Object.delegated(",sName,",{",rules.join(","),"})"].join("")}).call(this)},
"jtCase":function(){var $elf=this,x,e;return (function(){this._form((function(){return (function(){x=this._apply("anything");return e=this._apply("trans")}).call(this)}));return [x.toProgramString(),e]}).call(this)},
"locals":function(){var $elf=this,vs;return this._or((function(){return (function(){this._form((function(){return vs=this._many1((function(){return this._apply("string")}))}));return ["var ",vs.join(","),";"].join("")}).call(this)}),(function(){return (function(){this._form((function(){return undefined}));return ""}).call(this)}))},
"transFn":function(){var $elf=this,x;return (function(){x=this._apply("trans");return ["(function(){return ",x,"})"].join("")}).call(this)}});(BSOMetaTranslator["jumpTableCode"]=(function (cases){var buf=new StringBuffer();buf.nextPutAll("(function(){switch(this._apply(\'anything\')){");for(var i=(0);(i < cases["length"]);(i+=(1))){buf.nextPutAll((((("case " + cases[i][(0)]) + ":return ") + cases[i][(1)]) + ";"))};buf.nextPutAll("default: throw fail}}).call(this)");return buf.contents()}))}
});