Skip to main content

A simple REPL for lambda calculus

Project description

A simple REPL for lambda calculus


when calling churchrepl and new REPL will be opened.

churchrepl [-f --file file [file ...]] [-v --verbose]


(optional) Read definitions and expressions from a file before loading the normal REPL.

-f|--file file [file ...]

(optional) print debugging and verbose output.


Church repl file structure:

The EBNF grammar is as follows*:

(* church-lambda EBNF *)
                  (* --- meta --- *)
 program = {line};
 line = (define | function);
 define = "@" alias ":" function;

                  (* --- lambdas --- *)
 function = lambda | application;
 lambda = "λ" variable "." expr;
 application = '(' expr  expr ')';
 expr = (lambda | application | variable | alias );

                  (* --- primitives --- *)
 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))

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
churchrepl-1.0.2-py2.py3-none-any.whl (9.1 kB) Copy SHA256 hash SHA256 Wheel 2.7
churchrepl-1.0.2.tar.gz (7.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page