GOTO Removal Based on Regular Expressions

Paul H. Morris, RONALD A. GRAY, Robert E. Filman · Journal of Software Maintenance Research and Practice · 1997

We present an algorithm for eliminating GOTOs and replacing them with structured IF-THEN-ELSE and loop constructs. Previous approaches have treated GOTO removal as an isolated problem for programming languages. In this paper, we describe a way of reducing GOTO removal to the well-understood problem of converting a finite-state transition network to a regular expression. A semantics is provided showing how the regular expression form may be interpreted as a non-deterministic program. A set of pattern-based reduction rules is used to transform the regular expression form back to a conventional structured program. Besides achieving greater conceptual unity, the method leads to a simpler algorithm where the task of recognizing loop boundaries is separated from that of identifying loop exits. We have successfully applied the algorithm in systems for re-engineering COBOL/IMS database systems and assembly language code. © 1997 by John Wiley & Sons, Ltd. J. Software Maintenance 9: 47–66, 1997

Read the paper · More papers on PaperTik