RiX Language Evaluator
The RiX evaluator lowers parser AST nodes into IR and evaluates that IR against a cell-based runtime context.
Current Status
This is the active RiX runtime, not a stub. It currently supports:
- Exact integer/rational arithmetic through
@ratmath/core - Cell-based assignment and aliasing semantics
- Blocks, cases, loops, structured breaks, and ternary expressions
- Functions, lambdas, prep phases, multifunction dispatch, and tail self calls
- Arrays, maps, sets, tuples, intervals, tensors, holes, and destructuring
- Pipe operators, traversal callbacks, partial application, and methods
- Script imports with capability sandboxing
- Diagnostics, testing helpers, tracing, and debug events
- Runtime error messages with line/column source locations when source text is available through
parseAndEvaluate()or script imports - First-class unit, quantity, and exact-generator values loaded through the
.Unitsand.ExactRiX map collections - Promise-aware evaluation, bounded
{$ ... }collection concurrency, fused map/filter/find/all pipes, nested limit groups, finite shaped-value fan-out, ordered reduce and structural barriers, named async breaks, and supervised{$$ ... }background blocks
The main entry points are:
parseAndEvaluate(code, options)for source-to-result evaluationevaluate(irNode, context, registry, systemContext)for direct IR evaluationparseAndEvaluateAsync(code, options)andevaluateAsync(...)for implicit awaiting and async syntaxdrainBackgroundTasks(context)for host/session shutdown and testscreateDefaultRegistry()for internal language/operator functionscreateDefaultSystemContext()for dot-prefixed system capabilities
Known Gaps
These boundaries distinguish supported bounded operations from open-ended work:
- Exact symbolic derivative/integral support is intentionally bounded; general transcendental and multi-equation calculus remains future work.
- Array generators, lazy sequences, interval stepping/division/partitions, mediants, random sampling, and infinite arithmetic sequences are implemented.
{# ... }retains symbolic definitions and constraints for plugins without solving them. The async runtime supports finite collections, matrices, tensors, fused|>>/|>?/|>||/|>&&, and finite structural barriers. Bounded lazy pull, ordinary-value task snapshots, cooperative cancellation and restricted pure task workers are implemented. See concurrency safety and Notebook/task workers for capability and host limits.- General algebraic field composition and user-declared cross-generator relations remain future work; built-in exact generators reduce their known single-generator relations.
Run the evaluator tests from the rix/ repository root with:
bun test tests/eval