%%% Continuation-Passing Machine for Mini-ML %%% Author: Frank Pfenning % Machine Instructions inst : type. %name inst I. ev : exp -> inst. return : exp -> inst. case1 : exp -> exp -> (exp -> exp) -> inst. pair1 : exp -> exp -> inst. fst1 : exp -> inst. snd1 : exp -> inst. app1 : exp -> exp -> inst. app2 : exp -> exp -> inst. % Continuations cont : type. %name cont K. init : cont. ; : cont -> (exp -> inst) -> cont. %infix left 8 ;. % Continuation Machine States state : type. %name state S. # : cont -> inst -> state. answer : exp -> state. %infix none 7 #.