The Compiler is your Friend: ASTs and Code Generation with Quill
summary
Quill compiles regular Scala code into SQL at compile time by turning quoted code into a Quill AST and normalizing it into tokens, then emitting dialect-specific SQL via an interpreter like SQL Mirror. The system implements quotation → AST extraction, a flattenSqlQuery tokenization phase, and AST trivial-checkable reduction that removes unreachable branches (an experimental flag enables constant-folding of ifs). A tiny proof-of-concept uses a custom AST and Scala 3 derivation to emit Java Maps (and JSON) successfully.
AI-written summary · about
