Crosscompiler explained by the Example of Translating Fortran to Ada
H. Dobler - Crosscompiler explained by the Example of Translating Fortran to Ada - Trauner Verlag Linz, 1994, pp. 1-212
Fortran is one of the oldest programming languages. In the domain of technical and scientific applications it succeeded well in maintaining its predominance up to now. In the course of more than twenty years a huge amount of Fortran software has been (and still is being) built. This software represents a ma¬jor investment for its producers and invaluable capital for its users.
Ada is one of the most modern programming languages. Its design covers concepts that can be trend-setting in the nineties—and beyond, perhaps. Due to its standardization, the avail¬ability of implementations and the adjustment to changing needs, Ada will take over the leading role of Fortran in some key areas.
One way out of the often cited software crisis leads along the way of reuse of soft¬ware. There¬fore, a tool that supports the translation of Fortran programs to Ada is not only of scientific interest because of the significant language differences but of economical impact, too. How¬ever, this idea is not new, and some translation systems are available and have been described in the literature. But these systems either suffer from severe limitations in the scope of the language constructs handled or from the inefficiency of the generated Ada programs.
The goals of the work described in this thesis have been to study cross compilation techniques, to build a techni¬cally sound implementation conforming to the state of the art in soft¬ware engi¬neering, and to overcome the deficiencies of the systems mentioned above, especially to allow the complete handling of Fortran 77. In addition, the applicability of Ada as im¬plementation language was to be investigated in the course of the project.
The main concepts involved in the design and the implementation of the system lie in
• the use of an attribute grammar,
• the application of compiler generators for the construction of the front end, and
• the in¬corporation of two intermediate languages.
Without the use of a compiler generator, the bare implementation of a con¬ventional hand-coded syntax analyzer would have exceeded the schedule. The considerable effort required for the application of two inter¬mediate languages has paid off well, as this invested effort was returned multifold in the implementation of the Fortran-to-Ada transformation unit and in the con¬struc¬tion of the back end. Moreover, it al¬lowed for a clear structuring of the translation pro¬gram, which is built of loosely coupled com¬ponents that qualify for simple testing and mainte¬nance.
The result of the work is a large software system consisting of two components: the translation program itself (the cross compiler) and a library of Ada packages to support the cross compiler-generated Ada pro¬grams (the run-time system). This translation system handles the full set of Fortran 77 language constructs and generates readable and maintainable Ada programs with a run-time efficiency only slightly under the efficiency of the original Fortran software.
The combination of the applied concepts together with the complete handling of Fortran 77 and the good run-time efficieny of the target programs represents the main scientific novelty of this system and sets it off from other systems of this kind.