Slide 44
Slide 44 text
インタプリタのステップ実行
def stepExec (st : ItpState) : Option (Label × ItpState) :=
match st with
| (.assign x a, k, s) => .some (.tau, (.skip, k, update x (aEval s a) s))
| (.seq c1 c2, k, s) => .some (.tau, (c1, .kSeq c2 k, s))
| (.ifThenElse b c1 c2, k, s) =>
.some (.tau, if bEval s b then c1 else c2, k, s)
| (.while_ b c, k, s) =>
if bEval s b
then .some (.tau, (c, .kWhile b c k, s))
else .some (.tau, (.skip, k, s))
| (.skip, .kSeq c k, s) => .some (.tau, (c, k, s))
| (.skip, .kWhile b c k, s) => .some (.tau, (.while_ b c, k, s))
| (.print a, k, s) => .some (.out (aEval s a), (.skip, k, s))
| (.skip, .kStop, _) => .none