fact: Fixpoint compile_com (c: com) : code := match c with | SKIP => nil | ASSIGN x a => compile_aexp a ++ Isetvar x :: nil | SEQ c1 c2 => compile_com c1 ++ compile_com c2 | IFTHENELSE b ifso ifnot => let code_ifso := compile_com ifso in let code_ifnot := compile_com ifnot in compile_bexp b 0 (codelen code_ifso + 1) ++ code_ifso ++ Ibranch (codelen code_ifnot) :: code_ifnot | WHILE b body => let code_body := compile_com body in let code_test := compile_bexp b 0 (codelen code_body + 1) in code_test ++ code_body ++ Ibranch (- (codelen code_test + codelen code_body + 1)) :: nil end.
imports: Coq(Arith ZArith Psatz Bool String List Program.Equality) CDF(Sequences IMP Simulation)