Stable, flexible, peephole pretty-printing

Stoney Jackson, Premkumar Devanbu, Kwan-Liu Ma

Research output: Contribution to journalArticle

4 Scopus citations

Abstract

Programmers working on large software systems are faced with an extremely complex, information-rich environment. To help navigate through this, modern development environments allow flexible, multi-window browsing and exploration of the source code. Our focus in this paper is on pretty-printing algorithms that can display source code in useful, appealing ways in a variety of styles. Our algorithm is flexible, stable, and peephole-efficient. It is flexible in that it is capable of screen-optimized layouts that support source code visualization techniques such as fisheye views. The algorithm is peephole-efficient, in that it performs work proportional to the size of the visible window and not the size of the entire file. Finally, the algorithm is stable, in that the rendered view is identical to that which would be produced by formatting the entire file. This work has 2 benefits. First, it enables rendering of source codes in multiple fonts and font sizes at interactive speeds. Second, it also allows the use of powerful (but algorithmically more complex) visualization techniques (such as fish-eye views), again, at interactive speeds. We have built a pretty-printing plug-in for Eclipse that allows the use of sophisticated formatting techniques, including such features as multiple fonts and fish-eye views. Our incremental algorithm enables this plug-in to produce readable layouts (without ugly line-wrapping) within a wide range of window sizes, at interactive speeds.

Original languageEnglish (US)
Pages (from-to)40-51
Number of pages12
JournalScience of Computer Programming
Volume72
Issue number1-2
DOIs
Publication statusPublished - Jun 1 2008

    Fingerprint

Keywords

  • Development environment
  • Experimental software
  • Pretty printer
  • Software visualiation

ASJC Scopus subject areas

  • Software

Cite this