-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)))))))))))))))))))))))))) | ||
``` |