There is a very cool paper about structuring query compilers that I've read a couple years ago, and came back to recently when doing some experimentation.
The paper[0], "How to Architect a Query Compiler, Revisited", presents an approach to structuring compilers based on Futamura Projections. In practice this means that you write most of your high-level code as though it was an interpreter, but then mainly rely on constructors and operator overloading (and occasionally special functions) to emit compiled code for your expressions and nodes under the hood.
The paper should be interesting to anybody who is also interested in the posted link.
"based on Futamura Projections" is kind of cheating: they don't have a `mix` specialization function, which is the entire point of Futamura's paper. They're doing automatic symbolic execution using operator overloading, but I'm looking extremely suspiciously at them referring to that as "the first Futamura Projection without mix".
The paper[0], "How to Architect a Query Compiler, Revisited", presents an approach to structuring compilers based on Futamura Projections. In practice this means that you write most of your high-level code as though it was an interpreter, but then mainly rely on constructors and operator overloading (and occasionally special functions) to emit compiled code for your expressions and nodes under the hood.
The paper should be interesting to anybody who is also interested in the posted link.
[0]: https://www.cs.purdue.edu/homes/rompf/papers/tahboub-sigmod1...