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-1.0.0.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for churchrepl-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9896ffb0b530803c360ebb101f466a3efcb020278e97428df11de999439c04c |
|
MD5 | a8eabfa1c9f4925ad0823ef10951017a |
|
BLAKE2b-256 | 28861b3c33e9721f9a87ad68020629102a4daeac201af4a54b4d44fc9831e02f |