skip to main content
article
Free Access

An Algorithm for Structuring Flowgraphs

Published:01 January 1977Publication History
Skip Abstract Section

Abstract

This paper describes an algorithm which transforms a flowgraph into a program containing control constructs such as if then else statements, repeat (do forever) statements, multilevel break statements (causing jumps out of enclosing repeats), and multilevel next statements (causing jumps to iterations of enclosing repeats). The algorithm can be extended to create other types of control constructs, such as while or until. The program appears natural because the constructs are used according to common programming practices. The algorithm does not copy code, create subroutines, or add new variables. Instead, goto statements are generated when no other available control construct describes the flow of control. The algorithm has been implemented in a program called STRUCT which rewrites Fortran programs using constructs such as while, repeat, and if then else statements. The resulting programs are substantially more readable than their Fortran counterparts.

References

  1. 1 AHO, A V, AND ULLMAN, J D The Theory of Parsing, Translation, and Compdmg, VoL IL Complhng Prentice-Hall, Englewood Chffs, N J, 1973 Google ScholarGoogle Scholar
  2. 2 ASMCROFT, E, AND MANNA, Z Translating program schemas to while-schemas SlAM J. Comptg 4, 2 (1975), 125-146Google ScholarGoogle Scholar
  3. 3 BAKER, B.S Struct, a program which structures Fortran Internal memo, Bell Labs, Murray Hdl, N J., 1975.Google ScholarGoogle Scholar
  4. 4 BAKER, B S. Automatic structurmg of programs In preparationGoogle ScholarGoogle Scholar
  5. 5 DE BALBINE, G Better Man Power UUhzation Using Automatic Restructuring Came, Farber & Gordon, Inc., 1974Google ScholarGoogle Scholar
  6. 6 DE BALBINE, G Using the Fortran structuring engme In Proc of Comp Sci and Stat 8th Ann Syrup on the Interface, Los Angeles, 1975, pp 297-305Google ScholarGoogle Scholar
  7. 7 BOHM, C, AND JACOPINI, G Flow dmgrams, Turmg machines and languages with only two formation rules Comm ACM 9, 5 (May 1966), 366-371 Google ScholarGoogle Scholar
  8. 8 BRONO, J, AND STEIGLITZ, K The expression of algorithms by charts d ACM 19, 3 (July 1972), 366-371 Google ScholarGoogle Scholar
  9. 9 COOPER, D C Bohm and Jacopml's reduction of flow charts Carom ,4CM 10, Aug 1967), 463 (Letter) Google ScholarGoogle Scholar
  10. 10 DAHL, O-J, DUKSTRA, E W, AND HOARE, C A R Structured Programmmg Academic Press, New York, 1972. Google ScholarGoogle Scholar
  11. 11 DIJKSTRA, E W Go to statement considered harmful Comm ACM 11, 3 (March 1968), 147-148 Google ScholarGoogle Scholar
  12. 12 HECHT, M S, AND ULLMAN, J.D Characterlzauons of reducible flowgraphs J ACM 21, 3 (july 1974), 367-375 Google ScholarGoogle Scholar
  13. 13 KERNIGHAN, B W Ratfor -- a preprocessor for a rational Fortran Software Pracnce and Experience 5, 4 (1975), 395-406Google ScholarGoogle Scholar
  14. 14 KEgNIGHAN, BW, AND CHERRY, L L A system for typesetting mathematics Comm ACM 18, 3 (March 1975), 151-156 Google ScholarGoogle Scholar
  15. 15 KNUTH, D E, AND FLOYD, R W Notes on avoiding "go to" statements Infor Proc Letters 1 (1971), 23-31Google ScholarGoogle Scholar
  16. 16 KNUTH, D E Structured programming with go to statements ACM Comptg Surveys 6, 4 (1974), 261-302 Google ScholarGoogle Scholar
  17. 17 KOSARAJU, S.R. Analysis of structured programs. J. Comptr. Sys. Scl. 9, 3 (1974), 232-254Google ScholarGoogle Scholar
  18. 18 LESK, M E, KERNIGHAN, B W, AND RITCmE, D M The C programming manual Comptg Sct Tech. Rep #31, Bell Labs, Murray Hill, N JGoogle ScholarGoogle Scholar
  19. 19 PETERSON, W W, KASAMI, T, AND TOKURA, N. On the capabilities of whde, repeat and exit statements Comra ACM 16, 8 (Aug 1973), 503-512 Google ScholarGoogle Scholar
  20. 20 Ra'rcmE, D M, AND THOMPSON, K The UNIX time-sharing system Comrn ACM 17, 7 (July 1974), 365-375 Google ScholarGoogle Scholar

Index Terms

  1. An Algorithm for Structuring Flowgraphs

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image Journal of the ACM
          Journal of the ACM  Volume 24, Issue 1
          Jan. 1977
          175 pages
          ISSN:0004-5411
          EISSN:1557-735X
          DOI:10.1145/321992
          Issue’s Table of Contents

          Copyright © 1977 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 January 1977
          Published in jacm Volume 24, Issue 1

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader