Pretty Printing with Delimited Continuations

Chitil, Olaf (2006) Pretty Printing with Delimited Continuations. Technical report. University of Kent, Kent, UK (Full text available)

Download (181kB) Preview


Pretty printing is the task of nicely formatting tree structured data within a given line width limit. In 1980 Oppen published a pretty printing algorithm that takes time linear in the size of the input, independent of the line width, and uses only limited look-ahead. This work inspired the development of a number of purely functional pretty printing libraries in Haskell. Here I present a new functional pretty printing algorithm that has all the nice properties of Oppen's and is surprisingly simple. A double-ended queue of delimited continuations is the key to addressing all aspects of the problem explicitly.

Item Type: Monograph (Technical report)
Uncontrolled keywords: Haskell, double-ended queue, least-strict, lazy
Subjects: Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming,
Divisions: Faculties > Sciences > School of Computing > Theoretical Computing Group
Depositing User: Olaf Chitil
Date Deposited: 24 Nov 2008 18:04 UTC
Last Modified: 16 Nov 2016 21:02 UTC
Resource URI: (The current URI for this page, for reference purposes)
  • Depositors only (login required):


Downloads per month over past year