The Construction of Compiler Back-Ends by Stepwise Transformation of Virtual Machines

Miguel Sutil-Martín, Campus de Montegancedo · 2002

A standard technique in compiler construction 2 consists in structuring the compilation of source languages to target code by intermediate levels[21][22][23]. Such an approach is practicable because compilation phases between intermediate levels become simpler and increase the flexibility regarding different source and target codes. Furthermore, recently rediscovered virtual machine technology can be effectively used as an intermediate low-level architecture suitable for supporting serious implementations of a wide variety of programming languages. Additionally, the virtual machines provide several desirable features such as portability, code optimizations, and native machine code generation. Now, we consider this task of constructing intermediatelevel machine architectures and compilers generating code for these architectures in the context of design patterns. This paper presents the EXTREM-COMPILING pattern language, a pattern-based approach to construct compiler back-ends by staging transformation of virtual machines. There are six patterns in this EXTREM-COMPILING pattern language. The patterns and their combination supply compiler designers with a highly customizable three-fold architecture: Firstly, with a architectural skeleton of patterns that captures the essential features underlying virtual machines. In this architecture constant and varying parts are clearly identified and de-coupled. Secondly, with a product-line architecture for code generation. The translation rules defining a compilation phase are the rules driving code generation at that level. The translation-rule construction and management are provided by a translation architecture. Finally, EXTREM-COMPILING provides designers with a generic infrastructure to test the validity and consistency of decisions taken during compiler construction. The results reveal the suitability of design patterns to tackle compiler construction. Firstly, the number of variation elements and customization points found in the patterns of the language are significantly large. This result suggests that our proposal provides a significant higher-degree of flexibility and reuse than traditional approaches. Moreove, the use of EXTREM-COMPILING in the redefinition of a previous work [2][3][16] has shown conclusive proofs of the benefits provided by this pattern-based solution in even the ‘roughish’context of formal specifications [16]. Remarkably, the ability of EXTREM-COMPILING to be highly adaptable and pluggable advocates its use, as well, beyond the context of compilation techniques. In this sense, some links with other models on software design are commented. The EXTREM-COMPILING pattern language is not only a contribution for a more abstract and systematic way of constructing compiler backends, but also an attermpt for improving the understanding of compilation processes. Therefore, a methodology for compiler construction based on EXTREM-COMPILING must be an objective in further research. Other future work related to this proposal is outlined in the paper too.

Read the paper · More papers on PaperTik