🕸️ Try-Catch

This commit is contained in:
2024-09-06 14:14:44 +02:00
parent b4f8b71ade
commit e96686ab9a
3 changed files with 12 additions and 3 deletions

View File

@ -86,6 +86,8 @@ eval env (Apply e1 e2) =
(_, Left err) -> Left err
(Right (ValFun env2 var e3), Right x) -> eval (envExtend var x env2) e3
(_, _) -> Left "Applying non-function"
eval env (TryCatch e1 e2) =
case (eval env e1) of
(Right x) -> Right x
(Left _) -> eval env e2
-- TODO: Add cases after extending Exp.