FOG - Flexible Object Generator

The Flexible Object Generator is a meta-compiler for a super-set C++ language. FOG offers preprocessing facilities using meta-object concepts that integrate with the C++ language.

FOG renders the C preprocessor obsolete, eliminates substantial lexical redundancy from C++ and generalises C++ so that patterns can be realised by using meta-functions.

Please note that FOG is mature - no further work is planned and no work has been performed since 2001. FOG itself is of largely academic interest. The underlying C++ parsing approach appears to be the only open source yaccable grammar for C++. Google "Willink FOG" or "Willink C++" for endorsements and critiques.


The documents contained in these directories are included by the contributing authors as a means to ensure timely dissemination of scholarly and technical work on a non-commercial basis. Copyright and all rights therein are maintained by the authors or by other copyright holders, notwithstanding that they have offered their works here electronically. It is understood that all persons copying this information will adhere to the terms and constraints invoked by each author's copyright.






FOG uses some novel parsing techniques to successfully parse C++ without type or template information. The complete standard C++ grammar for this is CxxGrammar.y (without action routines) or CxxTester.y (with action routines). The corresponding FOG grammars are FogGrammar.y (without action routines) or FogTester.y (with action routines). The variants with action routines may be built to produce a program that parses preprocessed C++ source with the aid of parser support claesses and makefiles downloadable as CxxSrc.tgz for Unix or CxxNtSrc.tgz for NT.

FOG has been developed using Sun C++ 4.2 under Solaris 2.5. Confirmatory builds are performed under NT4 using Visual C++, however the NT executable has never been used in earnest. A gcc build will only be possible once gcc offers a reasonable level of template support (2.8.0 nearly compiles).

FOG User Guide

This is currently a very thin document describing..


Much more information is available in my thesis. This descibes the superset grammar approach adopted by FOG version 2, which is now available in experimental form and superseded the multi-pass approach which was made available in 1999.

FOG Release Notes and Bug Summary

The release notes may be viewed at


FOG for Solaris 2.5 and Sun C++ 4.2

Porting to other Unix platforms should not provide undue problems, although it should not be attempted by those unfamiliar with the wonders of make.

FogSunSolaris.tgz (0.9MB) contains just

FogGnuSolaris.tgz (0.9MB) contains just

FogSrc.tgz (3.0MB) contains the full sources for UNIX (and NT) with new-line terminations

FOG for NT 4 and Visual C++ 6

Use under Visual C++ 5 should be possible, but expect considerable trivial aggravation.

FogNt.tgz (0.8MB) contains just

FogNtSrc.tgz (3.2MB) contains the full sources for NT (and Unix) with CR LF line terminationst

Please feel free to contact ed[AT] with constructive suggestions or comments.

Edward D. Willink
6 April 2006