From 11dceea06761880edc2f66d4ccfe984cb205321b Mon Sep 17 00:00:00 2001 From: atrn0 <14242642+atrn0@users.noreply.github.com> Date: Mon, 31 May 2021 16:36:33 +0900 Subject: [PATCH] Add README.md --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..35308b9 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# lambda + +Lambda is an untyped lambda calculus interpreter written in OCaml. This interpreter supports 2 evaluation strategies, Full beta-reduction and Call by Value. + +## Usage + +```sh +$ dune exec lambda # default strategy is Full beta-reduction +$ dune exec lambda -- -v # output all reduction steps +$ dune exec lambda -- -s value # use Call by Value strategy +$ dune exec lambda -- --help # help +``` + +## Example + +You can use [some macros](./src/cui.ml#L11-L31). + +``` +$ dune exec lambda +# (\x.x)x +→ x +# test tru v w +→ v +# scc c1 +→ (λs. (λz. (s (s z)))) +# factorial (times (scc (scc c0)) (scc c1)) +→ (λs. (λz. (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s z)))))))))))))))))))))))))) +```