Printing evaluation order

This commit is contained in:
sebastianselander 2023-05-08 22:08:59 +02:00
parent 56c80faeff
commit ee30b5db45

View file

@ -17,12 +17,18 @@ data Val where
VInt : Int -> Val VInt : Int -> Val
VClos : Env -> Int -> Exp -> Val VClos : Env -> Int -> Exp -> Val
data List a where printExp : Exp -> Unit
Nil : List a printExp exp = case exp of
Cons : a -> List a -> List a EInt _ => printStr "EInt\n"
EAdd _ _ => printStr "EAdd\n"
EAbs _ _ => printStr "EAbs\n"
EApp _ _ => printStr "EApp\n"
EVar _ => printStr "EVar\n"
const x y = x
-- interp : Env -> Exp -> Val -- interp : Env -> Exp -> Val
interp env exp = case exp of interp env exp = case const exp (printExp exp) of
EInt i => VInt i EInt i => VInt i
EAdd e1 e2 => case interp env e1 of EAdd e1 e2 => case interp env e1 of
VInt i => case interp env e2 of VInt i => case interp env e2 of