The Compilation Pipeline
Description
dql compiles queries through a series of stages. The --to flag stops the pipeline at any stage and prints the intermediate value.
Stages
Text --> CST --> AST(Unresolved) --> AST(Resolved)
|
v
SQL <-- AST(Refined) <-- AST(Refined)
-
Parsing – Tree-sitter produces a CST from input text.
--to cst -
Building – CST is transformed into an unresolved AST.
--to ast-unresolved -
Resolution – Table and column names are bound against the database catalog.
--to ast-resolved -
Refinement – The resolved AST is simplified and normalized.
--to ast-refined -
Transformation – The refined AST is lowered into a SQL AST.
--to ast-sql -
Generation – The SQL AST is serialized to SQL text.
--to sql -
Execution – SQL is executed against the database.
--to results(default)
Each stage is a pure function of its input.
See Also
dql-query(1)