Lambca (Lambda calculus) is a very tiny DSL to manipulate lambda calculus terms. The syntax is very simple. And the project itself is very minimalist.
This project is a personal exploration, created with the goal of discovering and experimenting with new concepts in lambda calculus. It is not meant to be a complete implementation, but rather a minimalist playground for learning.
- Variable: x, y, foo …
- Abstraction: \x. M (function taking x and returning M)
- Application: (M N) (apply function M to argument N)
- Define a term: let = <lambda_term>
- Evaluate a term: eval <lambda_term> (beta-reduce until no more steps & print the result)
let id = \x. x
eval (id z) // => z
let self = \s. (s s)
eval (self self) // => (\s.(s s) \s.(s s))
let k = \x.\y. x
eval ((k a) b) // => a
let flip = \f.\x.\y. ((f y) x)
eval (((flip id) p) q) // => (q p)
let chain = \f.\g.\x. (f (g x))
eval (((chain id) id) r) // => r
you can find more "concrete" examples in the examples
folder.
You simply need to run lambca <FilePath>
If you have cargo installed, you can run cargo install lambca
. Otherwise, you can install the binary file from the releases page.