Expand description
First-party lexer, parser, AST, binder, semantic rewrites, and logical and physical plans.
Invariant: the SQL front end is pure. It parses, binds, plans and compiles;
it opens no file, reads no page, and holds no connection. Everything it
needs to know about a schema arrives through catalog_view::CatalogView,
which is a read-only view someone else has already built.
That interface is why this crate sits below inillucent-catalog rather than
above it. The catalog has to parse the CREATE text stored in
sqlite_schema with this parser, and a crate cannot be both above and below
another; the parser is the more fundamental half, so it goes underneath and
the catalog implements the view.
Module map, in the order SQL moves through them:
keyword- the pinned release’s keyword table and its fallback rule;lexer- bytes to tokens, zero copy, with spans;precedence- the operator table, as data;ast- the arena and every node kind;diagnostic- syntax failures, with offsets;parser- recursive descent for statements, Pratt for expressions;catalog_view- what the binder is allowed to know about a schema;bind- names to columns, and the bound relational tree;plan- the logical and physical plans the compiler walks.
Re-exports§
pub use ast::Ast;pub use ast::Statement;pub use diagnostic::ParseError;pub use diagnostic::ParseErrorKind;pub use lexer::Lexer;pub use lexer::Span;pub use lexer::Token;pub use lexer::TokenKind;pub use parser::classify_statement;pub use parser::parse_expression;pub use parser::parse_next_statement;pub use parser::ParameterMap;pub use parser::ParsedStatement;pub use parser::StatementClass;
Modules§
- ast
- The arena-backed abstract syntax tree.
- bind
- The binder: names to columns, and the bound relational tree.
- catalog_
view - What the binder is allowed to know about a schema.
- correlated_
in - Lowering a correlated
INsubquery toEXISTS. - cost
- What a plan costs, and which order to visit the FROM terms in.
- declare
- Reading a virtual table’s declaration and a pragma’s argument.
- diagnostic
- Syntax diagnostics: what was wrong, and exactly where.
- directive
- Statements the session carries out itself rather than compiling.
- dml
- Binding INSERT, UPDATE and DELETE.
- foreign_
key - Foreign keys, as the triggers they are.
- function
- The built-in function registry: names, arities, and identities.
- keyword
- The keyword table of the pinned SQLite release, and the fallback rule.
- lexer
- The zero-copy lexer: SQL bytes in, tokens with spans out.
- parser
- The recursive-descent statement parser.
- plan
- The logical and physical plans.
- pragma_
register PRAGMA: the register of names, the columns each answers, and whether it takes an argument.- precedence
- The operator precedence table, as data.
- rewrite
- Rewriting a bound tree in place, exhaustively.
- vtab
- What the front end has to know about a virtual table.
Constants§
- IMPLEMENTATION_
PHASE - The implementation phase that filled this crate in, as named by the TDD.