next up previous
Next: Transforming COBOL Systems Up: Term Rewriting for Sale Previous: Dealing with IT Industry


The ASF+SDF Approach to Tool Generation

Figure 1: Generating tools from language definitions.
\begin{figure}\centerline{\psfig{figure=toolgen.eps,width=9cm}}\end{figure}

In a first approximation, the ASF+SDF approach is based on the generation of tools as shown in Figure 1. Starting points are a context-free grammar defining the lexical, concrete, abstract and unparsing (prettyprinting) syntax of a language, analysis and transformation rules defining what information is to be extracted from programs and what changes are to be performed on them, and coordination rules defining how the analysis and transformation rules have to be glued together in the tool that is to be generated. These definitions are fed into a tool generator that produces the desired tool.

The generated tool takes source text in the defined language as input, applies the analysis and transformation rules to it as prescribed by the coordination rules and produces analysis results or complete (transformed) programs.

Figure 2: The ASF+SDF Meta-Environment.
\begin{figure}\centerline{\psfig{figure=meta.eps,width=9cm}}\end{figure}

In a second approximation, the structure of the ASF+SDF Meta-Environment is as shown in Figure 2. At the bottom we see, once more, a generated tool but now its internal structure is shown. At the top, we see an interactive development and prototyping environment in which specifications can be edited and executed. In older versions of the ASF+SDF Meta-Environment the development and prototyping environment and the generated tools were closely intertwined. In newer versions, they are completely separated so that stand-alone tools can be generated.

Syntax, unparsing rules, and the specification modules $S_1 ,\ldots, S_n$ are all written in ASF+SDF. For the coordination rules various formalism are in use (SEAL [41], TOOLBUS scripts [7]). The modules $S_i$ are either created manually or they may be the result of a generation process (this is not further detailed in the figure).

The generation process consists of the following steps. The context-free grammar (possibly extended with unparsing rules) is transformed into a parser and unparser by, respectively, a parser generator and an unparser generator. The analysis and transformation rules are captured by specification modules $S_1 ,\ldots, S_n$. They are compiled to executable components (rewriting systems) $C_1 ,\ldots, C_n$ by the ASF+SDF compiler. The coordination rules are compiled to an executable coordinator. The picture is completed by a number of standard components $SC_1 ,\ldots, SC_m$ that provide common services like persistent storage and syntax-directed editing. For instance, for the user-interface of the new ASF+SDF Meta-Environment we use wish (a user-interface builder) in combination with dot (a graph drawing tool) as basic, off-the-shelf, components that can be effortlessly integrated in the open TOOLBUS architecture using the component-based software engineering philosophy described in [39].


next up previous
Next: Transforming COBOL Systems Up: Term Rewriting for Sale Previous: Dealing with IT Industry
Paul Klint 2001-06-12