Seems similar in spirit to Lips, a pre-processor which can evaluate Lisp and splice it into the output (Common Lisp https://github.com/zc1036/lips or Scheme https://github.com/rbryan/guile-lips )
I think the closest "standard" tool for this is m4, which doesn't seem powerful enough for most applications.
Lips seems similar, but for Lisp/Scheme (e.g. https://github.com/zc1036/lips https://github.com/rbryan/guile-lips )
Reminds me of lips ( https://github.com/zc1036/lips and https://github.com/rbryan/guile-lips ).
Cog looks a little over-the-top for my purposes, but still looks saner than M4 ;)
Here's the original lips on which this is based: https://github.com/zc1036/lips
Maybe I'll use this to hack generics into Go …
If you'd prefer common lisp you should check out the project that inspired mine: https://github.com/zc1036/lips