X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=code%2Fparse.js;h=ddc6199ed858030f165b76821839d05ba4f27356;hp=8db784d5ba71e8c36e91863b1df669bd82f06240;hb=7936567be1fea69bb7e1bb299bd3d1616b6e2dcc;hpb=3e0b51e85f40d00ead16639860d7723b5f40e511 diff --git a/code/parse.js b/code/parse.js index 8db784d5..ddc6199e 100644 --- a/code/parse.js +++ b/code/parse.js @@ -140,6 +140,9 @@ var make_parse = function () { symbol("("); symbol("\\").handler = lambda_handler; symbol("lambda").handler = lambda_handler; + symbol("\u03bb").handler = lambda_handler; + // symbol("\u2203").handler = exists_handler; + // symbol("\u2200").handler = forall_handler; symbol("."); function make_constants() { @@ -208,8 +211,16 @@ var make_parse = function () { constant("I", make_lam(x, xx)); constant("B", make_lam3(u, v, x, make_app(uu, make_app(vv, xx)))); constant("C", make_lam3(u, v, x, make_app3(uu, xx, vv))); - constant("W", make_lam2(u, v, make_app3(uu, vv, vv))); + + // trush \uv.vu = CI constant("T", make_lam2(u, v, make_app(vv, uu))); + // mockingbird \u.uu = SII + constant("M", make_lam(u, make_app(uu, uu))); + // warbler \uv.uvv = C(BM(BBT) = C(BS(C(BBI)I))I + constant("W", make_lam2(u, v, make_app3(uu, vv, vv))); + // lark \uv.u(vv) = CBM = BWB + constant("L", make_lam2(u, v, make_app(uu, make_app(vv, vv)))); + // Y is SLL } make_constants(); @@ -233,11 +244,11 @@ var make_parse = function () { return t; } else { t.first = []; - while (token.arity === "name" || token.id === "\\" || token.id === "lambda") { - if (not (token.id === "\\" || token.id === "lambda") { + while (token.arity === "name" || token.id === "\\") { + if (token.id !== "\\") { t.first.push(n); n = token; - } + } advance(); } if (token.arity === "literal" && t.first.length === 0) { @@ -295,7 +306,7 @@ var make_parse = function () { tokens = source.tokens(); token_nr = 0; advance(); - + // let n = c in b // (\n. b) c @@ -325,7 +336,7 @@ var make_parse = function () { target = t; advance("in"); } - + target.second = expression(false); advance("(end)");