Skip to content

s-webber/lambda-calculus-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda (λ) calculus interpreter

Build Status

About

This project provides a Java 7 implementation of a read-evaluate-print loop for the evaluation of lambda calculus expressions.

Building

The project can be built using Maven and Java 7 by executing the following from the command line: mvn package.

Running

The console application can be launched using the following command:

java -jar target/lambda-calculus-interpreter-1.0-SNAPSHOT.jar

The application optionally takes one of three values as a command line argument: NORMAL, APPLICATIVE or LAZY.

The application defaults to NORMAL if no command line arguments are specified.

(Use a \ character to represent a λ.)

Example 1 (defaulting to NORMAL evaluation order):

$ java -jar target/lambda-calculus-interpreter-1.0-SNAPSHOT.jar

> (\s.(s s) (\x.x \y.y))
Input: (\s.(s s) (\x.x \y.y))
(\s.(s s) (\x.x \y.y))
((\x.x \y.y) (\x.x \y.y))
(\y.y (\x.x \y.y))
(\x.x \y.y)
\y.y
Result: \y.y

Example 2 (using APPLICATIVE evaluation order):

$ java -jar target/lambda-calculus-interpreter-1.0-SNAPSHOT.jar APPLICATIVE

> (\s.(s s) (\x.x \y.y))
Input: (\s.(s s) (\x.x \y.y))
(\s.(s s) (\x.x \y.y))
(\s.(s s) \y.y)
(\y.y \y.y)
\y.y
Result: \y.y

Example 3 (using LAZY evaluation order):

$ java -jar target/lambda-calculus-interpreter-1.0-SNAPSHOT.jar LAZY

> (\s.(s s) (\x.x \y.y))
Input: (\s.(s s) (\x.x \y.y))
(\s.(s s) (\x.x \y.y))
((\x.x \y.y) (\x.x \y.y))
(\y.y \y.y)
\y.y
Result: \y.y

About

Lambda calculus interpreter.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages