MOUSE4: An improved implementation of the RATFOR preprocessor

Douglas E. Comer · Software Practice and Experience · 1978

Abstract RATFOR is a preprocessor language for FORTRAN that supports structured flow of control statements and macrosubstitution. The RATFOR processor, written in RATFOR, is modular, carefully coded and portable, but extremely inefficient. A profile of the running time revealed that a linear search in the macroprocessor consumed over half of the CPU time. Running time was reduced by over 50 per cent when a binary search was used. Our observation is of interest primarily because it differs from previously reported measurements. A more dramatic improvement in running time was obtained by rewriting the ad hoc lexical scanner using a standard method based on finite automata. For a 3,000‐line source program the standard RATFOR required 185.470 CPU seconds on a CDC 6500 while the automata‐based version needed only 12.723 seconds. We conclude that, contrary to evidence exhibited by the designer of RATFOR, sequential search is often inadequate for production software. Furthermore, in the case of lexical analysis, well‐known techniques do seem to offer efficiency while retaining the simplicity, ease of coding and modularity of ad hoc methods.

Read the paper · More papers on PaperTik