4 ms·
Right. Code generation has typically been associated with DSLs. Here's one way it could be done simply. Let's say you wanted to automate the process of memory
by khitchdee 9y ago
Right. Code generation has typically been associated with DSLs.
Here's one way it could be done simply. Let's say you wanted to automate the process of memory allocation and deallocation. You would need a way to describe to the code generator the mepory requirments of your structure. For that you would need a description outside of C. But that description could be embedded into the comments of your code and your code generator be designed to parse those comments to determine what needed to be done.
Knuth also came up with the idea of Literate Programming in which the description of a program is embedded as Latex in the code. This could work in a similar way. So, while you would use a DSL, the description would be inline with your code so the authoring process would be integrated and not 2-stream.