Abstract
A new control structure construct, thewhile-until, is introduced as a syntactic combination of thewhile statement and therepeat-until statement. Examples show that the use of thewhile-until can lead to structured programs that are conceptually more manageable than those attainable without it. Thewhile-until statement is then extended to a value-returning expression which is shown to be more powerful than the classical looping structures. It is shown to be equivalent in power to those structures withexit when a value-returningif-then-else is allowed. As a consequence, there are flowcharts whose implementations require control structures stronger than thewhile-until. Implementation details are discussed and Hoare-like axioms are presented. A closing discussion on oesthetics discourages some natural generalizations, but it concludes that the basicwhile-until is convenient for all parties on a programming team: coder, reader, compiler, and validator.
Similar content being viewed by others
References
E. Ashcroft and Z. Manna,The translation of “go to” programs to “while” programs, Information Processing 71, North-Holland (1972), 250–255.
G. V. Bochmann,Multiple exits from a loop without the GOTO, Comm. ACM 16, 7 (July, 1973), 443–444.
C. Böhm and G. Jacopini,Flow diagrams, Turing machines and languages with only two formulation rules, Comm. ACM 9, 5 (May, 1966), 366–371.
D. C. Cooper,Böhm and Jacopini's reduction of flowcharts, Comm. ACM 10, 8 (August, 1967), 463, 473.
E. W. Dijkstra,Notes on structured programming, Structured Programming, Academic Press, London (1972), 1–82.
R. V. Evans,Multiple exits from a loop using neither GO TO nor labels, Comm. ACM 17, 11 (November, 1974), 650.
D. P. Friedman and S. C. Shapiro,A case for the while-until, SIGPLAN Notices 9, 77 (July, 1974), 7–14.
M. S. Hecht and J. D. Ullman,Flow graph reducibility, SIAM J. Comput. 1, 2 (June, 1972), 188–202.
C. A. R. Hoare,An axiomatic basis for computer programming, Comm. ACM 12, 10 (October, 1969), 576–580, 583.
D. E. Knuth,Sorting and Searching, Addison-Wesley, Reading, Mass. (1973), 146–148.
D. E. Knuth,Structured programming with GO TO statements, Computing Surveys 6, 4 (December, 1974), 261–301.
S. R. Kosaraju,Analysis of structured programs, J. Comput. System Sci. 9, 3 (December, 1974), 232–255.
Z. Manna,Mathematical Theory of Computation, McGraw-Hill, New York (1974), Chapter 3.
J. McCarthy et al.,LISP 1.5 Programmers Manual, MIT Press, Cambridge, Mass. (1962).
I. Nassi and B. Shneiderman,Flowchart techniques for structured programming, SIGPLAN Notices 8, 8 (August, 1973), 12–26.
W. W. Peterson, T. Kasami, and N. Tokura,On the capabilities of while, repeat, and exist statements, Comm. ACM 16, 8 (August, 1973), 503–512.
D. M. Symes,New control structures to aid gotolessness, Proc. 2nd ACM Symp. on Principles of Programming Languages (1975), 194–203.
A. van Wijngaarden, (Ed.), B. J. Mailloux, J. E. L. Peck and C. H. A. Koster,Report on the algorithmic language ALGOL 68, Numer. Math. 14 (1969), 79–218.
N. Wirth,On the composition of well-structured programs, Computing Surveys 6, 4 (December, 1974), 247–259.
W. A. Wulf, D. B. Russell and A. N. Haberman,BLISS: a language for systems programming, Comm. ACM 14, 12 (December, 1971), 780–790.
C. T. Zahn, Jr.,A control statement for natural top-down structured programming. In B. Robinet (ed.),Programming Symposium, Springer-Verlag, Berlin (1974), 170–180.