Interpreter for simply typed lambda calculus implemented in JavaScript λ
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo
.gitignore
README.md
ast.js
check.js
compile.js
eval.js
index.js
package.json
simply-typed.js
simply-typed.peg
symbol-table.js
yarn.lock

README.md

Simply Typed Lambda Calculus

A type checker and interpreter for simply typed lambda calculus written in JavaScript.

Example

The following program:

(λ a: Int → a) if (λ a: Int → iszero a) pred 0 then succ 0 else 0

Is correct and evaluates to 0.

How to use?

Interpreter

$ node index.js demo/correct1.lambda

0

Compiler

$ node index.js compile demo/correct1.lambda

(function(a) {
  return a;
})(
  (function(a) {
    return a === 0;
  })(0 - 1)
    ? 0 + 1
    : 0
);

License

MIT