ACM Home Page
Please provide us with feedback. Feedback
An algorithm for structuring programs (Extended Abstract)
Full text PdfPdf (771 KB)
Source Annual Symposium on Principles of Programming Languages archive
Proceedings of the 3rd ACM SIGACT-SIGPLAN symposium on Principles on programming languages table of contents
Atlanta, Georgia
Pages: 113 - 126  
Year of Publication: 1976
Author
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
SIGACT: ACM Special Interest Group on Algorithms and Computation Theory
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 2,   Downloads (12 Months): 17,   Citation Count: 0
Additional Information:

abstract   references   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/800168.811545
What is a DOI?

ABSTRACT

Structured programming emphasizes programming language constructs such as while loops, until loops, and if then else statements. Properly used, these constructs make occurrences of loops and branching of control obvious. They are preferable to goto statements, which tend to obscure the flow of control [DDH,DIJ]. This paper describes an algorithm which transforms a flowgraph into a program written using repeat (do forever) and if then else statements. The goal of the algorithm is to produce readable programs, rather than to avoid the use of goto statements entirely. goto statements are generated when there is no better way to describe the flow of control. A number of techniques for eliminating goto statements from programs have been previously published [AM, BJ, BS, COO, KF, KOS, PKT]. However, these techniques do not necessarily produce clear flow of control [KN]. Misuse of control constructs may mislead the reader into expecting patterns of control flow which do not exist in the algorithm. For example, these techniques may use a repeat statement when the contained code cannot be executed more than once or add numerous control variables to avoid goto statements. They also may avoid goto statements by copying segments of code or creating subroutines. The former method results in longer programs and bugs may be introduced when all the identical segments must be modified. The latter method may result in subroutines which appear unnatural.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
 
2
E. Ashcroft and Z. Manna, Translating program schemas to while-schemas, SIAM J. on Comp. 4,2 (1975), 125-146.
 
3
B. S. Baker, struct, a program which structures fortran, in preparation.
4
 
5
J. Bruno and K. Steiglitz, The expression of algorithms by charts, J. ACM 19 (1966),366-371.
6
 
7
8
9
 
10
M. S. Hecht and J. D. Ullman, Flow graph reducibility, SIAM J. Comput. 1 (1972), 188-202.
 
11
B. W. Kernighan, ratfor - a preprocessor for a rational fortran, Software Practice and Experience 5,4 (1975), 395-406.
 
12
D. E. Knuth and R. W. Floyd, Notes on avoiding "go to" statements, Infor. Proc. Letters 1 (1971), 23-31.
13
 
14
S.R. Kosaraju, Analysis of structured programs, J. Comp. Sys. Sci. 9,3 (1974), 232-254.
15