Translation of conditional compilation

  • Authors:
  • Maarit Harsu

  • Affiliations:
  • Department of Computer Science, University of Tampere, P.O. Box 607, FIN-33101 Tampere, Finland

  • Venue:
  • Nordic Journal of Computing
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

This 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.