https://github.com/1computer1/ewe
Lambda calculus interpreter and REPL
https://github.com/1computer1/ewe
Last synced: about 2 months ago
JSON representation
Lambda calculus interpreter and REPL
- Host: GitHub
- URL: https://github.com/1computer1/ewe
- Owner: 1Computer1
- License: mit
- Created: 2019-05-26T08:04:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-16T07:07:15.000Z (over 5 years ago)
- Last Synced: 2025-02-17T21:14:15.214Z (3 months ago)
- Language: Haskell
- Homepage:
- Size: 49.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ewe
An interpreter and REPL for the lambda calculus.
To install, run `stack install`.
Run `ewe --help` for more info.## Untyped
Normal order evaluation, no static types, only lambdas.
Use with `--language untyped` or `-lu`.
Made with lots of help from [here](https://crypto.stanford.edu/~blynn/lambda/).```
Program = Definition* EOF
Definition = Identifier "=" Expression ";"
Expression = Lambda | Application
Lambda = "\" Identifier+ "." Expression
Application = Value+
Value = Identifier | "(" Expression ")"
Identifier = (AlphaNum | "_")+
```Line comments are done with `--`, block comments with `{- -}`.
See [here](./examples/untyped-church.ewe) for an example of Church encoding.
## Simple
Based on the simply typed lambda calculus.
Eager evaluation, statically typed, not very useful.
Contains integers, strings, and booleans, and some operations on them.
Use with `--language simple` or `-ls`.```
Program = Definition* EOF
Definition = Identifier "=" Expression ";"
Expression = Lambda | Application | Branch
Lambda = "\" ("(" Identifier ":" Type ")")+ "." Expression
Application = Atom+
Branch = "if" Expression "then" Expression "else" Expression
Atom = Identifier | Integer | String | Bool | "(" Expression ")"
Integer = [0-9]+
String = '"' ('\"' | .)* '"'
Bool = "true" | "false"
Identifier = [a-z][A-Za-z0-9_]*
Type = TypeAtom ("->" TypeAtom)*
TypeAtom = TypeIdentifier | "(" Type ")"
TypeIdentifer = [A-Z][A-Za-z0-9_]*
```Line comments are done with `--`, block comments with `{- -}`.
See [here](./examples/simple-example.ewe) for an example.