A program that will interpret programs written in the lambda calculus. It accepts files in either standard notation (λx.x
) with extension .lca
or in DeBruijn Index notation (λ 0
) with extension .ldb
. Output will always be in DeBruijn Index notation.
git clone https://github.com/ammrat13/lambda-calculus-interpreter.git
cd lambda-calculus-interpreter/src
ghc -O2 -odir ../out/o -hidir ../out/hi -o ../lcainter.exe Main.hs
cd ..
lcainter path/to/input/file
An input file has many lambda expressions, each on their own line. Blank lines are ignored. Each expression has the form let name = body
, where body
is a lambda expression. Lambda expressions must use \
in place of λ
. The expression must be in standard notation if the file ends with .lca
or in DeBruijn Index notation if the file ends in .ldb
. Each expression can substitute expressions defined before it into it by their name. After the file is parsed, the expression corresponding to the name main
is fully reduced by beta and eta reduction, and the reduced expression is printed on screen in DeBruijn Index form.
In order of significance:
- Add example files
- Allow for
import
statements - Use the
λ
character instead of\
- Use the
Text
library instead ofString
s - Output in Standard Notation