Skip to main content

A simple REPL for lambda calculus

Project description

A simple REPL (Read-eval-print-loop) 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*:

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


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

Uploaded Source

Built Distribution

churchrepl-0.2.4-py2.py3-none-any.whl (9.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for churchrepl-0.2.4.tar.gz
Algorithm Hash digest
SHA256 7f9518f249f1b22c7bebe2f0cb3c8e495986694a22566e3ec2d0a455b4925984
MD5 4b5005fe132ab194b57daad2e5a07362
BLAKE2b-256 44ae47eaa6fa97a43c52e1425fac730e02c2a202285d2b54a2a408984a1dae76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for churchrepl-0.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1615f4238b60ff64a1cb277fe6710a8dca029e5e76e70682b05ae3f0a65de085
MD5 45e9eb9b1f7ceba1ed8362f06cf78ecc
BLAKE2b-256 20f0d2bc725d5aa4369032d0b66b89ab7fab52b65020ecf5eb244fa2ab8b0116

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