Cornell University
Library
Cornell UniversityLibrary

eCommons

Help
Log In(current)
  1. Home
  2. Cornell Computing and Information Science
  3. Computer Science
  4. Computer Science Technical Reports
  5. A New Language - Independent Prettyprinting Algorithm

A New Language - Independent Prettyprinting Algorithm

File(s)
87-808.pdf (1.35 MB)
87-808.ps (302.17 KB)
Permanent Link(s)
https://hdl.handle.net/1813/6648
Collections
Computer Science Technical Reports
Author
Pugh, William W.
Sinofsky, Steven J.
Abstract

An algorithm for prettyprinting using word wrapping is described that is independent of the language being formatted and is substantially simpler than other published algorithms. The algorithm makes use of a simple model with a small set of primitives to direct the prettyprinting of text. For an input string of length $n$, and an output device $m$ characters wide the algorithm runs in $O(n)$ time and requires $O(m)$ space. The algorithm can be restarted from an intermediate point and is therefore well suited for incremental prettyprinting of text. This algorithm is now being used in the Cornell Synthesizer Generator [2]. The algorithm is compared with and contrasted to the previously published algorithm by Oppen [1].

Date Issued
1987-01
Publisher
Cornell University
Keywords
computer science
•
technical report
Previously Published as
http://techreports.library.cornell.edu:8081/Dienst/UI/1.0/Display/cul.cs/TR87-808
Type
technical report

Site Statistics | Help

About eCommons | Policies | Terms of use | Contact Us

copyright © 2002-2026 Cornell University Library | Privacy | Web Accessibility Assistance