Skip to content
Unverified: This page has not yet been anchored to automated code tests.

vox-ast API Reference (generated)

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).

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.

  • [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 in expr embed statements.
  • [pattern] — let and match patterns; 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.

ModuleDescription
declTop-level declarations: functions, components, data models, routes, and UI.
exprExpression AST nodes (literals, calls, JSX, control flow).
patternPatterns for let bindings and match arms.
scalar_mappingScalar → Rust / TypeScript / SQLite mapping (codegen SSOT).
spanByte-offset source spans.
stmtStatement AST nodes.
typesSurface type expressions (int, generics, function types).