Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qbixxx/lambdacalculusengine

Lambda interpreter built in Scala. Supports CbN, CbV and Free Variables calculations.
https://github.com/qbixxx/lambdacalculusengine

functional functional-programming lambda lambda-calculus lambda-function lambda-functions sbt scala scala3

Last synced: 3 days ago
JSON representation

Lambda interpreter built in Scala. Supports CbN, CbV and Free Variables calculations.

Awesome Lists containing this project

README

        

# λ Lambda Calculus Engine λ
Lambda interpreter built in Scala. Supports CbN, CbV and Free Variables calculations.

## Lambda Expression Symbols available:
- **"λ"**: The lambda symbol represents the beginning of an abstraction.
- **" "**: The space allows for separating the argument from the function in an application.
- **"."**: The dot allows for separating the argument from the body of an abstraction.
- **"("**: The left parenthesis allows for representing the beginning of an application.
- **")"**:" The right parenthesis allows for representing the end of an application.
- **string**: Any other string, different from the ones above, will be interpreted as a variable.

## Commands and syntax:

1. `The Lambda expression must follow the syntax structure defined as:`
- `<λexp> ::=`
- `` #Variable
- ` <λexp>` #Abstraction
- ` <λexp> <λexp> ` #Application

2. `set `
- `set call-by-name` (default strategy)
- `set call-by-value`
- `set free-variables`

3. `exit`

## IO Examples:

| Expression | Call-by-Name Result | Call-by-Value Result |
| ---------- | ------------------- | -------------------- |
| `(λx.λy.y (λx.(x x) λx.(x x)))` | `λy.y` | Infinite recursion |
| `(λx.λx.(y x) z)` | `λx.(y x)` | `λx.(y x)` |
| `(λx.λy.x y)` | `λy*.y` | `λy*.y` |
| `(λy.λb.b ((λf.λb.f b) b))` | `λb*.b*` | `λb*.b*` |
| `(λf.(f λx.λy.x) ((λx.λy.λf.((f x) y) a) b))` | `a` | `a` |

# Compilation:

The project uses Scala 3.3.3 and sbt.

For running the program open the sbt interpreter using:
````shell
sbt
````
- Compile with:
````shell
compile
````
- And execute with:
````shell
run
````
- For exiting the program:
````shell
exit
````

Note: If you run the project on Windows, use the symbol "/" instead of the symbol "λ" as PowerShell does not support it.

Contributors:
- Valentin Cedeño [@qbixxx](https://github.com/qbixxx/)
- Valentin Calomino [@vcalomi](https://github.com/vcalomi)
- Luciano Salerno [@SalernoLuciano](https://github.com/SalernoLuciano)