A simple REPL for lambda calculus
Project description
A simple REPL for lambda calculus
Use:
when calling churchrepl and new REPL will be opened.
churchrepl [-f --file file [file ...]] [-v --verbose]
Flags:
(optional) Read definitions and expressions from a file before loading the normal REPL.
-f|--file file [file ...]
(optional) print debugging and verbose output.
-v|--verbose
Church repl file structure:
The EBNF grammar is as follows*:
(* Lambda Program *) program = {line}; line = (define | function); define = "@" alias ":" function; function = lambda | application; lambda = ("λ" | "\") variable "." expr; application = '(' expr expr ')'; expr = (lambda | application | variable | alias ) ; variable = /[a-z]/; alias = /[_A-Z][_A-Z0-9]*/;
A simple example program:
@ID: λx.x @APPLY: λf.λx.(f x) @TRUE: λx.λy.x @FALSE: λx.λy.y @ZERO: λf.λx.x @SUCC: λn.λf.λx.(f ((n f) x)) @ONE: (SUCC ZERO) @TWO: (SUCC ONE) @THREE: (SUCC TWO) @FOUR: (SUCC THREE) (SUCC ZERO) (SUCC ONE) (SUCC TWO) (SUCC THREE) (SUCC FOUR)
Note: The λ (lambda, unicode u03bb) is equivalent to a backslash as far as this program is concerned. When using the repl it may be easier to use a backslash.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
churchrepl-0.2.5.tar.gz
(7.0 kB
view details)
Built Distribution
File details
Details for the file churchrepl-0.2.5.tar.gz
.
File metadata
- Download URL: churchrepl-0.2.5.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 894d0abca95637926ec9425437da0b3f583623b8cd6e4b196dfca845ea0041fe |
|
MD5 | 1fd63656553126e20c49642f1175cb30 |
|
BLAKE2b-256 | cfe67d3ed0fa89d26fab8f5e2a7c4e03d0cb3b0c4e76214380609f765bdd6b68 |
File details
Details for the file churchrepl-0.2.5-py2.py3-none-any.whl
.
File metadata
- Download URL: churchrepl-0.2.5-py2.py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec63cee1f79bbb2a1cd73c55c1199aeb4bafb53d6c2a47e19bca1ed6ddd6dcc1 |
|
MD5 | 5e7146a1145bc3ee29b56854b9b481f8 |
|
BLAKE2b-256 | 73ef3aa0ae933928f165ce5940792d22c9dbbf0c4f5f47c466734f85f6f8525d |