What are some techniques for code generation?

前端 未结 8 1113
抹茶落季
抹茶落季 2021-01-06 13:05

I\'m generating C++ code, and it seems like it\'s going to get very messy, even my simple generating classes already have tons of special cases. Here is the code as it stan

相关标签:
8条回答
  • 2021-01-06 13:36

    I have a code generation system and one of the best choices I have taken with it is to put much of the resultant program in non generated code, e.g. a library/runtime. Using templates works well also. Complex template systems may be hard to work with by hand, but your not working with them by hand so leverage that.

    0 讨论(0)
  • 2021-01-06 13:38

    It would actually be just recursing straight down, except I need to pull all function declarations out and put them elsewhere, and the fact that for all function calls I need to build a vector of all of the arguments, and then pass that to the function, since C++ doesn't have a syntax for vectors.

    0 讨论(0)
提交回复
热议问题