LamCalc: An implementation for Lambda Calculus

LamCalc implements untyped Lambda Calculus, Inspired by Lambda Calculus: Basic Interpreter in Rust (Part 2).
Current status: stabalized v1.
Features
lambda! macro for convenient definition.
- Implemented using De Bruijn index.
- Parser for expressions/definitions/files.
- WASM package for web application.
Quick View
use lamcalc::{lambda, Error, parser::parse_exp};
fn main () -> Result<(), Error> {
let tt = lambda!(x. y. x); let ff = lambda!(x. (y. y)); let and = lambda!(x.y.x y x);
println!("and = {}", and); println!("and = {:#}", and); println!("and = {}", and.purify());
let mut and_f_t = lambda!({and} {ff} {tt});
and_f_t.simplify()?; assert_eq!(and_f_t, ff);
let y_combinator = lambda!(f.(x. f (x x)) (x. f (x x)));
let y_str = r#"\f.(\x. f (x x)) (\x. f (x x))"#;
let (y2, _) = parse_exp(y_str)?;
assert_eq!(y2, y_combinator);
Ok(())
}
See examples/ for more.