next up previous contents index
Next: 2.5 Second-Order Abstract Syntax Up: 2 Rational Previous: 2.3 Isolating Abstract Syntax

2.4 Modularity

external

Modularity  in computer languages exists more often that one may imagine. It is the case for example in Lex or Yacc in which part of the rules may be C code. In the trilogy Metal/PPML/Typol, all the three formalisms contains a subpart for expressing schemes. This subpart should be isolated and shared between the three formalisms (not only the syntax, but also the type-checker for example).

In  these cases, the domain of the constructor of one language may contain a phylum belonging to another language. The type system of the imported formalism is simply reused (or imported), and not modified. This sort of modularity, very closed to type inclusion, may be called formalism inclusion.

external Formalism Inclusion

An other kind of modularity is related to dialects of a computer language. Each Pascal or Fortran compiler accepts its own special features. Thus some programs are portable because they use features implemented in all the available compilers (we may say that these programs belong to the standard of the language). Some other programs can be compiled only using some compilers because they use some extensions of the standard.

It  should be possible to define the common part (the standard part) of different dialects, then to define each dialect as an extension of the standard. In this case, the types (phyla) from the standard are modified by adding some new constructors (the extensions), and there is an injection sending standard programs into non-standard ones. Again, the semantics of a dialect should reuse the semantics of the standard. This sort of modularity may be called formalism extension.

external Formalism Extension

One may also think of combining these two principles of abstract syntax modularity.

external


next up previous contents index
Next: 2.5 Second-Order Abstract Syntax Up: 2 Rational Previous: 2.3 Isolating Abstract Syntax

Thierry Despeyroux
Fri May 16 15:24:06 MET DST 1997