Skip to main content

vla_lang/
lib.rs

1//! vla-lang: the VLA language with nothing around it (PORT.12, 2026-10-08).
2//!
3//! The language cut out of `frazaro-core` so that an engine can stand on it
4//! without the bridges: the reader (`reader`), the forms (`form`) and their
5//! printing (`printer`), macro expansion (`expand`), the head table
6//! (`headtable`), the six intrinsics (`intrinsics`), the message catalogue's
7//! mechanism with the language's own refusals (`messages`), the version
8//! predicates (`version`), the grid (`sheet`: sheets of cells with A1
9//! coordinates and a style table), the references read out of a formula's
10//! text (`refers`), the relation rows and their spelling (`rows`), the
11//! projections seam (`projection`) and its first implementation, the view
12//! record of one window (`view`); since KERNEL.7 (2026-10-08),
13//! recalculation's mechanism (`calc`): the formula parser over the
14//! reference scanner, the dependency graph, evaluation in order with a
15//! budget, a cycle refused by name, the error values, and the registry seam
16//! for functions with the language's own day-one functions registered; and
17//! since KERNEL.22 (2026-10-09), the machine (`machine`): a grid kept under
18//! a handle and stepped, the four calls an engine makes of it (load, write,
19//! step, view), the previous frame's twin sheets, the plane, with a C
20//! surface over them (`abi`) exported only under the `c-abi` feature;
21//! since KERNEL.25 (2026-10-09), the hash the machine's maps use (`fx`, the
22//! crate's own); and since KERNEL.47 (2026-10-17), a number format's code
23//! and the text a number draws as under it (`numfmt`).
24//!
25//! Since VLA.4 (2026-10-17) the language holds the formula syntax
26//! (`formula_syntax`): a VLA expression written as a formula's text in
27//! Excel's invariant spelling, and that text read back as an expression,
28//! canonical both ways; the expander's `formula-expand` is its writer at
29//! expand time, so that a cartridge composes a formula from expressions.
30//!
31//! The contract (docs/HORIZON.md section 12; Alonzo/CHARTER.md section 4,
32//! rule 1): bytes in, bytes out, nothing else. No English, no file format,
33//! no clock, no randomness, no threads, no file system, no socket, and no
34//! dependency. Built for wasm32 the module's import section is empty, which
35//! tools/check_core_imports.ps1 reads off the artifact. Everything that
36//! consumes this crate is a bridge: `frazaro-core` adds the English engine,
37//! the emitters and the workbook formats; an engine adds its devices and
38//! its clock, and never `frazaro-core`.
39//!
40//! SD-18 governs what this crate may claim: the VBA in src/ is the reference
41//! implementation, and this crate follows the goldens in scripts/ and never
42//! leads them; its tests read them from their test modules.
43
44pub mod abi;
45pub mod calc;
46pub mod expand;
47pub mod form;
48pub mod formula_syntax;
49mod fx;
50pub mod headtable;
51pub mod intrinsics;
52pub mod machine;
53pub mod messages;
54pub mod numfmt;
55pub mod printer;
56pub mod projection;
57pub mod reader;
58pub mod refers;
59pub mod rows;
60pub mod sheet;
61pub mod version;
62pub mod view;
63
64/// The crate's version: the workspace's, which tools/check_version_twin.ps1
65/// holds equal to VLA_RELEASE_VERSION in src/VLA.bas and to the exact pins
66/// the core and the door hold. One corpus, one version.
67pub const VERSION: &str = env!("CARGO_PKG_VERSION");
68
69/// The version as text.
70pub fn version() -> &'static str {
71    VERSION
72}
73
74#[cfg(test)]
75mod tests {
76    use super::*;
77
78    #[test]
79    fn version_is_major_minor_patch() {
80        let parts: Vec<&str> = version().split('.').collect();
81        assert_eq!(parts.len(), 3, "SD-14 numbers releases MAJOR.MINOR.PATCH");
82        for part in parts {
83            assert!(
84                part.parse::<u32>().is_ok(),
85                "non-numeric version part: {part}"
86            );
87        }
88    }
89}