Curiously enough I did something remarkably similar to this using perl and xml to generate C++ way back in the day when C++ templates were simply not powerful enough to do the job.
Alas, Stepanov cheated. When the C++ compiler wasn’t good enough he walked down the corridor and moaned at Stroustup. So Stepanov and STL is famous and I am not. Sigh. ;-)
Pro’s of this approach:
This to me just reads like someone who figured out all the power of using Lisp for code generation… and then stuck with xml & a weird custom template language. I’m trying to read more of the code/examples to get a feel for what makes it so compelling to it’s authors.
Certainly if you stuck, for whatever reason, using something like C, you can get involved in righting immense amounts of tedious error-prone boiler plate for serialization tasks and the like.
Then doing something like this can seem immensely liberating.
But once you got over the wild feeling of joy for saving yourself maintaining thousands of lines of C… and start looking hard at what you are doing… you start to look at it a little differently.
Yes, the information you are using to drive the generator is data and has a data model and for maintainability needs to be normalised and DRY.
Yes the template language is a programming language. Is it a Good One?
From Pieter Hintjens et al at iMatix developed & deployed since the 90’s. Mainly let you develop apps in high-level way that gets turned to high-performance, C code. Only thing I didn’t like was the XML. Here’s some links about it.
Their philosophy of Model-Oriented Programming:
Servers from state machines:
SMT kernel for high-performance multithreading:
Their web server (original):
Main site with slide show of their work: