khepri-compile
Advanced tools
Comparing version 0.3.4 to 0.3.5
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/ast.kep' | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/ast.kep' | ||
* DO NOT EDIT | ||
*/"use strict"; | ||
var isPrimitive, isSimple, isTruthy, isBlockFunction, isLambda; | ||
*/ | ||
"use strict"; | ||
var isLiteral, isNumberish, isPrimitive, isSimple, isPod, isTruthy, isBlockFunction, isLambda; | ||
(isLiteral = (function(node) { | ||
return (node.type === "Literal"); | ||
})); | ||
(isNumberish = (function(node) { | ||
return (isPrimitive(node) && (!isNaN(node.value))); | ||
})); | ||
(isPrimitive = (function(node) { | ||
return ((node.type === "Literal") && ((((node.kind === "string") || (node.kind === "number")) || (node.kind === | ||
return (isLiteral(node) && ((((node.kind === "string") || (node.kind === "number")) || (node.kind === | ||
"boolean")) || (node.kind === "null"))); | ||
})); | ||
(isSimple = (function(node) { | ||
return ((isPrimitive(node) || (node.type === "ArrayExpression")) || (node.type === "ObjectExpression")); | ||
return ((isLiteral(node) || (node.type === "ArrayExpression")) || (node.type === "ObjectExpression")); | ||
})); | ||
(isPod = (function(node) { | ||
return (((isPrimitive(node) || (node.type === "ArrayExpression")) && (node.elements.every(isPod) || (node.type === | ||
"ObjectExpression"))) && node.elements.every((function(x) { | ||
return isPod(x.value); | ||
}))); | ||
})); | ||
(isTruthy = (function(node) { | ||
@@ -23,6 +36,9 @@ return (isPrimitive(node) && (!(!node.value))); | ||
})); | ||
(exports["isLiteral"] = isLiteral); | ||
(exports["isNumberish"] = isNumberish); | ||
(exports["isPrimitive"] = isPrimitive); | ||
(exports["isSimple"] = isSimple); | ||
(exports["isPod"] = isPod); | ||
(exports["isTruthy"] = isTruthy); | ||
(exports["isBlockFunction"] = isBlockFunction); | ||
(exports["isLambda"] = isLambda); |
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/builtin.kep' | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/builtin.kep' | ||
* DO NOT EDIT | ||
*/"use strict"; | ||
*/ | ||
"use strict"; | ||
var ast_node = require("khepri-ast")["node"], | ||
@@ -11,3 +12,3 @@ setData = ast_node["setData"], | ||
ast_value = require("khepri-ast")["value"], | ||
builtins, unique = (function() { | ||
builtins, definitions, unique = (function() { | ||
var x = 0; | ||
@@ -18,3 +19,17 @@ return (function() { | ||
}); | ||
})(); | ||
})(), | ||
identifier = (function(loc, name, uid) { | ||
return setData(ast_value.Identifier.create(loc, name), "uid", uid); | ||
}); | ||
(definitions = ({})); | ||
var addSymbol = (function(name, id, def) { | ||
(builtins[name] = id); | ||
(definitions[name] = def); | ||
}), | ||
registerAliasedSymbol = (function(name, alias, def) { | ||
addSymbol(name, identifier(null, alias, unique()), def); | ||
}), | ||
registerSymbol = (function(name, def) { | ||
return registerAliasedSymbol(name, name, def); | ||
}); | ||
(builtins = ({ | ||
@@ -25,4 +40,4 @@ "require": setData(new(ast_value.Identifier)(null, "require"), "uid", unique()), | ||
})); | ||
var unary = (function(uid, op) { | ||
var xArg = setData(ast_value.Identifier.create(null, "x"), "uid", unique()); | ||
var unary = (function(op) { | ||
var xArg = identifier(null, "x", unique()); | ||
return ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, null, [ | ||
@@ -33,3 +48,3 @@ ast_pattern.IdentifierPattern.create(null, xArg) | ||
unaryOp = (function(op) { | ||
return unary(unique(), (function(x) { | ||
return unary((function(x) { | ||
return ast_expression.UnaryExpression.create(null, op, x); | ||
@@ -48,7 +63,15 @@ })); | ||
name = __o[1]; | ||
(builtins[op] = unaryOp(op)); | ||
registerAliasedSymbol(op, name, unaryOp(op)); | ||
})); | ||
var binary = (function(uid, flipped, op) { | ||
var xArg = setData(ast_value.Identifier.create(null, "x"), "uid", unique()), | ||
yArg = setData(ast_value.Identifier.create(null, "y"), "uid", unique()); | ||
var xArg = identifier(null, "x", unique()), | ||
yArg = identifier(null, "y", unique()), | ||
zArg = identifier(null, "z", unique()), | ||
ternaryOperator = ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, | ||
null, [ast_pattern.IdentifierPattern.create(null, xArg), ast_pattern.IdentifierPattern.create(null, yArg), | ||
ast_pattern.IdentifierPattern.create(null, zArg) | ||
]), ast_expression.ConditionalExpression.create(null, xArg, yArg, zArg)); | ||
registerAliasedSymbol("?", "__cond", ternaryOperator); | ||
var binary = (function(flipped, op) { | ||
var xArg = identifier(null, "x", unique()), | ||
yArg = identifier(null, "y", unique()); | ||
return ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, null, [ | ||
@@ -59,3 +82,3 @@ ast_pattern.IdentifierPattern.create(null, xArg), ast_pattern.IdentifierPattern.create(null, yArg) | ||
binaryOp = (function(op, flipped) { | ||
return binary(unique(), flipped, (function(x, y) { | ||
return binary(flipped, (function(x, y) { | ||
return ast_expression.BinaryExpression.create(null, op, x, y); | ||
@@ -65,3 +88,3 @@ })); | ||
logicalOp = (function(op, flipped) { | ||
return binary(unique(), flipped, (function(x, y) { | ||
return binary(flipped, (function(x, y) { | ||
return ast_expression.LogicalExpression.create(null, op, x, y); | ||
@@ -94,4 +117,4 @@ })); | ||
name = __o[1]; | ||
(builtins[op] = binaryOp(op)); | ||
(builtins[("_" + op)] = binaryOp(op, true)); | ||
registerAliasedSymbol(op, name, binaryOp(op)); | ||
registerAliasedSymbol(("_" + op), (name + "r"), binaryOp(op, true)); | ||
})); | ||
@@ -104,58 +127,58 @@ [ | ||
name = __o[1]; | ||
(builtins[op] = logicalOp(op)); | ||
(builtins[("_" + op)] = logicalOp(op, true)); | ||
registerSymbol(op, logicalOp(op)); | ||
registerSymbol(("_" + op), logicalOp(op, true)); | ||
})); | ||
(builtins["new"] = binary(unique(), false, (function(x, y) { | ||
registerAliasedSymbol("new", "__new", binary(false, (function(x, y) { | ||
return ast_expression.NewExpression.create(null, x, [y]); | ||
}))); | ||
(builtins["_new"] = binary(unique(), true, (function(x, y) { | ||
registerAliasedSymbol("_new", "__newr", binary(true, (function(x, y) { | ||
return ast_expression.NewExpression.create(null, x, [y]); | ||
}))); | ||
(builtins["."] = binary(unique(), false, (function(x, y) { | ||
registerAliasedSymbol(".", "__dot", binary(false, (function(x, y) { | ||
return ast_expression.MemberExpression.create(null, x, y, true); | ||
}))); | ||
(builtins["_."] = binary(unique(), true, (function(x, y) { | ||
registerAliasedSymbol("_.", "__dotr", binary(true, (function(x, y) { | ||
return ast_expression.MemberExpression.create(null, x, y, true); | ||
}))); | ||
(builtins["@"] = binary(unique(), false, (function(x, y) { | ||
return ast_expression.CurryExpression.create(null, x, y); | ||
registerAliasedSymbol("@", "__curry", binary(false, (function(x, y) { | ||
return ast_expression.CurryExpression.create(null, x, [y]); | ||
}))); | ||
(builtins["_@"] = binary(unique(), true, (function(x, y) { | ||
return ast_expression.CurryExpression.create(null, x, y); | ||
registerAliasedSymbol("_@", "__curryr", binary(true, (function(x, y) { | ||
return ast_expression.CurryExpression.create(null, x, [y]); | ||
}))); | ||
var pipe = (function(callee, arg) { | ||
return ast_expression.CallExpression.create(null, callee, [arg]); | ||
}); | ||
(builtins["<|"] = (builtins["_|>"] = binary(unique(), false, pipe))); | ||
(builtins["|>"] = (builtins["_<|"] = binary(unique(), true, pipe))); | ||
var identifier = (function(loc, name, uid) { | ||
return setData(ast_value.Identifier.create(loc, name), "uid", uid); | ||
}), | ||
singleCompose = (function(f, g) { | ||
var fo = identifier(null, "f", unique()), | ||
go = identifier(null, "g", unique()), | ||
x = identifier(null, "x", unique()); | ||
return ast_expression.CallExpression.create(null, ast_expression.FunctionExpression.create(null, null, | ||
ast_pattern.ArgumentsPattern.create(null, null, [ast_pattern.IdentifierPattern.create(null, fo), | ||
ast_pattern.IdentifierPattern.create(null, go) | ||
]), ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, | ||
null, [ast_pattern.IdentifierPattern.create(null, x)]), ast_expression.CallExpression.create( | ||
null, fo, [ast_expression.CallExpression.create(null, go, [x])]))), [f, g]); | ||
lPipe = binary(false, pipe), | ||
rPipe = binary(true, pipe); | ||
registerAliasedSymbol("<|", "__pipe", lPipe); | ||
registerAliasedSymbol("_|>", "__rpiper", lPipe); | ||
registerAliasedSymbol("|>", "__rpipe", rPipe); | ||
registerAliasedSymbol("_<|", "__piper", rPipe); | ||
var singleCompose = (function(f, g) { | ||
var x = identifier(null, "x", unique()); | ||
return ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, null, [ | ||
ast_pattern.IdentifierPattern.create(null, x) | ||
]), ast_expression.CallExpression.create(null, f, [ast_expression.CallExpression.create(null, g, [x])])); | ||
}), | ||
multiCompose = (function(f, g) { | ||
return ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, null, []), | ||
ast_expression.CallExpression.create(null, f, [ast_expression.CallExpression.create(null, | ||
ast_expression.MemberExpression.create(null, g, identifier(null, "apply")), [ast_value.Literal | ||
.create(null, "null"), identifier(null, "arguments") | ||
])])); | ||
}), | ||
multiCompose = (function(f, g) { | ||
var fo = identifier(null, "f", unique()), | ||
go = identifier(null, "g", unique()); | ||
return ast_expression.CallExpression.create(null, ast_expression.FunctionExpression.create(null, null, | ||
ast_pattern.ArgumentsPattern.create(null, null, [ast_pattern.IdentifierPattern.create(null, fo), | ||
ast_pattern.IdentifierPattern.create(null, go) | ||
]), ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create(null, | ||
null, []), ast_expression.CallExpression.create(null, fo, [ast_expression.CallExpression.create( | ||
null, ast_expression.MemberExpression.create(null, go, identifier(null, "apply")), [ | ||
ast_value.Literal.create(null, "null"), identifier(null, "arguments") | ||
])]))), [f, g]); | ||
}); | ||
(builtins["<\\"] = (builtins["_\\>"] = binary(unique(), false, singleCompose))); | ||
(builtins["\\>"] = (builtins["_<\\"] = binary(unique(), true, singleCompose))); | ||
(builtins["<<\\"] = (builtins["_\\>>"] = binary(unique(), false, multiCompose))); | ||
(builtins["\\>>"] = (builtins["_<<\\"] = binary(unique(), true, multiCompose))); | ||
(module.exports = builtins); | ||
rCompose = binary(false, singleCompose), | ||
lCompose = binary(true, singleCompose); | ||
registerAliasedSymbol("<\\", "__compose", rCompose); | ||
registerAliasedSymbol("_\\>", "__rcomposer", rCompose); | ||
registerAliasedSymbol("\\>", "__rcompose", lCompose); | ||
registerAliasedSymbol("_<\\", "__composer", lCompose); | ||
var rNCompose = binary(false, multiCompose), | ||
lNCompose = binary(true, multiCompose); | ||
registerAliasedSymbol("<<\\", "__composen", rNCompose); | ||
registerAliasedSymbol("_\\>>", "__rcomposenr", rNCompose); | ||
registerAliasedSymbol("\\>>", "__rcomposen", lNCompose); | ||
registerAliasedSymbol("_<<\\", "__composenr", lNCompose); | ||
(exports["builtins"] = builtins); | ||
(exports["definitions"] = definitions); |
/* | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/compile.kep' | ||
* THIS FILE IS AUTO GENERATED from 'lib/compile.kep' | ||
* DO NOT EDIT | ||
*/ | ||
"use strict"; | ||
*/"use strict"; | ||
var pre_normalize = require("./stages/pre_normalize"), | ||
@@ -37,3 +36,7 @@ lexical = require("./stages/lexical"), | ||
}); | ||
})(ecma_peep, transform), khepri_peep), inline), post_normalize), lexical), pre_normalize); | ||
})(ecma_peep, transform), khepri_peep), inline), post_normalize), lexical), pre_normalize), | ||
extract = (function(__o) { | ||
var tree = __o["tree"]; | ||
return tree; | ||
}); | ||
(compile = (function(f, g) { | ||
@@ -47,6 +50,3 @@ return (function() { | ||
}); | ||
})((function(__o) { | ||
var ast = __o["ast"]; | ||
return ast; | ||
}), compiler), (function(root, options) { | ||
})(extract, compiler), (function(root, options) { | ||
return ({ | ||
@@ -57,2 +57,2 @@ "ast": root, | ||
}))); | ||
(exports["compile"] = compile); | ||
(module.exports = compile); |
/* | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/ecma_peep.kep' | ||
* THIS FILE IS AUTO GENERATED from 'lib/ecma_peep.kep' | ||
* DO NOT EDIT | ||
*/ | ||
"use strict"; | ||
*/"use strict"; | ||
var tree = require("neith")["tree"], | ||
@@ -14,3 +13,2 @@ __o = require("neith")["walk"], | ||
modify = __o1["modify"], | ||
Node = __o1["Node"], | ||
ast_value = require("ecma-ast")["value"], | ||
@@ -20,8 +18,6 @@ ast_declaration = require("ecma-ast")["declaration"], | ||
ast_expression = require("ecma-ast")["expression"], | ||
__o2 = require("./ast"), | ||
isPrimitive = __o2["isPrimitive"], | ||
fun = require("./fun"), | ||
optimize, isPrimitive = (function(node) { | ||
return ((node.type === "Literal") && ((((node.kind === "string") || (node.kind === "number")) || (node.kind === | ||
"boolean")) || (node.kind === "null"))); | ||
}), | ||
peepholes = ({}), | ||
optimize, peepholes = ({}), | ||
addPeephole = (function(types, up, condition, f) { | ||
@@ -28,0 +24,0 @@ var entry = ({ |
@@ -30,10 +30,12 @@ /* | ||
walk = require("zipper-m")["walk"], | ||
builtins = require("./builtin"), | ||
__o3 = require("./ast"), | ||
isLambda = __o3["isLambda"], | ||
__o3 = require("./builtin"), | ||
builtins = __o3["builtins"], | ||
definitions = __o3["definitions"], | ||
__o4 = require("./ast"), | ||
isLambda = __o4["isLambda"], | ||
fun = require("./fun"), | ||
optimize, State = record.declare(null, ["bindings", "stack"]), | ||
optimize, State = record.declare(null, ["bindings", "globals"]), | ||
M = ZipperT(StateT(Unique)), | ||
run = (function(c, ctx, seed) { | ||
return Unique.runUnique(StateT.evalStateT(ZipperT.runZipperT(c, ctx), new(State)(hashtrie.empty, [])), seed); | ||
run = (function(c, ctx, state, seed) { | ||
return Unique.runUnique(StateT.evalStateT(ZipperT.runZipperT(c, ctx), state), seed); | ||
}), | ||
@@ -57,2 +59,11 @@ pass = M.of(null), | ||
}), | ||
addGlobal = (function(name) { | ||
return M.lift(M.inner.modify((function(s) { | ||
return s.setGlobals(hashtrie.set(name, name, s.globals)); | ||
}))); | ||
}), | ||
globals = M.lift(M.inner.get) | ||
.map((function(s) { | ||
return s.globals; | ||
})), | ||
stack = M.lift(M.inner.get) | ||
@@ -90,21 +101,18 @@ .map((function(s) { | ||
}), | ||
when = (function(test, body) { | ||
return node.chain((function(node) { | ||
return (test(node) ? body(node) : pass); | ||
})); | ||
}), | ||
always = (function(_) { | ||
return true; | ||
}); | ||
addPeephole(["UnaryOperatorExpression"], true, always, modify((function(__o) { | ||
addPeephole(["UnaryOperatorExpression"], false, always, node.chain((function(__o) { | ||
var op = __o["op"]; | ||
return builtins[op]; | ||
return seq(addGlobal(op), set(builtins[op])); | ||
}))); | ||
addPeephole(["BinaryOperatorExpression"], true, always, modify((function(__o) { | ||
addPeephole(["BinaryOperatorExpression"], false, always, node.chain((function(__o) { | ||
var op = __o["op"], | ||
flipped = __o["flipped"]; | ||
return builtins[(flipped ? ("_" + op) : op)]; | ||
flipped = __o["flipped"], | ||
name = (flipped ? ("_" + op) : op); | ||
return seq(addGlobal(name), set(builtins[name])); | ||
}))); | ||
addPeephole(["TernaryOperatorExpression"], false, always, seq(addGlobal("?"), set(builtins["?"]))); | ||
addPeephole(["VariableDeclarator"], true, (function(node) { | ||
return ((node.immutable && node.init) && isLambda(node.init)); | ||
return (((node.immutable && node.init) && isLambda(node.init)) && false); | ||
}), node.chain((function(node) { | ||
@@ -114,3 +122,3 @@ return addBinding(node.id.ud.uid, node.init); | ||
addPeephole(["Binding"], true, (function(node) { | ||
return ((node.pattern.id && node.pattern.id.ud) && isLambda(node.value)); | ||
return (((node.pattern.id && node.pattern.id.ud) && (!node.recursive)) && isLambda(node.value)); | ||
}), node.chain((function(node) { | ||
@@ -120,2 +128,22 @@ return addBinding(node.pattern.id.ud.uid, node.value); | ||
addPeephole(["CallExpression"], true, (function(node) { | ||
return ((node.callee.type === "Identifier") && node.callee.ud.uid); | ||
}), node.chain((function(node) { | ||
return getBinding(node.callee.ud.uid) | ||
.chain((function(binding) { | ||
return (binding ? modify((function(node) { | ||
return ast_expression.CallExpression.create(null, binding, node.args); | ||
})) : pass); | ||
})); | ||
}))); | ||
addPeephole(["CurryExpression"], true, (function(node) { | ||
return ((node.base.type === "Identifier") && node.base.ud.uid); | ||
}), node.chain((function(node) { | ||
return getBinding(node.base.ud.uid) | ||
.chain((function(binding) { | ||
return (binding ? modify((function(node) { | ||
return ast_expression.CurryExpression.create(null, binding, node.args); | ||
})) : pass); | ||
})); | ||
}))); | ||
addPeephole(["CallExpression"], true, (function(node) { | ||
return isLambda(node.callee); | ||
@@ -172,22 +200,32 @@ }), unique.chain((function(uid) { | ||
return isLambda(node.base); | ||
}), modify((function(node) { | ||
var first = node.base.params.elements[0], | ||
rest = node.base.params.elements.slice(1), | ||
body = ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create( | ||
null, null, rest, node.base.params.self), node.base.body); | ||
return ((first && (((first.type === "IdentifierPattern") || (first.type === "AsPattern")) || (first.type === | ||
"ObjectPattern"))) ? ast_expression.LetExpression.create(null, [ast_declaration.Binding.create( | ||
null, first, node.args[0])], body) : body); | ||
}), unique.chain((function(uid) { | ||
return modify((function(node) { | ||
var first, rest, map, body; | ||
return ((!node.base.params.elements.length) ? node.base : ((first = node.base.params.elements[ | ||
0]), (rest = node.base.params.elements.slice(1)), (map = [first.id.ud.uid]), ( | ||
body = ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern | ||
.create(null, null, rest, node.base.params.self), rewrite(uid, map, node.base | ||
.body))), ((first && (((first.type === "IdentifierPattern") || (first.type === | ||
"AsPattern")) || (first.type === "ObjectPattern"))) ? ast_expression.LetExpression | ||
.create(null, [rewrite(uid, map, ast_declaration.Binding.create(null, first, | ||
node.args[0]))], body) : body))); | ||
})); | ||
}))); | ||
addPeephole(["CurryExpression"], true, (function(node) { | ||
return ((node.base.type === "LetExpression") && isLambda(node.base.body)); | ||
}), modify((function(node) { | ||
var first = node.base.body.params.elements[0], | ||
rest = node.base.body.params.elements.slice(1), | ||
body = ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern.create( | ||
null, null, rest, node.base.body.params.self), node.base.body.body); | ||
return ((first && (((first.type === "IdentifierPattern") || (first.type === "AsPattern")) || (first.type === | ||
"ObjectPattern"))) ? ast_expression.LetExpression.create(null, fun.concat(node.base.bindings, | ||
ast_declaration.Binding.create(null, first, node.args[0])), body) : ast_expression.LetExpression | ||
.create(null, node.base.bindings, body)); | ||
}), unique.chain((function(uid) { | ||
return modify((function(node) { | ||
var first, rest, map, body; | ||
return ((!node.base.body.params.elements.length) ? node.base : ((first = node.base.body.params | ||
.elements[0]), (rest = node.base.body.params.elements.slice(1)), (map = [first.id | ||
.ud.uid | ||
]), (body = ast_expression.FunctionExpression.create(null, null, ast_pattern.ArgumentsPattern | ||
.create(null, null, rest, node.base.body.params.self), rewrite(uid, map, | ||
node.base.body.body))), ((first && (((first.type === "IdentifierPattern") || | ||
(first.type === "AsPattern")) || (first.type === "ObjectPattern"))) ? | ||
ast_expression.LetExpression.create(null, fun.concat(node.base.bindings, | ||
rewrite(uid, map, ast_declaration.Binding.create(null, first, node.args[ | ||
0]))), body) : ast_expression.LetExpression.create(null, node.base.bindings, | ||
body)))); | ||
})); | ||
}))); | ||
@@ -214,8 +252,30 @@ var upTransforms = (function(node) { | ||
})), | ||
_transformPost = node.chain((function(node) { | ||
return transform(node, upTransforms(node)); | ||
})); | ||
_transformPost = node.chain((function(n) { | ||
var t = upTransforms(n); | ||
return (t.length ? next(transform(n, [t[0]]), node) | ||
.chain((function(x) { | ||
return ((x && (x !== n)) ? _transformPost : pass); | ||
})) : pass); | ||
})), | ||
initialState = Object.keys(builtins) | ||
.reduce((function(s, name) { | ||
var id = builtins[name], | ||
def = definitions[name]; | ||
return s.setBindings(hashtrie.set(id.ud.uid, def, s.bindings)); | ||
}), new(State)(hashtrie.empty, hashtrie.empty)); | ||
(optimize = (function(ast, data) { | ||
return run(next(walk(M, _transform, _transformPost), node), khepriZipper(ast), data.unique); | ||
return run(next(walk(M, _transform, _transformPost), node.chain((function(node) { | ||
return globals.chain((function(g) { | ||
return unique.chain((function(unique) { | ||
return M.of(({ | ||
"tree": node, | ||
"data": ({ | ||
"globals": hashtrie.keys(g), | ||
"unique": unique | ||
}) | ||
})); | ||
})); | ||
})); | ||
}))), khepriZipper(ast), initialState, data.unique); | ||
})); | ||
(exports["optimize"] = optimize); |
@@ -25,7 +25,9 @@ /* | ||
walk = require("zipper-m")["walk"], | ||
builtins = require("./builtin"), | ||
__o2 = require("./builtin"), | ||
builtins = __o2["builtins"], | ||
fun = require("./fun"), | ||
__o2 = require("./ast"), | ||
isPrimitive = __o2["isPrimitive"], | ||
isTruthy = __o2["isTruthy"], | ||
__o3 = require("./ast"), | ||
isPrimitive = __o3["isPrimitive"], | ||
isNumberish = __o3["isNumberish"], | ||
isTruthy = __o3["isTruthy"], | ||
optimize, M = ZipperT(StateT(Unique)), | ||
@@ -47,8 +49,5 @@ run = (function(c, ctx, seed) { | ||
addBinding = (function(uid, target) { | ||
return getBinding((target.ud && target.ud.uid)) | ||
.chain((function(existing) { | ||
return (existing ? addBinding(uid, existing) : M.lift(M.inner.modify((function(bindings) { | ||
return hashtrie.set(uid, target, bindings); | ||
})))); | ||
})); | ||
return M.lift(M.inner.modify((function(bindings) { | ||
return hashtrie.set(uid, target, bindings); | ||
}))); | ||
}), | ||
@@ -163,19 +162,20 @@ peepholes = ({}), | ||
}))); | ||
addPeephole(["MemberExpression"], true, (function(node) { | ||
return ((node.computed && (node.object.type === "ArrayExpression")) && isNumberish(node.property)); | ||
}), modify((function(node) { | ||
return (node.object.elements[node.property.value] || ast_value.Identifier.create(null, "undefined")); | ||
}))); | ||
addPeephole(["VariableDeclarator"], true, (function(node) { | ||
return ((node.immutable && node.init) && (((node.init.type === "Identifier") && (node.init.ud.uid !== node.id | ||
.ud.uid)) || isPrimitive(node.init))); | ||
return (node.immutable && node.init); | ||
}), node.chain((function(node) { | ||
return ((node.init.type === "Identifier") ? getBinding(node.init.ud.uid) | ||
.chain((function(binding) { | ||
return (binding ? addBinding(node.id.ud.uid, binding) : pass); | ||
})) : seq(addBinding(node.id.ud.uid, node.init), set([]))); | ||
return addBinding(node.id.ud.uid, node.init); | ||
}))); | ||
addPeephole(["Binding"], true, (function(node) { | ||
return (((node.pattern.type === "IdentifierPattern") && node.pattern.id.ud) && (((node.value.type === | ||
"Identifier") && (node.value.ud.uid !== node.pattern.id.ud.uid)) || isPrimitive(node.value))); | ||
return ((node.pattern.type === "IdentifierPattern") && node.pattern.id.ud); | ||
}), node.chain((function(node) { | ||
return ((node.value.type === "Identifier") ? getBinding(node.value.ud.uid) | ||
return seq(addBinding(node.pattern.id.ud.uid, node.value), (isPrimitive(node.value) ? set([]) : pass), ( | ||
(node.value.type === "Identifier") ? getBinding(node.value.ud.uid) | ||
.chain((function(binding) { | ||
return (binding ? addBinding(node.value.id.ud.uid, binding) : pass); | ||
})) : seq(addBinding(node.pattern.id.ud.uid, node.value), set([]))); | ||
return (binding ? set([]) : pass); | ||
})) : pass)); | ||
}))); | ||
@@ -187,3 +187,4 @@ addPeephole(["Identifier"], true, (function(node) { | ||
.chain((function(binding) { | ||
return (binding ? set(binding) : pass); | ||
return ((binding && (isPrimitive(binding) || (binding.type === "Identifier"))) ? set( | ||
binding) : pass); | ||
})); | ||
@@ -190,0 +191,0 @@ }))); |
/* | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/lexical.kep' | ||
* THIS FILE IS AUTO GENERATED from 'lib/lexical.kep' | ||
* DO NOT EDIT | ||
*/ | ||
"use strict"; | ||
*/"use strict"; | ||
var ast_node = require("khepri-ast")["node"], | ||
@@ -25,3 +24,2 @@ setData = ast_node["setData"], | ||
foldl = __o1["foldl"], | ||
builtins = require("./builtin"), | ||
ZipperT = require("zipper-m")["trans"]["zipper"], | ||
@@ -28,0 +26,0 @@ check, _check, Zipper = ZipperT(Unique), |
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/post_normalize.kep' | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/post_normalize.kep' | ||
* DO NOT EDIT | ||
*/"use strict"; | ||
*/ | ||
"use strict"; | ||
var tree = require("neith")["tree"], | ||
@@ -11,18 +12,22 @@ __o = require("neith")["walk"], | ||
khepriZipper = __o0["khepriZipper"], | ||
__o1 = require("khepri-ast")["node"], | ||
setData = __o1["setData"], | ||
ast_declaration = require("khepri-ast")["declaration"], | ||
ast_statement = require("khepri-ast")["statement"], | ||
ast_expression = require("khepri-ast")["expression"], | ||
ast_pattern = require("khepri-ast")["pattern"], | ||
ast_package = require("khepri-ast")["package"], | ||
ast_value = require("khepri-ast")["value"], | ||
fun = require("./fun"), | ||
flattenr = fun["flattenr"], | ||
__o2 = require("./unpack"), | ||
innerPattern = __o2["innerPattern"], | ||
unpackParameters = __o2["unpackParameters"], | ||
builtins = require("./builtin"), | ||
normalize, DOWN = false, | ||
UP = true, | ||
__o1 = require("./ast"), | ||
isBlockFunction = __o1["isBlockFunction"], | ||
__o2 = require("./fun"), | ||
concat = __o2["concat"], | ||
flattenr = __o2["flattenr"], | ||
filter = __o2["filter"], | ||
map = __o2["map"], | ||
__o3 = require("./unpack"), | ||
innerPattern = __o3["innerPattern"], | ||
unpackParameters = __o3["unpackParameters"], | ||
__o4 = require("./builtin"), | ||
builtins = __o4["builtins"], | ||
definitions = __o4["definitions"], | ||
normalize, expandBinding, always = (function(_) { | ||
return true; | ||
}), | ||
peepholes = ({}), | ||
@@ -36,16 +41,12 @@ addPeephole = (function(types, up, condition, f) { | ||
types.forEach((function(type) { | ||
(peepholes[type] = (peepholes[type] ? fun.concat(peepholes[type], entry) : [entry])); | ||
(peepholes[type] = concat((peepholes[type] || []), entry)); | ||
})); | ||
}); | ||
addPeephole(["LetExpression"], UP, (function(_) { | ||
return true; | ||
}), (function(node) { | ||
return ast_expression.LetExpression.create(node.loc, flattenr(node.bindings.map((function(x) { | ||
return innerPattern(x.value, x.pattern); | ||
}))), node.body); | ||
})); | ||
addPeephole(["FunctionExpression"], UP, (function(_) { | ||
return true; | ||
}), (function(node) { | ||
var params = fun.map((function(x) { | ||
addPeephole(["LetExpression"], true, always, ((expandBinding = (function(binding) { | ||
return innerPattern(binding.value, binding.pattern, binding.recursive); | ||
})), (function(node) { | ||
return ast_expression.LetExpression.create(node.loc, flattenr(map(expandBinding, node.bindings)), node.body); | ||
}))); | ||
addPeephole(["FunctionExpression"], true, always, (function(node) { | ||
var params = map((function(x) { | ||
switch (x.type) { | ||
@@ -57,9 +58,8 @@ case "IdentifierPattern": | ||
} | ||
}), fun.filter((function(x) { | ||
}), filter((function(x) { | ||
return (x.type !== "EllipsisPattern"); | ||
}), node.params.elements)), | ||
bindings = unpackParameters(node.params.elements), | ||
body = ((node.body.type === "BlockStatement") ? ast_statement.BlockStatement.create(null, [ | ||
ast_statement.WithStatement.create(null, bindings, node.body) | ||
]) : ast_expression.LetExpression.create(null, bindings, node.body)); | ||
body = (isBlockFunction(node) ? ast_statement.BlockStatement.create(null, [ast_statement.WithStatement.create( | ||
null, bindings, node.body)]) : ast_expression.LetExpression.create(null, bindings, node.body)); | ||
return ast_expression.FunctionExpression.create(null, node.id, ast_pattern.ArgumentsPattern.create(null, | ||
@@ -89,3 +89,3 @@ node.params.id, params, node.params.self), body); | ||
right = __o["right"]; | ||
return ast_expression.CallExpression.create(null, builtins[operator], [left, right]); | ||
return ast_expression.CallExpression.create(null, definitions[operator], [left, right]); | ||
})); | ||
@@ -92,0 +92,0 @@ var upTransforms = (function(node) { |
/* | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/stages/ecma_peep.kep' | ||
* THIS FILE IS AUTO GENERATED from 'lib/stages/ecma_peep.kep' | ||
* DO NOT EDIT | ||
*/ | ||
"use strict"; | ||
*/"use strict"; | ||
var ecma_peep = require("../ecma_peep"), | ||
@@ -10,8 +9,8 @@ optimize; | ||
var options = __o["options"], | ||
ast = __o["ast"]; | ||
tree = __o["tree"]; | ||
return ({ | ||
"options": options, | ||
"ast": ecma_peep.optimize(ast) | ||
"tree": ecma_peep.optimize(tree) | ||
}); | ||
})); | ||
(module.exports = optimize); |
@@ -12,5 +12,6 @@ /* | ||
var ast = input["ast"], | ||
data = input["data"]; | ||
return setProperty(input, "ast", inline.optimize(ast, data)); | ||
data = input["data"], | ||
out = inline.optimize(ast, data); | ||
return setProperty(setProperty(input, "ast", out.tree), "data", out.data); | ||
})); | ||
(module.exports = optimize); |
/* | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/stages/transform.kep' | ||
* THIS FILE IS AUTO GENERATED from 'lib/stages/transform.kep' | ||
* DO NOT EDIT | ||
*/ | ||
"use strict"; | ||
*/"use strict"; | ||
var transformer = require("../transform/transform"), | ||
@@ -14,4 +13,4 @@ __o = require("bes")["object"], | ||
data = input["data"]; | ||
return setProperty(input, "ast", transformer.transform(ast, (options.package_manager || "amd"), data)); | ||
return setProperty(input, "tree", transformer.transform(ast, (options.package_manager || "amd"), data)); | ||
})); | ||
(module.exports = transform); |
@@ -14,3 +14,4 @@ /* | ||
fun = require("../../fun"), | ||
builtins = require("../../builtin"), | ||
__o0 = require("../../builtin"), | ||
builtins = __o0["builtins"], | ||
definePackage, defineProgram, importPackage, concat = Function.prototype.call.bind(Array.prototype.concat), | ||
@@ -31,3 +32,3 @@ map = Function.prototype.call.bind(Array.prototype.map), | ||
})); | ||
(definePackage = (function(loc, exports, imports, targets, body) { | ||
(definePackage = (function(loc, exports, imports, targets, globals, body) { | ||
var exportedNames = ((exports.type === "PackageExports") ? fun.map((function(x) { | ||
@@ -50,4 +51,4 @@ return x.id.name; | ||
})))), ast_statement.BlockStatement.create(body.loc, concat(exportHeader, body, exportBody)) | ||
), "prefix", ast_statement.ExpressionStatement.create(null, ast_value.Literal.create(null, "string", | ||
"use strict"))); | ||
), "prefix", [ast_statement.ExpressionStatement.create(null, ast_value.Literal.create(null, | ||
"string", "use strict")), globals]); | ||
return ast_statement.ExpressionStatement.create(loc, ast_expression.CallExpression.create(loc, ast_value.Identifier | ||
@@ -54,0 +55,0 @@ .create(null, "define"), [ast_expression.ArrayExpression.create(null, concat(ast_value.Literal.create( |
/* | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/transform/package_manager/node.kep' | ||
* THIS FILE IS AUTO GENERATED from 'lib/transform/package_manager/node.kep' | ||
* DO NOT EDIT | ||
*/ | ||
"use strict"; | ||
*/"use strict"; | ||
var ast_declaration = require("khepri-ast")["declaration"], | ||
@@ -12,3 +11,4 @@ ast_expression = require("khepri-ast")["expression"], | ||
fun = require("../../fun"), | ||
builtins = require("../../builtin"), | ||
__o = require("../../builtin"), | ||
builtins = __o["builtins"], | ||
definePackage, defineProgram, importPackage, concat = Array.prototype.concat.bind([]), | ||
@@ -29,3 +29,3 @@ map = Function.prototype.call.bind(Array.prototype.map); | ||
})); | ||
(definePackage = (function(loc, exports, imports, targets, body) { | ||
(definePackage = (function(loc, exports, imports, targets, globals, body) { | ||
var exportedNames = ((exports.type === "PackageExports") ? fun.map((function(x) { | ||
@@ -49,3 +49,4 @@ return x.id.name; | ||
return ast_declaration.Binding.create(null, x.pattern, importPackage(x.from.value)); | ||
})), ast_statement.BlockStatement.create(null, concat(exportHeader, body, exportBody)))]); | ||
})), ast_statement.BlockStatement.create(null, concat(globals, exportHeader, body, | ||
exportBody)))]); | ||
})); | ||
@@ -52,0 +53,0 @@ (exports["definePackage"] = definePackage); |
@@ -35,6 +35,8 @@ /* | ||
flip = fun["flip"], | ||
builtins = require("../builtin"), | ||
__o1 = require("../unpack"), | ||
innerPattern = __o1["innerPattern"], | ||
unpackParameters = __o1["unpackParameters"], | ||
__o1 = require("../builtin"), | ||
builtins = __o1["builtins"], | ||
definitions = __o1["definitions"], | ||
__o2 = require("../unpack"), | ||
innerPattern = __o2["innerPattern"], | ||
unpackParameters = __o2["unpackParameters"], | ||
transform, M = ZipperT(StateT(Unique)), | ||
@@ -55,6 +57,6 @@ run = (function(m, s, ctx, seed) { | ||
enumeration = fun.foldr.bind(null, flip(cons), ok([])), | ||
State = record.declare(null, ["scope", "packageManager", "bindings"]); | ||
State = record.declare(null, ["scope", "packageManager", "bindings", "globals"]); | ||
(State.empty = State.create(scope.Scope.empty, null, [ | ||
[], null | ||
])); | ||
], [])); | ||
var extract = M.lift(M.inner.get), | ||
@@ -72,2 +74,5 @@ setState = (function(f, g) { | ||
inspectStateWith = M.chain.bind(null, extract), | ||
globals = extract.map((function(s) { | ||
return s.globals; | ||
})), | ||
inspectScopeWith = (function(f) { | ||
@@ -205,10 +210,2 @@ return bind(extract, (function(s) { | ||
}), | ||
ternaryOperatorExpression = (function(loc) { | ||
return khepri_expression.FunctionExpression.create(loc, null, khepri_pattern.ArgumentsPattern.create(null, | ||
null, [khepri_pattern.IdentifierPattern.create(null, identifier(null, "x")), khepri_pattern.IdentifierPattern | ||
.create(null, identifier(null, "y")), khepri_pattern.IdentifierPattern.create(null, identifier( | ||
null, "z")) | ||
]), khepri_expression.ConditionalExpression.create(null, identifier(null, "x"), identifier(null, | ||
"y"), identifier(null, "z"))); | ||
}), | ||
curryExpression = (function(loc, base, args) { | ||
@@ -218,3 +215,3 @@ return khepri_expression.CallExpression.create(null, khepri_expression.MemberExpression.create(null, base, | ||
}), | ||
packageBlock = (function(packageManager, loc, exports, body) { | ||
packageBlock = (function(packageManager, loc, exports, globals, body) { | ||
var imports = ((body.type === "WithStatement") ? fun.filter((function(x) { | ||
@@ -231,3 +228,3 @@ return (x && (x.type === "ImportPattern")); | ||
}), body.bindings), body.body) : body); | ||
return packageManager.definePackage(loc, exports, imports, targets, fBody); | ||
return packageManager.definePackage(loc, exports, imports, targets, globals, fBody); | ||
}), | ||
@@ -242,4 +239,6 @@ transformers = ({}), | ||
}); | ||
addTransform("VariableDeclaration", null, modify((function(node) { | ||
return ecma_declaration.VariableDeclaration.create(node.loc, node.declarations); | ||
addTransform("VariableDeclaration", null, modify((function(__o) { | ||
var loc = __o["loc"], | ||
declarations = __o["declarations"]; | ||
return (declarations.length ? ecma_declaration.VariableDeclaration.create(loc, declarations) : null); | ||
}))); | ||
@@ -352,5 +351,2 @@ addTransform("VariableDeclarator", null, modify((function(node) { | ||
}))); | ||
addTransform("TernaryOperatorExpression", next(modify((function(node) { | ||
return ternaryOperatorExpression(node.loc); | ||
})), _transform)); | ||
addTransform("FunctionExpression", seq(enterBlock, modify((function(node) { | ||
@@ -390,5 +386,8 @@ return functionExpression(node.loc, node.id, node.params, node.body, (node.ud && node.ud.prefix)); | ||
}))); | ||
addTransform("Program", seq(pushBindings, modify((function(node) { | ||
return ((node.body.type === "Package") ? node : setData(node, "prefix", khepri_statement.ExpressionStatement | ||
.create(null, khepri_value.Literal.create(null, "string", "use strict")))); | ||
addTransform("Program", seq(pushBindings, globals.chain((function(globals) { | ||
return modify((function(node) { | ||
return ((node.body.type === "Package") ? node : setData(khepri_program.Program.create( | ||
null, fun.concat(globals, node.body)), "prefix", khepri_statement.ExpressionStatement | ||
.create(null, khepri_value.Literal.create(null, "string", "use strict")))); | ||
})); | ||
}))), getBindings((function(bindings) { | ||
@@ -405,4 +404,6 @@ return modify((function(node) { | ||
addTransform("Package", bind(packageManager, (function(packageManager) { | ||
return modify((function(node) { | ||
return packageBlock(packageManager, node.loc, node.exports, node.body); | ||
return globals.chain((function(globals) { | ||
return modify((function(node) { | ||
return packageBlock(packageManager, node.loc, node.exports, globals, node.body); | ||
})); | ||
})); | ||
@@ -436,4 +437,10 @@ }))); | ||
if ((manager === "node"))(packageManager = node_manager); | ||
var s = State.empty.setScope(scope.Scope.empty) | ||
.setPackageManager(packageManager); | ||
var globals = data.globals, | ||
s = State.empty.setScope(scope.Scope.empty) | ||
.setPackageManager(packageManager) | ||
.setGlobals((data.globals ? khepri_declaration.VariableDeclaration.create(null, data.globals.map(( | ||
function(x) { | ||
return khepri_declaration.VariableDeclarator.create(null, builtins[x], | ||
definitions[x]); | ||
}))) : [])); | ||
return run(seq(addVar("require", builtins.require.ud.uid), addVar("exports", builtins.exports.ud.uid), walk( | ||
@@ -440,0 +447,0 @@ M, _transform, _transformPost), node), s, khepriZipper(ast)); |
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/unpack.kep' | ||
* THIS FILE IS AUTO GENERATED FROM 'lib/unpack.kep' | ||
* DO NOT EDIT | ||
*/"use strict"; | ||
*/ | ||
"use strict"; | ||
var ast_expression = require("khepri-ast")["expression"], | ||
@@ -11,14 +12,15 @@ ast_declaration = require("khepri-ast")["declaration"], | ||
flatten = fun["flatten"], | ||
innerPattern, unpackParameters, objectElementUnpack = (function(base, pattern, key) { | ||
innerPattern, unpackParameters, objectElementUnpack = (function(base, pattern, key, recursive) { | ||
var innerBase = ast_expression.MemberExpression.create(null, base, key, true); | ||
return (pattern ? flatten(innerPattern(innerBase, pattern)) : ast_declaration.Binding.create(null, | ||
ast_pattern.IdentifierPattern.create(null, ast_value.Identifier.create(null, key.value)), innerBase | ||
)); | ||
ast_pattern.IdentifierPattern.create(null, ast_value.Identifier.create(null, key.value)), innerBase, | ||
recursive)); | ||
}); | ||
(innerPattern = (function(base, pattern) { | ||
(innerPattern = (function(base, pattern, recursive) { | ||
switch (pattern.type) { | ||
case "IdentifierPattern": | ||
return [ast_declaration.Binding.create(null, pattern, base)]; | ||
return [ast_declaration.Binding.create(null, pattern, base, recursive)]; | ||
case "AsPattern": | ||
return fun.concat(innerPattern(base, pattern.id), flatten(innerPattern(pattern.id, pattern.target))); | ||
return fun.concat(innerPattern(base, pattern.id), flatten(innerPattern(pattern.id, pattern.target, | ||
recursive))); | ||
case "ObjectPattern": | ||
@@ -28,3 +30,3 @@ return flatten(fun.map((function(__o) { | ||
key = __o["key"]; | ||
return objectElementUnpack(pattern.ud.id, target, key); | ||
return objectElementUnpack(pattern.ud.id, target, key, recursive); | ||
}), pattern.elements)); | ||
@@ -35,18 +37,20 @@ default: | ||
})); | ||
(unpackParameters = (function(f, g) { | ||
return (function(x) { | ||
return f(g(x)); | ||
}); | ||
})(flatten, fun.map.bind(null, (function(x) { | ||
switch (x.type) { | ||
case "SinkPattern": | ||
case "IdentifierPattern": | ||
return []; | ||
case "AsPattern": | ||
return flatten(innerPattern(x.id, x.target)); | ||
default: | ||
return innerPattern(x, x); | ||
} | ||
})))); | ||
var x = flatten, | ||
y = fun.map.bind(null, (function(x) { | ||
switch (x.type) { | ||
case "SinkPattern": | ||
case "IdentifierPattern": | ||
return []; | ||
case "AsPattern": | ||
return flatten(innerPattern(x.id, x.target)); | ||
default: | ||
return innerPattern(x, x); | ||
} | ||
})), | ||
f = x, | ||
g = y; | ||
(unpackParameters = (function(x) { | ||
return f(g(x)); | ||
})); | ||
(exports["innerPattern"] = innerPattern); | ||
(exports["unpackParameters"] = unpackParameters); |
{ | ||
"name": "khepri-compile", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Compiler for the Khepri programming language", | ||
@@ -5,0 +5,0 @@ "author": "Matt Bierner", |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -10,3 +10,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var run = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -13,0 +13,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -14,3 +14,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)), options))); | ||
return unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)), options))); | ||
}; | ||
@@ -17,0 +17,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ var parser = require('khepri-parse').parse.parser; | ||
var testParser = function(input) { | ||
return eval(unparse_print.print(unparse.unparse(compile.compile(parser.parseStream(lexer.lex(input)))))); | ||
return eval(unparse_print.print(unparse.unparse(compile(parser.parseStream(lexer.lex(input)))))); | ||
}; | ||
@@ -14,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
211903
2933