Skip to main content

Crate arb

Crate arb 

Source
Expand description

arb — visualize and modify Unix pipelines.

The crate is a lib + bin: the language front-end (lexer/parser/interpreter) lives here so it is unit-testable without a terminal; the arb binary (src/main.rs) wires it to stdin and the ratatui render loop.

M1 scope: the Tcl-flavored reader, the declarative widget/source subset, and rendering text/tail/list widgets fed from stdin. The expression layer, fusevm lowering, query verbs, and the rest of SPEC.md are later milestones — not stubbed here as if present.

Modules§

ast
Parsed command tree: a spec is a list of commands, each a verb plus args; an arg may itself be a nested block of commands (e.g. a source { … } body).
banner
The REPL banner (shown only for the interactive arb --repl / bare-TTY launch, never for a piped render or the headless dump path).
expr
Arb’s computational substrate: arithmetic expressions are compiled to a fusevm::Chunk and executed on the fusevm VM (Cranelift JIT for hot chunks). This is what “arb runs on fusevm” means concretely — every computed value in a spec flows through fusevm bytecode, not a bespoke evaluator.
lexer
Tcl-flavored lexer.
parser
Token stream -> command tree. A command is the run of args between two separators; the first arg is the verb. Block tokens are parsed recursively.
query
Query pipeline. A source { … } body compiles to a sequence of ops applied to the live stream on each evaluation.
repl
Interactive REPL for arb — utop-style line editor backed by reedline, ported from the strykelang REPL onto arb’s spec/query evaluator.
spec
Interpreter: command tree -> a Spec. Recognizes the widget verbs, source .x { … } whose body compiles to a query pipeline (see query), and the .x <- in bind shorthand. Unknown widget verbs are ignored so specs stay forward-compatible.
stream
Shared live-stream state. In M1 every stdin-bound widget renders from one shared buffer (per-widget transforms/queries arrive with the query engine).
tui
ratatui render loop. Widgets are auto-tiled vertically (explicit pack/grid geometry arrives later). Each widget’s source pipeline is evaluated against the shared stream every frame; text/tail/list render the resulting lines and gauge renders a scalar against -max. Widget kinds without a renderer yet show an honest placeholder rather than faking output.
web
Static HTML export: render a Spec into a single self-contained dashboard page. No external resources, no CDNs — one inline <style> block and the widget panels laid out on a CSS grid. Used to snapshot a pipeline TUI as a shareable HTML file.