Skip to main content

A simple REPL for lambda calculus

Project description

A simple REPL for lambda calculus

https://travis-ci.org/CodeGrimoire/ChurchREPL.svg?branch=master

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 --- *)
 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))
@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


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.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

churchrepl-1.0.2-py2.py3-none-any.whl (9.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file churchrepl-1.0.2.tar.gz.

File metadata

  • Download URL: churchrepl-1.0.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for churchrepl-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3c19a84535e961ee88e01b462557c6e20ad2cf714b141567cedbe646e2562d93
MD5 1143506103cf0344b7246ceed2deb1b6
BLAKE2b-256 70f4944c1b9812265b4d7af14f7e837c4fe65bdbd8ad862a9f8d57729c078417

See more details on using hashes here.

File details

Details for the file churchrepl-1.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for churchrepl-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5319b8d84751076363b1d676967a2bb789997fce21fb8a61f01e20c426b817b5
MD5 3f79f925bf5393cd25a8ddeab18fbf63
BLAKE2b-256 1b97c90f01b3638b285e84a284c378cdb2ce71008fec4f235cf00baa6a2cf25b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page