-
-
Save frozendevil/fc0e228e27c4c9e8332f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec eval2 t = match t with | |
t1 when isval(t1) -> | |
t1 | |
| TmIf(_, t1, t2, t3) -> | |
(match eval2 t1 with | |
TmTrue(_) -> eval2 t2 | |
| TmFalse(_) -> eval2 t3 | |
| _ -> raise NoRuleApplies) | |
| TmSucc(fi, t1) -> | |
(match eval2 t1 with | |
t1' when isnumericval t1' -> TmSucc(fi, t1') | |
| _ -> raise NoRuleApplies) | |
| TmPred(_, t1) -> | |
(match eval2 t1 with | |
TmZero(_) -> TmZero(dummyinfo) | |
| TmSucc(_, nv1) -> eval2 nv1 | |
| _ -> raise NoRuleApplies) | |
| TmIsZero(_, t1) -> | |
(match eval2 t1 with | |
TmZero(_) -> | |
TmTrue(dummyinfo) | |
| TmSucc(_, _) -> | |
TmFalse(dummyinfo) | |
| _ -> | |
raise NoRuleApplies) | |
| _ -> raise NoRuleApplies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment