Skip to content

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)
  1. Parsing – Tree-sitter produces a CST from input text. --to cst

  2. Building – CST is transformed into an unresolved AST. --to ast-unresolved

  3. Resolution – Table and column names are bound against the database catalog. --to ast-resolved

  4. Refinement – The resolved AST is simplified and normalized. --to ast-refined

  5. Transformation – The refined AST is lowered into a SQL AST. --to ast-sql

  6. Generation – The SQL AST is serialized to SQL text. --to sql

  7. Execution – SQL is executed against the database. --to results (default)

Each stage is a pure function of its input.

See Also

dql-query(1)