Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
examples.txt
exp.ml
lambda_eval.ml
lexer.ml
main.ml
parser.ml

README.md

untyped lambda calculus interpreter

lexer.ml and parser are automatically generated using ocamllex and menhir.

Files:

exp.ml: types and tokens

lexer.ml: lambda calculus tokenizer

parser.ml: lambda calculus parser

lambda_eval.ml: lambda calculus interprter

main.ml: test examples

Usage:

ocaml main.ml

or

in OCaml toplevel

#use "main.ml"

let t = parse "(Lx. Ly. x y) w";;

val t : exp = App (Lam ("x", Lam ("y", App (Var "x", Var "y"))), Var "w")

#print_lambda t;;

(\x. \y. x y) w- : unit = ()

#print_lambda (reduce t);;

\y. w y- : unit = ()

You can’t perform that action at this time.