Meta-Compilation for C++

Edward D. Willink.

THIS ABSTRACT AND THE HYPERLINKS REFER TO THE OBSOLETE VERSION 1 THESIS.
CLICK HERE FOR THE CURRENT VERSION.

Software Engineering progresses as improvements are made in Languages and Methodologies. Significant advances have been made through the use of Object-Oriented Programming exploiting the effective support available in C++. Further evolution of OOP involving the use of design patterns and aspects requires additional language support. Increased flexibility in the declaration of objects is investigated using the FOG (Flexible Object Generator) language, which is a superset of C++ implemented by a translator to C++. FOG generalises C++ syntax, introduces syntax-based concatenation and substitution and supports compile-time meta-programming and reflection.

The syntax generalisations provide the freedom for programmers to organise code to suit programming concerns and eliminate the need for duplication between interfaces and implementations. Further generalisations define composition policies for repeated declarations so that classes, arrays, enumerations and functions may all be extended. These composition policies support the weaving necessary for re-useable implementation of design patterns and for Aspect Oriented Programming.

An automated form of meta-programming is supplied by derivation rules, which specify how a declaration specified in a base class is to be reinterpreted in derived classes. Automated generation of derived functionality is important for a number of design patterns.

More general purpose meta-programming is provided by elevating most run-time concepts to the meta-level, allowing conditional and iterated manipulation of declarations at compile-time. Compile-time execution enables subsequent run-time code to be optimised to suit application requirements.

The use of meta-variables and meta-functions associated with meta-programming in a well-disciplined lexical fashion, combined with meta-level execution provide a complete replacement for the traditional C preprocessor functionality, satisfying Stroustrup's goal of making Cpp redundant. The new functionality is integrated with the language and fits within an Object-Oriented framework.

PostScript of full V1 thesis. 3.5MB.

PDF of full V1 thesis. 950kB.

FOG home page.

Ed Willink's home page.


Last updated 29 June, 2001.