藉由分析ANF跟monadic form的機器表示的意圖,Bowman提出了Imperative monadic form。只要我們讓
let x := a
in b
等於
set! x := a
b
的別稱。在語意上commuting conversion就不再是困擾了
set! y := {
set! x := t
t
}
t
等於
set! x := t
set! y := t
t
箝套的if也不再是問題
set! y := if v t1 t2
t
等於
if v
set! y := t1
set! y := t2
t
注意到右邊幾乎已經是指令語言可以處理的形式了
注意到為了支援對if expression的轉換,需要加入if statement
tsv::=(begin s t)∣v∣(if0 v t t)∣(call v v)∣(op v)::=(begin s)∣(set! x v)∣(if0 v s s)∣(set! x t)∣(set! x (op v))∣(set! x (call v v))::=(λ (x) t)∣ι