Skip to content

vox-grammar-export API Reference (generated)

Crate: vox-grammar-export · Version: 0.6.0 · Target: Library (lib.rs)

Exports the Vox grammar artifact for downstream tooling.

Grammar export schema + manifest types (TextMate, tree-sitter, EBNF targets).

DependencyKind
vox-language-surfaceNormal
ModuleDescription
compact_prompt—
ebnf—
gbnf—
grammar_ir—
json_schema—
lark—
ssot_markdown—
versioning—
x_grammar_2—
StructDescription
GrammarExportConfigConfiguration for a grammar export run.
GrammarExportResultResult of a grammar export operation.
EnumDescription
GrammarFormatSupported grammar export formats.
FunctionDescription
as_strHuman-readable lowercase format name.
exportDispatch grammar export to the appropriate emitter based on config.format.
grammar_version_matches_compilerCheck that the grammar crate version matches the compiler crate version.
Dependency Topology, diagram 18 nodes, 7 edges: vox-grammar-export → vox-language-surface; vox-cli → vox-grammar-export; vox-cli-ci → vox-grammar-export; vox-cli-research → vox-grammar-export; vox-compiler → vox-grammar-export; vox-constrained-gen → vox-grammar-export; vox-orchestrator-mcp → vox-grammar-exportvox-grammar-exportvox-language-surfacevox-clivox-cli-civox-cli-researchvox-compilervox-constrained-genvox-orchestrator-mcp
Diagram source
graph {
direction: right
node vox_grammar_export: "vox-grammar-export"
node vox_language_surface: "vox-language-surface"
vox_grammar_export -> vox_language_surface
node vox_cli: "vox-cli"
vox_cli -> vox_grammar_export
node vox_cli_ci: "vox-cli-ci"
vox_cli_ci -> vox_grammar_export
node vox_cli_research: "vox-cli-research"
vox_cli_research -> vox_grammar_export
node vox_compiler: "vox-compiler"
vox_compiler -> vox_grammar_export
node vox_constrained_gen: "vox-constrained-gen"
vox_constrained_gen -> vox_grammar_export
node vox_orchestrator_mcp: "vox-orchestrator-mcp"
vox_orchestrator_mcp -> vox_grammar_export
}
Consumer CrateRole
vox-cliDirect workspace dependent
vox-cli-ciDirect workspace dependent
vox-cli-researchDirect workspace dependent
vox-compilerDirect workspace dependent
vox-constrained-genDirect workspace dependent
vox-orchestrator-mcpDirect workspace dependent
KindSymbolSignatureSourceDescription
enumGrammarFormatpub enum GrammarFormatcrates/vox-grammar-export/src/lib.rs#L9-L24Supported grammar export formats.
fnas_strpub fn as_str(&self) -> &'static strcrates/vox-grammar-export/src/lib.rs#L28-L38Human-readable lowercase format name.
structGrammarExportConfigpub struct GrammarExportConfigcrates/vox-grammar-export/src/lib.rs#L43-L52Configuration for a grammar export run.
structGrammarExportResultpub struct GrammarExportResultcrates/vox-grammar-export/src/lib.rs#L67-L78Result of a grammar export operation.
fnexportpub fn export(config: &GrammarExportConfig) -> anyhow::Result<GrammarExportResult>crates/vox-grammar-export/src/lib.rs#L91-L121Dispatch grammar export to the appropriate emitter based on config.format.
fngrammar_version_matches_compilerpub fn grammar_version_matches_compiler(version: &Version) -> boolcrates/vox-grammar-export/src/lib.rs#L124-L130Check that the grammar crate version matches the compiler crate version.
fncompact_prompt::emit_compact_llm_promptpub fn emit_compact_llm_prompt() -> Stringcrates/vox-grammar-export/src/compact_prompt.rs#L19Emit a compact, LLM-optimised Vox 0.4 grammar cheatsheet. The output covers all 57 production rules from the authoritative EBNF (ebnf::emit_ebnf) but uses readable pseudo-syntax instead of raw EBNF notation. Categories mirror the EBNF groupings.
fnebnf::emit_ebnfpub fn emit_ebnf() -> Stringcrates/vox-grammar-export/src/ebnf.rs#L13Emit the complete EBNF grammar for the current Vox version. Rules are grouped by category and annotated with the parser function they derive from. The grammar covers all 57 production rules extracted from parser/descent/.
fngbnf::emit_gbnfpub fn emit_gbnf() -> Stringcrates/vox-grammar-export/src/gbnf.rs#L1-L33—
structgrammar_ir::Productionpub struct Productioncrates/vox-grammar-export/src/grammar_ir.rs#L11-L14A single production rule: name = symbols ;
enumgrammar_ir::Symbolpub enum Symbolcrates/vox-grammar-export/src/grammar_ir.rs#L18-L27A symbol in a production RHS.
structgrammar_ir::Grammarpub struct Grammarcrates/vox-grammar-export/src/grammar_ir.rs#L31-L37Parsed grammar ready for Earley/PDA recognition.
fngrammar_ir::from_ebnfpub fn from_ebnf(ebnf: &str) -> Result<Self, String>crates/vox-grammar-export/src/grammar_ir.rs#L45-L92Build a [Grammar] from the Vox EBNF string. This is a lightweight parser for the EBNF subset used by emit_ebnf(). It extracts production names and their RHS symbols, converting EBNF notation into flat production lists.
fnjson_schema::emit_json_schemapub fn emit_json_schema() -> Stringcrates/vox-grammar-export/src/json_schema.rs#L12-L15Emit the Vox AST as a JSON Schema (draft-2020-12) document. Returns a fully self-contained schema string. All $defs are in-lined under "$defs" so callers can reference them via "$ref": "#/$defs/<NodeName>".
fnlark::emit_larkpub fn emit_lark() -> Stringcrates/vox-grammar-export/src/lark.rs#L10Emit a Lark grammar definition for the Vox language surface. Lark uses ?rule: alt for inline rules, terminals in uppercase, and allows full Python regex in terminal definitions.
fnssot_markdown::emit_ssot_markdownpub fn emit_ssot_markdown() -> Stringcrates/vox-grammar-export/src/ssot_markdown.rs#L11-L46—
fnversioning::get_versionpub fn get_version() -> semver::Versioncrates/vox-grammar-export/src/versioning.rs#L1-L4—
fnversioning::get_compiler_versionpub fn get_compiler_version() -> semver::Versioncrates/vox-grammar-export/src/versioning.rs#L6-L11—
fnversioning::compute_ebnf_hashpub fn compute_ebnf_hash() -> Stringcrates/vox-grammar-export/src/versioning.rs#L14-L19Compute a SHA256 hex hash for the grammar based on EBNF production rules.
fnversioning::verify_grammar_alignmentpub fn verify_grammar_alignment() -> Result<(), String>crates/vox-grammar-export/src/versioning.rs#L26-L38—
fnx_grammar_2::emit_x_grammar_2pub fn emit_x_grammar_2() -> Stringcrates/vox-grammar-export/src/x_grammar_2.rs#L9-L20Emit an XGrammar-2 compatible JSON specification of the Vox grammar.