Prettyprinting
- 1 October 1980
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Programming Languages and Systems
- Vol. 2 (4) , 465-483
- https://doi.org/10.1145/357114.357115
Abstract
An algorithm for prettyprinting is given. For an input stream of length n and an output device with linewidth m , the algorithm requires time O ( n ) and space O ( m ). The algorithm is described in terms of two parallel processes: the first scans the input stream to determine the space required to print logical blocks of tokens; the second uses this information to decide where to break lines of text; the two processes communicate by means of a buffer of size O ( m ). The algorithm does not wait for the entire stream to be input, but begins printing as soon as it has received a full line of input. The algorithm is easily implemented.Keywords
This publication has 7 references indexed in Scilit:
- Prettyprinting PASCAL programsACM SIGPLAN Notices, 1978
- On the formatting of Pascal programsACM SIGPLAN Notices, 1977
- Early experience with MesaCommunications of the ACM, 1977
- An automatic formatting program for PASCALACM SIGPLAN Notices, 1977
- SOAP--A program which documents and edits ALGOL 60 programsThe Computer Journal, 1971
- NEATER2Communications of the ACM, 1970
- Algorithm 268: ALGOL 60 reference language editor [R2]Communications of the ACM, 1965