Creating a domain specific framework

Tools such as MetaTool, CENTAUR, etc, have simplified parsing, semantic analysis and even code generation. However, one element of the application generator, the domain specific framework, must still be built the old fashioned way. This framework must capture all the most general aspects of the domain in a library and/or architecture.

This framework must contain much of the domain software functionality required by the applications that the AG produces. For example, in a process control domain the domain specific framework must contain all the necessary drivers for the various sensors, actuators, etc; also, the scientific subroutine libraries for the necessary physical/chemical computations. GENOA [#!genoa!#] is an application generator that produces source code analyzers. Source code analyzers created by GENOA can extract useful information from source code. For this system, we needed a framework that lexes, parsed, and semantically analyzed source program code and builds an annotated parse tree, which can be traversed and analyzed.

Generally speaking, a framework for an application generator would have to be implemented from scratch. However, an existing application may contain within it the seeds of a domain specific framework. For example, an existing control system for a thermostat may contain driver software for various types of sensors and actuators, day/night timing event generators etc. Likewise, in the language tool domain (relevant to GENOA) an existing compiler may contain a lexer, parser, semantic analyzer etc. In such cases, it may be possible to scavenge the domain specific framework out of the existing system for more general use.

We have used this approach successfully in the GENOA system. GENOA is a portable analyzer generator, that can be attached to any existing lexer/parser/analyzer for a given programming language; this attachment is performed by writing a formal specification in a companion system, called GENII. A GENII specification describes the linguistic elements of the language to be analyzed (Expressions, Declarations, Statements etc) and their implementation in the specific front end (data structures, operations, etc). Using this specification, GENII basically places a standard ``wrapper'' around the existing implementation. This ``wrapped'' implementation, and associated (generated) tables are used by GENOA as the domain specific framework for generated application. In this way, we have created an analyzer generator for C++, called GEN++, based on the Cfront compiler. Thus in the case of GENOA, the ``framework scavenging'' process has been formalized and automated to some extent. Because of the complexity of the C++ language, and the attendent difficulty of parsing it, this approach is particularly advantageous. In fact, we believe that GEN++ is the first and only available1 tool of this kind for C++.

We believe that this approach to extracting a domain specific framework out of an existing application could be viable if the existing application is implemented in a modular fashion, and the ``generic elements'' within it are of high quality, and if the cost of implementing a DSF from scratch are quite high. If a well understood, formal (algebraic) model of the domain specific framework is available, this can be used to automate the frame work scavenging process, as in the case of GENOA/GENII.