The
KoalaCompiler is developed as a component-based system using
StrategoXT:
- The system is implemented as a set of program transformation tools.
- Different pieces are implemented as separate tool components (executable programs).
- Each tool component is implemented in the Stratego programming language.
- Tool components are connected through the ATerm exchange format.
- All tool components are syntax-driven:
- Syntax definitions are defined in SDF.
- From a syntax definition a pretty-printer, abstract syntax definition, and libraries are generated.
- All transformations operate on abstract syntax trees .
- Compositions of tool components are created with the Transformation Tool Composition framework XTC.
The Koala compilation process consists of three phases:
- Parsing. During this phase a top-level Koala component definition is located and parsed. Subseuently, all contained elements are recursively located parsed. The result of parsing is a single abstract syntax tree (AST) that contains exactly all elements of the Koala composition.
- Normalization. In this phase the AST from phase 1 is reduced to normal form. This involves several simplification steps, constant propagation, function inlining, reachability analysis, switch reduction, transitive wiring, and component pruning. The result is again an AST, that may serve for analysis or realization.
- Realization. In this phase the normalized Koala composition is realized for some target. Traditionally, realization is only performed for the C programming language (which we support through KoalaC). Other realizations are: pretty-printing (see KoalaText) or vizualization (see KoalaDot). Additional realization components can simply be connected to the compiler framework (e.g., see KoalaSTC).
--
MerijnDeJonge - 22 Dec 2004