At the meta level, the (base-level) programs are represented by objects of a few predefined classes (and their subclasses that programmers define). These objects are called metaobjects because they are meta representation of the programs. Source-to-source translation from OpenC++ to C++ is implemented by manipulating those metaobjects.
The following several sections show details of such metaobjects. They reflect various aspects of programs that are not accessible in C++. Although most of metaobjects provide means of introspection, some metaobjects represent a behavioral aspect of the program and enables to control source-to-source translation of the program. Here is the list of metaobjects:
Ptree
metaobjects:
They represent a parse tree of the program. The parse tree is implemented as a nested-linked list.
Environment
metaobjects:
They represent bindings between names and types. Since this MOP is a compile-time MOP, the runtime values bound to names are not available at the meta level.
TypeInfo
metaobjects:
They represent types that appear in the program. The types include derived types such as pointer types and reference types as well as built-in types and class types.
Class
metaobjects:
As well as they represent class definitions,
they control source-to-source translation of the program.
Programmers may define subclasses of Class
in order to tailor the translation.
Member
metaobjects:
They represent class members. They inform whether the member is a constructor, an inline function, a data member, a public member, or so forth.
Distinguishing TypeInfo
metaobjects and Class
metaobjects
might look like wrong design. But this distinction is needed to handle
derived types. TypeInfo
metaobjects were introduced to deal with
derived types and fundamental types by using the same kind of metaobjects.