Translating between programming languages
In this chapter we have shown how AG inversion can be used in a source-to-source translation system. By using invertible grammars in this context, one is provided with a framework in which to reason about the complexities of bi-directional translators, as well as a tool to perform much of the work. By phrasing the problem as one of finding a canonical form in which to represent all source language programs and writing invertible AGs to and from this canonical form, many of the real difficulties of the translation problem become immediately apparent.
This chapter has also related our experience in using the inversion approach to source-to-source translation in writing translators between C and Pascal. This experiment demonstrated that invertible AGs are a satisfactory tool for describing much of the translators, although the complete system needs to incorporate other modules as well. In conclusion, AG inversion promises to be a useful tool in facilitating source-to-source translations.
KeywordsProgramming Language Canonical Form Great Common Divisor Source Language Pointer Arithmetic
Unable to display preview. Download preview PDF.