There are some projects in GitHub which are barely useful in themselves, but the ideas which they incorporate are pretty neat and deserve attention.
|Repo||PPRB zah/pprb: A code preprocessor and text templating engine with minimalistic syntax and strong emphasis on eliminating any code duplication in template files|
|Status||Abandoned. No commits since 2012.|
There are many text templating engines out there and many of them are written in Ruby (I’m using Liquid in Jekyll for this very website, for example), and they are a popular way of generating HTML.
What if you use one for your code?
PPRB is one answer to that. There are many others these days. Of course C and C++ have macros, but such an approach can be much more powerful. There exist many alternative preprocessors for C and C++. Many programming languages don’t have anything resembling macros and there exist preprocessors for them, too.
So PPRB is a templating engine and an alternative preprocessor based on Ruby for C-like languages. It’s not complete and it’s barely usable (even though I have used it on a couple of occasions), but I’m not writing this to encourage the readers to use it. The point of my post is to introduce the concept to those who are not familiar with it and hopefully make them consider something like this if the need arises.
Templating engines as preprocessors can be a powerful way of generating code..