Typeful Continuations - Archive ouverte HAL Access content directly
Conference Papers Year : 2017

Typeful Continuations

Abstract

Continuation-passing style translations, or CPS, are used notably in compilers. They make a functional program more explicit by sequentializing its computations and reifying its control. They have been used as an intermediate language in many compilers. Yet, we cannot directly use Plotkin's original CPS translation to design compilers, for several reasons: i) the resulting terms it produces are verbose (they contain " administrative redexes " , a well-studied problem) and inefficient (they perform nested beta-reductions sequentially); and ii) their loose syntax can hide possible further optimizations, in particular tail call elimination. These issues have been solved in isolation and on paper, but never combined together and formalized, which i) is necessary to scale to safe, full-featured optimizing compilers and ii) is not a mere juxtaposition of the techniques but requires insight on the design of CPS translations themselves. We propose to design and implement in OCaml a compacting, optimizing CPS translation, while using OCaml's type system to verify that it maps well-typed terms to well-typed terms in a tightly restricted syntactical form (the " typeful " approach to formalization). The resulting artifact can be used directly to design optimizing compilers, and the path towards it offers a tutorial on optimizing CPS translations, and yet another use case for OCaml's advanced type system.
Fichier principal
Vignette du fichier
typeful-continuations.pdf (459.15 Ko) Télécharger le fichier
Origin : Files produced by the author(s)
Loading...

Dates and versions

hal-01419473 , version 1 (19-12-2016)

Identifiers

  • HAL Id : hal-01419473 , version 1

Cite

Matthias Puech. Typeful Continuations. JFLA 2017 - 28ème Journées Francophones des Langages Applicatifs, Jan 2017, Gourette, France. pp.1-14. ⟨hal-01419473⟩
228 View
220 Download

Share

Gmail Facebook X LinkedIn More