¶Kennedy2007
Andrew Kennedy. 2007. Compiling with continuations, continued. In Proceedings of the 12th ACM SIGPLAN international conference on Functional programming (ICFP '07). Association for Computing Machinery, New York, NY, USA, 177–190
¶Abstract
We present a series of CPS-based intermediate languages suitable for functional language compilation, arguing that they have practical benefits over direct-style languages based on A-normal form (ANF) or monads. Inlining of functions demonstrates the benefits most clearly: in ANF-based languages, inlining involves a re-normalization step that rearranges let expressions and possibly introduces a new 'join point' function, and in monadic languages, commuting conversions must be applied; in contrast, inlining in our CPS language is a simple substitution of variables for variables.
We present a contification transformation implemented by simple rewrites on the intermediate language. Exceptions are modelled using so-called 'double-barrelled' CPS. Subtyping on exception constructors then gives a very straightforward effect analysis for exceptions. We also show how a graph-based representation of CPS terms can be implemented extremely efficiently, with linear-time term simplification.
¶BiBTeX
@inproceedings{10.1145/1291151.1291179, author = {Kennedy, Andrew}, title = {Compiling with continuations, continued}, year = {2007}, isbn = {9781595938152}, publisher = {Association for Computing Machinery}, address = {New York, NY, USA}, url = {https://doi.org/10.1145/1291151.1291179}, doi = {10.1145/1291151.1291179}, booktitle = {Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming}, pages = {177–190}, numpages = {14}, keywords = {continuation passing style, continuations, functional programming languages, monads, optimizing compilation}, location = {Freiburg, Germany}, series = {ICFP '07} }