Update lambda interpreter example

This commit is contained in:
Martin Fredin 2023-05-24 23:50:01 +02:00
parent c1768b0161
commit a03f139e5c
5 changed files with 14 additions and 5 deletions

BIN
demo/lambda_calculus Executable file

Binary file not shown.

View file

@ -40,10 +40,14 @@ eval cxt exp = case exp of
let i2 = case eval cxt e2 of { VInt i => i } in
VInt (i1 + i2)
exp = EApp (EAbs 'x' (EVar 'x')) (EApp (EAbs 'x' (EAdd (EVar 'x') (EInt 100))) (EInt 200))
-- (λ x . x) (λ x . x + 100) 200
-- (λx. x + x) 200
exp = EApp
(EAbs 'x'
(EAdd
(EVar 'x')
(EVar 'x')))
(EInt 200)
main : Int
main = case eval (Cxt Nil) exp of
VInt i => i

Binary file not shown.

BIN
demo/lc

Binary file not shown.