Skip to main content

Crate blue_lang_runtime

Crate blue_lang_runtime 

Source
Expand description

The blue runtime — one definition of what a blue program runs against.

Before this crate existed, every consumer hand-rolled its own Interpreter::new() + install_primitives(...) pair — three of them, in three crates — and they had silently drifted: none of them loaded the Lisp stdlib. So 6 % 3 lowered correctly to (mod 6 3), mod was genuinely defined, and the program still died with unbound symbol: mod, because the definition lived in a stdlib nobody loaded.

That is the duplication tax in its usual shape: the bug is not in any one copy, it is in there being copies. One function now owns the answer.

§Layers

A blue interpreter is built in two layers, and both are required:

  1. Rust primitives — arithmetic, comparison, list ops, I/O.
  2. The full tatara stdlib — primitives, higher-order functions (map/filter/fold), maps, channels, fibers, type-check, and everything tatara defines in tatara-lisp itself (mod, rem, first, inc, even?, the actor and transducer helpers, …). Loading it is not optional garnish: blue’s own operator lowering depends on it.
  3. blue’s own core (stdlib) — strings and number conversion, which tatara-lisp does not have in any form. A Ruby-surface language without length or upcase is not usable, and the semantics are Ruby’s (characters, not bytes), which is why they are blue’s and not the substrate’s.
  4. JSON (json) and cryptography (crypto) — pure computation, installed unconditionally, so the wasm consumer keeps them.
  5. The host layer (sys, behind the sys feature) — every name in it is a host import.

Re-exports§

pub use erase::erase_types;
pub use erase::to_sexps;
pub use inputs::declarations;
pub use inputs::install_input_primitives;
pub use inputs::Declaration;
pub use inputs::InputError;
pub use inputs::Inputs;
pub use pipeline::parse;
pub use pipeline::parse_tree_with_depth;
pub use pipeline::parse_with_depth;
pub use pipeline::run;
pub use pipeline::run_with_inputs;
pub use pipeline::Run;
pub use pipeline::RunError;
pub use stdlib::install_blue_stdlib;

Modules§

crypto
Real cryptography — BLAKE3 hashing and Ed25519 signatures — as blue’s own surface.
docs
One line for every name a blue program can call without a use.
domain
Blue as the authoring surface for Rust types: a blue value becomes a #[derive(TataraDomain)] struct.
erase
Type erasure — the step that makes the sliding scale actually slide.
hosted
Embedding blue in a Rust host: load a program into an interpreter the host built, then call its definitions by name.
inputs
Build inputs — the macro phase’s only channel to the outside world.
json
JSON — parse, stringify, and read back — as blue’s own surface.
messages
Runtime errors in blue’s words.
pipeline
The blue pipeline: parse → check → erase → run, in that order, once.
stdlib
blue’s string and number core.
uses
use("name") — how a blue program consumes a bidama.

Functions§

interpreter
Build an interpreter with the complete blue runtime installed.
interpreter_hostless
The common host-free case.
lower_to_spanned
Lift spanless forms into what the evaluator eats.