Stable, flexible, peephole pretty-printing

  • Authors:
  • Stoney Jackson;Premkumar Devanbu;Kwan-Liu Ma

  • Affiliations:
  • Deptartment of Computer Science and Information Technology, Western New England College, 1215 Wilbraham Rd., Springfield, MA 01119, United States;Deptartment of Computer Science, University of California, Davis, One Shields Ave., Davis, CA 95616, United States;Deptartment of Computer Science, University of California, Davis, One Shields Ave., Davis, CA 95616, United States

  • Venue:
  • Science of Computer Programming
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

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.