tabnas-alchemy 0.1.1

The alchemy grammar plugin and language for the tabnas parsing engine: declarative streaming transducers and renderers.
Documentation

tabnas-alchemy (Rust)

The tabnas-alchemy crate, library tabnas_alchemy and binary alchemy: the alchemy language as a tabnas grammar plugin, with its checker, its planner and its interpreter over tabnas-transduce and tabnas-render. The reader (parse, canonical, format, desugar), the resolver, the checker (check, types), the evaluator (interp, value) and its lowering to sinks (lower), the effect summary (effects), the embedded standard library (stdlib), and the API a host embeds (compile, Program). See the repository README, AGENTS.md and docs/language.md.

use tabnas_alchemy::{compile, Output};
use tabnas_transduce::{JsonEvent, Limits, Metrics, Sink};

let program = compile("def export [input] (json input)", "echo.alc")?;
assert_eq!(program.output(), Output::Text);
let mut sink = program.sink(Box::new(Vec::new()), None, &Limits::default(), Metrics::new())?;
sink.event(JsonEvent::ArrayStart)?;
sink.event(JsonEvent::ArrayEnd)?;
sink.event(JsonEvent::End)?;
# Ok::<(), tabnas_transduce::Fail>(())

The host pushes the source's events into the sink and one End; the output is written through a coalescing writer and flushed at End. Program::output says what the program produces (its own text, table rows the host renders as CSV or JSON, or JSON events), row_selector under which selector the source may be read one row at a time, and explain prints the plan report. compile builds the plan as well as checking the program, under MAX_PLAN_STEPS and MAX_EVAL_DEPTH, on a thread of STACK_BYTES; a host running programs it did not write gives the sink a thread of that size, passes its abort flag to Program::with_abort, and sets max_output_bytes (see Embedding in docs/language.md).

The engine, the two crates the language lowers to, the fixture runner and the test grammars are sibling checkouts named by path in Cargo.toml. From this directory: cargo test --all-targets, cargo test --doc, cargo clippy --all-targets --all-features -- -D warnings.