https://github.com/wenyuzhao/lambda
Lambda calculus interpreter in OCaml
https://github.com/wenyuzhao/lambda
lambda-calculus ocaml
Last synced: 5 months ago
JSON representation
Lambda calculus interpreter in OCaml
- Host: GitHub
- URL: https://github.com/wenyuzhao/lambda
- Owner: wenyuzhao
- License: apache-2.0
- Created: 2017-05-12T04:48:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-26T07:03:06.000Z (over 8 years ago)
- Last Synced: 2025-03-23T18:06:02.482Z (12 months ago)
- Topics: lambda-calculus, ocaml
- Language: OCaml
- Homepage:
- Size: 9.77 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# λ
[Lambda calculus](https://en.wikipedia.org/wiki/Lambda_calculus) interpreter in OCaml
## Build
`make`
## Usage
`./lambda.byte test.lambda`
## Example: 1 + 1 = 2
```
(λm.λn.λf.λx.m f (n f x)) (λf.λx.f x) (λf.λx.f x)
= (λn.λf2.λx2.(λf.λx.f x) f2 (n f2 x2)) (λf.λx.f x)
= λf2.λx2.(λf3.λx3.f3 x3) f2 ((λf.λx.f x) f2 x2)
= λf2.λx2.(λx3.f2 x3) ((λx.f2 x) x2)
= λf2.λx2.f2 ((λx.f2 x) x2)
= λf2.λx2.f2 (f2 x2)
```