Continuation Passing Style (CPS) is a form of code where the control is passed explicitly, by passing the continuation of the code at each call point, unlike direct style.
There are many descriptions in the literature for how to convert from direct style to CPS. The following pseudo-JavaScript:
function direct() {
var a = foo(1);
return bar(a);
}
becomes:
function cps(cont) {
foo(1, function(a) {
bar(a, cont);
}
}
But are there any descriptions of the reverse transformation, where the CPS representation is taken back to a direct style?