A simple Lambda Calculus interpreter implemented in Python that supports basic lambda calculus operations.
- Lambda abstractions (using
fn
keyword) - Variable bindings
- Function applications
- Interactive REPL mode
- File execution mode
- Comment support (using
;
)
# Run in REPL mode
python main.py
# Execute a lambda calculus file
python main.py program.lbda
; Variables
x
; Lambda abstraction
fn x.x
; Multiple parameter abstraction
fn x y z.x
; Function application
(x y)
The interpreter follows this grammar:
Expression -> Term { Term }
Term -> LAMBDA VARIABLE DOT Expression ; lambda abstraction
| VARIABLE ; variable
| LPAREN Expression RPAREN ; parenthesized expression
Type (exit)
to quit the interactive console.