LIP6 UPMC CNRS Move-team
LIP6 > Software > MoVe Sofware > MetaScribe > About

What is MetaScribe

MetaScribe is a generator of transformation engine designed to help the implementation of program generators or transformation from a specification to another one. MetaScribe defines a meta-data description scheme suitable for the internal representation of various graphical and hierarchical description

MetaScribe separates two discrete aspects of a transformation: semantics and syntactic. The corresponding transformation rules are separated and allow the reuse of various elements when building or maintaining a transformation engine.

MetaScribe solves problems similar to the ones identified in hardware/software codesing of embedded systems where specific processors are built in very limited series. There is a need for designing specific compilers at low-cost. Retargetable compilers are designed for this task and can be classified as follow:

  • Automatically retargetable compilers: they contain a set of switches that need to be set to specify the target architecture. Essentially, all possible target architectures that the compiler is intended to be used for are already built in;
  • User retargetable compilers: the user specifies the target architecture to the compiler-compiler in some form. Typically, this is a representation of the instructions in terms of some primitive operations. The compiler-compiler takes this as input and generates a compiler for the specified architecture;
  • Developer retargetable compilers that is a way to handle machine specific optimizations that go beyond instruction selection is to permit the developer to modify the compiler to target the given architecture. The difference between retargeting and writing a new compiler for any architecture is rather low. For a compiler to be considered retargetable in this scenario, no new processor dependent optimization capabilities are added to the compiler during retargeting.

MetaScribe fits the needs outlined by the two last points. Like a parser generator such as flex/bison, it enables the use of rules applied on input specifications according to a customized scheme. However, because it focuses on the management of hierarchical and graphical like specifications, its philosophy is quite different from the one of a parser generator and the transformation scheme is made of rules contained in a semantic pattern. Like a retargetable compiler, it enables the application of a customized output according to a given syntax format. It is then possible to associate discrete syntactic patterns to a given semantic pattern (e.g. apply Ada or Java code on an object program description). Its parameterization procedure is then similar to the concept of hypergenericity

Fig. 1 Structure and components of a transformation engine generated with MetaScribe.

In order to increase reusability of transformation engine's elements, input description, as well as semantical and syntactical aspects of a transformation are separately defined. To be operated, MetaScribe requires three elements to be described (Fig. 1):

  • Formalism definition: it is expressed using the MSF meta-description language. Users have to declare any entity that can be found in the formalism;
  • Semantic pattern: it is expressed using the MSSM language. Users define the transformation rules to be applied on the associated formalism;
  • Syntactic rules: it is expressed using the MSST language. Users define the syntactic representation associated to constructors declared in the corresponding semantic pattern.

The semantic pattern is composed of rules that produce a polymorphic semantic representation similar to the one of ASIS called semantic expression-trees. Semantic expression-trees are expression trees expressing the semantic of a description without syntactic information (like a parsed program in a compiler).

Semantic patterns are not dedicated to a given programming language and can be customized. They declare a list constructors that make the connection with a syntactic pattern describing how these constructors will be represented.

Input specifications must be written using the MSM data description language automatically customized according to the entities declared in the MSF description. Checks are enforced at execution time of the transformation engine.

MetaScribe generates a transformation engine from a triplet <input formalism, semantic pattern, syntactic pattern>. Such a mechanism enables the reuse of components in any of the involved elements. Thus, MSF, MSSM and MSST languages allow separate definition of pattern components.

MetaScribe and the XML Environment

MetaScribe has many similarities with XML that is now an emerging standard for data interchange. In both cases there is a meta-data description mechanism (Dtd versus MSF), associated with a customizable data description language (XML versus MSM).

To format some output, XSL provides facilities to express style sheets on an XML description. For example, it is possible to specify the representation of a class of XML documents by describing how an instance of the class is transformed into an XML document that uses the formatting vocabulary. This mechanism is similar to the one provided in MetaScribe syntactic patterns. However, The MSST language provides more flexibility.

MetaScribe management of semantic transformation is also more flexible than the one of XML. XSL mainly proposes a one-pass transformation of the input data. The MSSM language allows navigation over the input data, definition and use of variables, and manipulation on the input data such as the definition of temporary flags. Such functions are suitable to do any kind of transformation, even the one including the use of mechanisms similar to cross-reference tables (i.e. a transformation based on several passes).

The very new draft standard XSLT seems to provide more possibilities than XSL. Basically, it allows to group together several XSL descriptions to produce better transformations. However, in current drafts, it appears that some possibilities of MetaScribe (like the management of variables and dynamic flags on the input description) have no equivalent yet.

XML users have to manage themselves reusability at a semantic level. No guidelines are provided. Such guidelines are present in MetaScribe with the separation of semantic and syntactic aspects.

What do we do with MetaScribe

MetaScribe is used internally to build program generators. It was used to experiment program generators from Petri Nets and H-COSTAM (up to 1998). It is now used to generate code from AADL specifications within the context of the PolyORB project.

MetaScribe is also used in courses in the "Systèmes et Applications Répartis" (distributed systems and applications) Master program of UPMC.

MetaScribe have been designed by Fabrice Kordon since 1995.