https://github.com/mgechev/typed-calc
Interpreter for simply typed lambda calculus implemented in JavaScript λ
https://github.com/mgechev/typed-calc
interpreter lambda-calculus type-system
Last synced: about 1 year ago
JSON representation
Interpreter for simply typed lambda calculus implemented in JavaScript λ
- Host: GitHub
- URL: https://github.com/mgechev/typed-calc
- Owner: mgechev
- Created: 2017-02-22T06:03:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-07T00:50:00.000Z (almost 9 years ago)
- Last Synced: 2025-04-25T11:57:29.621Z (about 1 year ago)
- Topics: interpreter, lambda-calculus, type-system
- Language: JavaScript
- Homepage: https://blog.mgechev.com/2017/08/05/typed-lambda-calculus-create-type-checker-transpiler-compiler-javascript/
- Size: 28.3 KB
- Stars: 34
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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