Expand description
Pure CQL front end: lexer, parser, schema resolver, type checker and typed IR. No I/O and no database access.
§Stability
The supported API is compile with its Input and Compilation,
and the data it returns: ir, schema, types, diagnostic and
span. Open enums and structs of those modules are #[non_exhaustive],
so adding variants or fields is not a breaking change.
The modules ast, lexer, parser, resolver and checker are the
compiler’s internals. They are public for testing and tooling, hidden from
the documentation and not covered by semver.
use cqlc_core::{compile, Input};
let c = compile(
&[Input::new("schema.cql", "CREATE TABLE t (k uuid PRIMARY KEY, v text);")],
&[Input::new("q.cql", "-- name: Get :one\nSELECT v FROM t WHERE k = ?;")],
);
assert!(c.diagnostics.is_empty());
assert_eq!(c.ir.queries[0].name, "Get");Modules§
- diagnostic
- Compiler diagnostics with stable codes.
- ir
- The typed intermediate representation consumed by code generators.
- schema
- The resolved schema model.
- span
- Source files and byte-offset spans.
- types
- The CQL type model.
Structs§
- Compilation
- Result of a full front-end run.
- Input
- One input file for
compile.
Functions§
- compile
- Runs lexer, parser, resolver and checker over schema and query files. File order determines output order; callers should sort for determinism.