template meta-programming
I love to use template as compile time maps. It work I created a library that allows for something similar to C# attributes except they can be read at compile time. I also created a companion library that allows me to walk each member of a structure, and thus automate many repetitive and error prone tasks with highly optimized code. The only cost is that the data members of structure effectively need to be defined twice. Using the two together, I can create a generic operation to apply to all the members of a structure, then mark certain members with meta-data that can alter the behavior of a specific member.
conditionally compiled C++11 features
Move semantics for key data-structures can, and does in one of my branches, significantly reduce cost of operations in a nearly transparent way.
source code generation
I have written a tool over the last several years that provides an agile work flow for source to source translators.
Code: Select all
(grammar) (script)
\/ \/
(input) -> [parse] -> {AST} -> [execute] -> (output)
The abstract syntax tree can store arbitrary .NET objects as values and can be saved and loaded (like an intermediate file). While the parser will only ever produce text, scripts can manipulate the tree to simplify other scripts.
The scripting language is C-ish with curly braces and semicolons. It has a syntax that allows you to search the AST using an XPath like query language. It allows you to define functions using a text template syntax so that when you call the function, the template will be expanded into the output. Within the template syntax, their are numerous shortcuts for easily producing output. Script code can create and access .NET objects if needed.
I could see creating a concise description of the NIF format, then using the tool to produce code to read/write/translate the files.
I have not publicly released the tool yet, but I plan to under a GPL license (only the tool, not the code it generates, if that is possible or a concern)