D, Rust, Nim(rod), Template Haskell, OCaml, C++...
An identical technique could be used for yacc or protobufs.
I bet C++ can do it with some clear use of template metatprogramming, compile time evaluation and processor macros.
Nim has meta-programming capabilities, including reading files.
Not sure about Template Haskell, though.