This is a stripped-down version of my "C++ annotator". It takes a C++ parse tree generated by OpenC++, and converts it into a more regular form, for use by a code generator maybe. It does overload resolution, and resolves certain ambiguities and mis-parsed things. It annotates the parse tree with types and mangled names. Some documentation is in "comp/stefans-doku.txt". To build, you need: - a recent GNU Make (3.80 is fine) - g++ 2.95 or higher - OpenC++ 2.6 or higher (although most of it were developed with 2.5.12). Note that you must compile the GC with -DREDIRECT_MALLOC=GC_malloc_uncollectable because we store pointers to GC objects in STL containers. At least for g++ 2.95, overloading operator new seems not to help and adding a custom allocator would be quite a lot of work. Modify the OPENCXXDIR in "Makeconf", and type "make" in the top-level directory. This will build "comp/stefan", which is mainly a driver for the annotator. Maybe you'll have to play with the paths in "comp/Modules", too; this has been pulled out of a much more populated source tree. Example invocation: "stefan - -dictb" means to read stdin, and turn on display of the symbol table (b), with initializers (i) and function bodies (b), in color (c). Type your program, hit Ctrl-D, see the output. Example output: a function "void foo() { int i; ++i; }" yields this output: foo: - function foo?F1F: - function, type is `function without args returning fundamental type v' storage: extern, function specifiers: none, class type: (none) Body: | Opencxx::NonLeaf | [i?Q3foo?1, i] Annotated | null | i | Opencxx::PtreeDeclarator | i?Q3foo?1 | ; | Opencxx::PtreeExprStatement | [no symbol, i] Annotated | ++ | [i?Q3foo?1, i] i?Q3foo?1 | ; Note the mangled names, and how every sub-node of the expression has been annotated with its type, and a symbol name if appropriate. The annotator is incomplete. It currently lacks most template support, and does not support "using" directives and declarations nor Koenig lookup. Plus there are some places which I'm not exactly proud of. For example, the Type thing needs to be re-written. And, please ignore occasional expletives :) The source code is in a "unit-style" format which must be preprocessed to be compilable by a C++ compiler. The makefile automatically does this. See for more details. --Stefan Reuther