ACM Home Page
Please provide us with feedback. Feedback
Eliminating go to's while preserving program structure
Full text PdfPdf (2.46 MB)
Source Journal of the ACM (JACM) archive
Volume 35 ,  Issue 4  (October 1988) table of contents
Pages: 893 - 920  
Year of Publication: 1988
ISSN:0004-5411
Author
Lyle Ramshaw  Digital Equipment Corp. Systems Research Center, Palo Alto, CA
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 8,   Downloads (12 Months): 53,   Citation Count: 16
Additional Information:

abstract   references   cited by   index terms  

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/48014.48021
What is a DOI?

ABSTRACT

Suppose we want to eliminate the local go to statements of a Pascal program by replacing them with multilevel loop exit statements. The standard ground rules for eliminating go to's require that we preserve the flow graph of the program, but they allow us to completely rewrite the control structures that glue together the program's atomic tests and actions. The go to's can be eliminated from a program under those ground rules if and only if the flow graph of that program has the graph-theoretic property named reducibility. This paper considers a stricter set of ground rules, introduced by Peterson, Kasami, and Tokura, which demand that we preserve the program's original control structures, as well as its flow graph, while we eliminate its go to's. In particular, we are allowed to delete the go to statements and the labels that they jump to and to insert various exit statements and labeled repeat-endloop pairs for them to jump out of. But we are forbidden to change the rest of the program text in any way. The critical issue that determines whether go to's can be eliminated under these stricter rules turns out to be the static order of the atomic tests and actions in the program text. This static order can be encoded in the program's flow graph by augmenting it with extra edges. It can then be shown that the reducibility of a program's augmented flow graph, augmenting edges and all, is a necessary and sufficient condition for the eliminability of go to's from that program under the stricter rules.


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
3
4
5
 
6
HECHT, M. S., AND ULLMAN~ J.D. Flow eraph reducibility. SIAM J. Comput. 1, 2 (June 1972), 188-202.
7
 
8
 
9
KEOHANE, J., CHERNIAVSKY, J. C., AND HENDERSON, P.I. On transforming control structures. SIAM J. Comput. 11, 2 (May 1982), 268-286.
 
10
11
 
12
 
13
 
14
KNUTH, D. E., AND FLOYD, R.W. Notes on avoiding "go to" statements. InJ? Process. Lett. I, 1 (Feb. 197 l), 23-31 and 177.
 
15
KOSARAJU, S. R. Analysis of structured programs. J. Comput. System Sci. 9, 3 (Dec. 1974), 232-235.
16
 
17
Mri~CHELL, .l.G., MAYBURY, W., AND SWEET, R. Mesa language manual. Tech. rep. ~aL-/~,-a. Xerox Palo Alto Research Center, Palo Alto, Calif., Apr. 1979.
 
18
PETERSON, W. W., KASAMI, T., AND TOKURA, N. On the capabilities of while, repeat, and exit
 
19
RAMSHAW, L. Problem 83-1, Jr. Algorithms 4, 1 (Mar. 1983), 85-86.
 
20
 
21
WILLIAMS, M. H., AND CHEN, G. Restructuring Pascal programs containing goto statements. Comput. J. 28, 2 (May 1985), 134-137.
 
22

CITED BY  16