An extremely simple implementation of Lambda-Calculus Interpreter.
During my Compilers and Programming languages class (CS-421 @ UIUC), Lambda Calculus was one of the topics that really caught my eyes, for explain how function application works and what functions can do, and actually how functional languages are build around it.
This project is my attempt of implement a simple lambda calculus expression parser.
git clone [email protected]:gb/lambda-calculus.git
cd lambda-calculus
make run
Please type a lambda expression:
λ> (\x.x) a
((λx.x) a)
a
λ> (\x.x x) a
((λx.(x x)) a)
(a a)
λ> (\x.y x) a
((λx.(y x)) a)
(y a)
λ> (\x.\a.x) a
((λx.(λa.x)) a)
(λb.a)
λ> (\x.\x.x) a
((λx.(λx.x)) a)
(λx.x)
λ> (\x.(\y.y) x) a
((λx.((λy.y) x)) a)
((λy.y) a)
a
λ> (\x.\a.x) a
((λx.(λa.x)) a)
(λb.a)
A good way to understand the code intention is checking the test suite. To execute the tests:
make test