The MetaC Language
The MetaC language extends C in a 100%
way with reflective features and techniques for
refactoring, reconfiguring and modifying arbitrary
C source code. Therefore,
the extensions provide special metadata types for working with source
code information, syntactical structures for the definiton of code
templates, and metafunctions to gather information about
source code and refactor, modify, delete, or insert code.
Some of the modifications that can be done with MetaC, are also
realizable with the C preprocessor. But the C preprocessor suffers
that can be
overcome using MetaC.
Applications of MetaC
The area of applications for MetaC is not limited to specific domains.
But its concepts and its motivation has been derived from recurring
problems during the development of embedded real-time systems.
- Source code reconfiguration and refactoring in general.
- Abstraction of APIs and hardware-specific or vendor-specific
implementations of well-defined functionallity (ever got locked to a
specfic API by a RTOS vendor?).
- Source code instrumentation for WCET-analysis
- Adaption of source code to multiple embedded targets (especially
differing native platform APIs) based upon an abstract machine model
- Application specific debug support (e.g. control-flow or
- Verification of domain- and application-specific constraints
(e.g. MISRA's rules set for C based programs in automotive
Advantages of the Metaprogramming Approach
Source code modification is done based upon syntax. In consequence invalid
modifications can be detected at the moment they are executed.
- Decision for code modifications can be made upon user parameters and information
derived from the source code, using the reflective mechanisms of MetaC.
- Crosscutting reconfigurations (i.e. reconfigurations concerning multiple functions
or modules) of source code are possible.
If you want to take a look at an example, click here
Currently there exists a MetaC compiler that is in its alpha stage of
development. It produces standard C code as output, which can be
compiled with any standard ISO-C90 conforming compiler to a supported
target architecture. This approach is similar to the way the C++
Compiler of Cameau Computing works. The applicaiton examples given above
have been evaluated with multiple metaprograms, and the infrastructure
for more complex applicaitons is constantly be expanded within the
The language extension is complete, concerning the necessary
infrastructure needed for supporting the given examples. Further
extensions might be possible if needed.
If you questions concerning this methodology, please feel free to send
me an e-mail
Evaluation of the MetaC Compiler
You can download an alpha version of the MetaC compiler for evaluation and research
purposes. This version must not be used for commercial applications. To download