lamcal-repl 0.1.1

A lambda calculus command line repl
lamcal-repl-0.1.1 is not a library.
Visit the last successful build: lamcal-repl-0.4.0

Lamcal REPL

Crates.io Docs.rs Linux Build Status Windows Build Status codevoc.io Apache-2.0

lamcal-repl is a Lambda Calculus REPL command line application written in Rust. It can be used to play around with lambda calculus expressions interactively.

This application is inspired by this talk by glebec where he plays around with lambda calculus in a JavaScript console.

lamcal-repl uses the lamcal library crate for the lambda calculus functionality and adds the REPL things to make it an application. The name of the executable is lamcali.

Installation

To install the lamcal-repl command line application run the following commands in your terminal:

> cargo install lamcal-repl

After it has been installed successfully we can run lamcal-repl by typing the name of the executable:

> lamcali

Alternatively we can clone this git repository, go to the repl subdirectory and type cargo run, like so

> cd lamcal/repl
lamcal/repl> cargo run

Usage

When the application starts we see the following in the command line:

info: Welcome to lamcal-repl, the Lambda Calculus Repl, version 0.1.0
λ>

Notice that the command line prompt changes to λ>. To evaluate a lambda expression we simple type in the expression at the prompt, like so:

λ> (\x.(\y.x y) a) b

After pressing enter, the expression gets parsed and the default α-conversion and β-reduction is applied. The result is printed to the console, like so:

λ> (\x.(\y.x y) a) b
b a

We can use the backslash character \ or the greek lowercase lambda λ to denote a lambda abstraction with a lambda expressions. The parser understands both backslash as well as the lowercase lambda symbol as the start of an abstraction.

The repl support commands to control the behavior of the application. Commands always start with a colon. Most important commands are:

  • :h or :help to print out help information
  • :q or :quit to quit the application

A list of all implemented commands is given in the help information (command :h).

License

Licensed under Apache License, Version 2.0 see LICENSE or http://www.apache.org/licenses/LICENSE-2.0 for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.