Abstract
There is a long history of implementing functional languages, particularly those with first-class control operators, using the CPS (Continuation Passing Style) transformation. In this talk I will show how continuations can be used to model control flow and order of evaluation in a compiler IR (Intermediate Representation), even for languages that lack first-class control operators. CPS is used only because it is a good place to do optimisation. This idea has been applied in practice in the new "Flambda 2" IR for the OCaml programming language.
It turns out that the idea of continuations can also be used in type inference for imperative programming languages. At Meta (formerly Facebook) we have developed a version of PHP with static types and a system of flow-sensitive type inference based on typed continuations.