小编che*_*000的帖子

需要源到源编译器框架

我曾经使用OpenC++(http://opencxx.sourceforge.net/opencxx/html/overview.html)执行代码生成,如:

资源:

class MyKeyword A {
  public:
    void myMethod(inarg double x, inarg const std::vector<int>& y, outarg double& z);
};
Run Code Online (Sandbox Code Playgroud)

产生:

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);
    }
};
Run Code Online (Sandbox Code Playgroud)

这种代码生成通过编写元级别的程序来直接匹配OpenC++教程中的用例(http://www.csg.is.titech.ac.jp/~chiba/opencxx/tutorial.pdf) "MyKeyword","inarg"和"outarg"并执行代码生成.但是,OpenC++现在已经过时并且处于非活动状态,我的代码生成器只能在g ++ 3.2上运行,并且在解析g ++更高版本的头文件时会触发错误.

我查看了VivaCore,但它没有提供编译元级程序的基础结构.我也在看LLVM,但是我找不到能够帮助我完成源到源编译用法的文档.我也知道ROSE编译器框架,但我不确定它是否适合我的用法,以及它的专有C++前端二进制文件是否可用于商业产品,以及Windows版本是否可用.

任何对特定教程/论文/文档的评论和指示都非常感谢.

c++ code-generation code-translation

8
推荐指数
1
解决办法
1613
查看次数

标签 统计

c++ ×1

code-generation ×1

code-translation ×1