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*:
(* church-lambda EBNF *) (* --- meta --- *) (* line or line, line, line... *) program = {line}; (* define or function *) line = (define | function); (* ex: @ID: λx.x *) define = "@" alias ":" function; (* --- lambdas --- *) (* lambda or an application *) function = lambda | application; (* ex: λx.x) lambda = "λ" variable "." expr; (* ex: '(λx.x λy.y) application = '(' expr expr ')'; (* lambda or application or variable or alias *) expr = (lambda | application | variable | alias ); (* --- primitives --- *) (* one lowercase letter *) variable = /[a-z]/; (* one underscore or capital followed by zero or more [underscores, captials, or digits] *) 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.1.tar.gz
(7.0 kB
view details)
Built Distribution
File details
Details for the file churchrepl-1.0.1.tar.gz
.
File metadata
- Download URL: churchrepl-1.0.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9716b4acedbdab57eae1bb6c392c031c9c2d0e0df7ea7ae0a854da51614c0bc |
|
MD5 | ae59a16fbe1acdcadce0e52a74640932 |
|
BLAKE2b-256 | 5cc54a08ff7d9da24842143da17db95d205c31edbe2946245c4f0fc9a263179c |
File details
Details for the file churchrepl-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: churchrepl-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f34389d136ce0e73927a54122c1333f1b53ee08e8cb077bca0d080d8c41b6af |
|
MD5 | 1585b62f814d06fbc36658acc212d51b |
|
BLAKE2b-256 | f441589e6911b252fa6334c79597a6fff8a2c3b1b153b63304704d8e0f13eaaa |