I'm tinkering with a little DSL for declaring embedded in-memory databases, to be emitted as C++ code. I've noticed that I keep creating assemblages of STL containers which feel like tiny databases, optimized for specific queries and constraints: a couple of vectors with structs, some maps or sets, maybe some running totals or min/max references, all wrapped up in an "engine" object governing whatever process it is that uses the data. Wouldn't it be nice if I could declare such a thing, SQL-style, and let the machine work out the details?
There's a little inspiration from the MLIR ecosystem here, which makes heavy use of `.td` files for code generation. I want to write a schema file, defining some tables and indexes along with the queries and procedures which will operate on them, then have this compiled to a C++ header file I can include, where the schema is a class and the queries/procs are methods.
I have no idea how far I'll get with this, but it's always fun messing about with weird little languages, and I'd like to see what programming in this style would feel like.