T — type
- Variable
X - Arrow
T -> T - Universal
Forall X. T
t — term
- Variable
x - Abstraction
lambda x : T. t - Application
t $ t - Type abstraction
Lambda X. t - Type application (should be space after
[!)t $ [ T ]
- Comments
{- some text -} - Term separator (if placed in the end of file, parser raises error)
;
{- self-application -}
lambda x : Forall A. A -> A.
x $ [ Forall A. A -> A ] $ x;
{- succesor -}
lambda n : Forall X. (X -> X) -> X -> X.
Lambda X.
lambda s : X -> X.
lambda z : X.
s $ (n $ [ X ] $ s $ z)
git clone https://github.com/prokartem/simple_lambda_typechecker.git
cd simple_lambda_typechecker
curl -sSL https://get.haskellstack.org/ | sh -s - -f
stack build
Available options:
- Input file
-f,--file FILENAME - Read from stdin
--stdin - Show this help text
-h,--help
stack exec -- lambda-calculus-exe ((-f|--file FILENAME) | --stdin)
stack test