FOG: A Meta-compiler for C++ Patterns

Edward D. Willink and Vyacheslav B. Muchnick.

Modern assemblers provide powerful macro facilities to enable programmers to create their own high level constructs. In contrast, many high level languages have at best very limited macro capabilities. The macro facility provided by the C preprocessor has been almost universally derided. We examine the limitations imposed by the lack of macro facilities for pattern programming, object persistence and object communication.

We propose a meta-compiler (a translator from a superset C++ language) that provides macros integrated into the language as meta-functions and meta-variables of meta-classes. We show how a variety of simple facilities provided at the meta-level can allow patterns to be expressed directly, substantially reduce the lexical size of C++ programs and their consequent maintenance cost, offer a more versatile programming environment, and provide facilities needed to support persistence and communication of objects.

PDF of full paper. 77kB.

FOG home page.

Ed Willink's home page.

Edward D. Willink
6 April 2006