AbstractThis paper describes how to translate the compiler directives for conditional compilation in automated source-to-source translation between high-level programming languages. The directives for conditional compilation of the source language are translated into the corresponding directives of the target language, and the source program text of each branch of conditional compilation is translated into the corresponding target program text. Such translation raises a problem in conventional parsing because the source text is not a continuous stream of tokens of a legal program but rather a sequence of fragments that must be combined in certain ways to obtain one of several possible alternative programs. As a solution to this problem, a parsing technique is introduced which is able to cope with such input if certain reasonable conditions are satisfied.
Categories and Subject Descriptors: D.3.4 [Programming Languages]: Processors
Additional Key Words and Phrases: source-to-source translation, language conversion, conditional compilation, parsing
Selected references
- Kristy Andrews, Paul Del Vigna, and Mark Molloy. Macro and file structure preservation in source-to-source translation. Software -- Practice and Experience, 26(3):281-292, March 1996.
- R. A. Freak. A Fortran to Pascal translator. Software -- Practice and Experience, 11(7):717-716, July 1981.
- Vincent D. Moynihan and Peter J. L. Wallis. The design and implementation of a high-level language converter. Software -- Practice and Experience, 21(4):391-400, April 1991.