X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=code%2Fparse.js;h=9712809b40c5d7d608b48543eb4c5270cc4e6712;hp=e911aa42e59bc3fd882249d3d677bd25787866fd;hb=356cd0ed65c71922aecc155ddab88896c4e0629d;hpb=466e57fc9e1c65c5b8c092ca8be03a4c69031f16 diff --git a/code/parse.js b/code/parse.js index e911aa42..9712809b 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,18 @@ 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 = box constant("T", make_lam2(u, v, make_app(vv, uu))); + // vireo \uvw.wuv = pair + constant("V", make_lam3(u, v, x, make_app3(xx, uu, vv))); + // warbler \uv.uvv = C(BM(BBT) = C(BS(C(BBI)I))I + constant("W", make_lam2(u, v, make_app3(uu, vv, vv))); + // mockingbird \u.uu = SII = omega + constant("M", make_lam(u, make_app(uu, uu))); + // lark \uv.u(vv) = CBM = BWB + constant("L", make_lam2(u, v, make_app(uu, make_app(vv, vv)))); + // Y is SLL } make_constants(); @@ -234,8 +247,10 @@ var make_parse = function () { } else { t.first = []; while (token.arity === "name" || token.id === "\\") { - if (token.id !== "\\") {t.first.push(n);} - n = token; + if (token.id !== "\\") { + t.first.push(n); + n = token; + } advance(); } if (token.arity === "literal" && t.first.length === 0) { @@ -293,7 +308,7 @@ var make_parse = function () { tokens = source.tokens(); token_nr = 0; advance(); - + // let n = c in b // (\n. b) c @@ -323,7 +338,7 @@ var make_parse = function () { target = t; advance("in"); } - + target.second = expression(false); advance("(end)");