Dear all,
I used to use OpenC++ (http://opencxx.sourceforge.net/opencxx/html/overview.html) to perform code generation like:
Source:
class MyKeyword A {
public:
void myMethod(inarg double x, inarg const std::vector<int>& y, outarg double& z);
};
Generated:
class A {
public:
void myMethod(const string& x, double& y);
// generated method below:
void _myMehtod(const string& serializedInput, string& serializedOutput) {
double x;
std::vector<int> y;
// deserialized x and y from serializedInput
double z;
myMethod(x, y, z);
}
};
This kind of code generation directly matches the use case in the tutorial of OpenC++ (http://www.csg.is.titech.ac.jp/~chiba/opencxx/tutorial.pdf) by writing a meta-level program for handling "MyKeyword", "inarg" and "outarg" and performing the code generation. However, OpenC++ is sort of out-of-date and inactive now, and my code generator can only work on g++ 3.2 and it triggers error on parsing header files of g++ of higher version.
I have looked at VivaCore, but it does not provide the infra-structure for compiling meta-level program. I'm also looking at LLVM, but I cannot find documentation that tutor me on working out my source-to-source compilation usage. I'm also aware of the ROSE compiler framework, but I'm not sure whether it suits my usage, and whether its proprietary C++ front-end binary can be used in a commercial product, and whether a Windows version is available.
Any comments and pointers to specific tutorial/paper/documentation are much appreciated.