vox-ast API Reference (generated)
vox-ast
Section titled “vox-ast”Crate: vox-ast · Version: 0.6.0 · Target: Library (lib.rs)
Pure-data Vox AST: declarations, expressions, statements, patterns, type-syntax, scalar mapping, and source spans. serde-only L0 leaf extracted from vox-compiler (re-exported there as vox_compiler::ast).
Crate Overview
Section titled “Crate Overview”Abstract syntax tree (AST) for the Vox language.
This is a standalone L0 leaf (serde-only) re-exported by vox-compiler as
vox_compiler::ast, so downstream crates that only need the declaration AST (e.g. vox-db’s
DDL emitter) can depend on vox-ast without pulling in the whole compiler. The parser builds
these trees from tokens; the HIR phase lowers them; typeck and codegen consume HIR. The AST is
lossy only where the parser
chooses not to model trivia—names are not resolved: Ident and Named types carry
spellings as written, and it is up to later passes to bind them to definitions.
Layout
Section titled “Layout”- [
decl] — one file becomes a [decl::Module] of [decl::Decl] items (functions, tables, routes, …). - [
expr] — expression tree inside bodies; shares [span::Span] with statements and patterns. - [
stmt] —let/return/ expression statements; blocks inexprembed statements. - [
pattern] —letandmatchpatterns; must align with [expr::Expr::Match] arms. - [
types] — type syntax only (generics,fn(…) -> …); not the internal type algebra.
[crate::span] is byte offsets into the original UTF-8 source (start inclusive, end exclusive).
Diagnostics and LSP use these directly; they are not grapheme- or line-aware.
See docs/src/reference/lexicon.md for naming aligned with the grammar.
Public API Surface
Section titled “Public API Surface”Modules
Section titled “Modules”| Module | Description |
|---|---|
decl | Top-level declarations: functions, components, data models, routes, and UI. |
expr | Expression AST nodes (literals, calls, JSX, control flow). |
pattern | Patterns for let bindings and match arms. |
scalar_mapping | Scalar → Rust / TypeScript / SQLite mapping (codegen SSOT). |
span | Byte-offset source spans. |
stmt | Statement AST nodes. |
types | Surface type expressions (int, generics, function types). |