It seems to me that a combination of sed and simple shell scripts would be much better than this. The syntax is really not friendly.
Quotes can be redefined to an arbitrary string
changequote(`[[[', `]]]')
And some editor give you syntax highlighting.That seems like an odd assertion given the existence of other templating systems which have friendlier syntax while being capable of generating arbitrary output. Is there a reason why you think on the M4 approach is valid?
Something like mustache for example, which has a C implementation that includes support for includes/partials: http://mustache.github.io/mustache.5.html