fact: Fixpoint compile_instr (symbols : list string)(loc : nat) (i : instr0 string) {struct i} : list assembly := match i with | assign s e => let cp_exp := compile_aexp symbols e in compile_aexp symbols e ++ [store (symbol_index symbols s)] | sequence i1 i2 => let pg1 := compile_instr symbols loc i1 in let pg2 := compile_instr symbols (loc + length pg1) i2 in pg1 ++ pg2 | while b i1 => let pge := compile_bexp symbols b in let pgi := compile_instr symbols (loc + length pge + 1) i1 in pge ++ branch (loc + length pge + length pgi + 2) :: pgi ++ [goto loc] | skip => [] end.
imports: ZArith Arith List syntax little Lia