engine library

Ball engine — interprets and executes ball programs at runtime.

The engine walks the expression tree and evaluates it directly, without generating any intermediate source code.

Fully compliant with the ball.v1 proto schema. Supports the universal std library base functions.

Classes

BallBool
A Ball boolean value.
BallDouble
A Ball double value.
BallEngine
BallFunction
A Ball function value (first-class callable).
BallGenerator
Wrapper for generator results in the synchronous interpreter.
BallInt
A Ball integer value.
BallList
A Ball list value (ordered collection).
BallMap
A Ball map value (string-keyed ordered map).
BallModuleHandler
Contract for a ball base-module handler.
BallNull
A Ball null value.
BallObject
Runtime representation of a Ball class instance.
BallString
A Ball string value.
BallValue
The root class for all Ball runtime values.
StdModuleHandler
The built-in std module handler.

Functions

ballObjectSetField(Object? target, String fieldName, Object? val) → void
Write fieldName on a live instance map (BallObject or type map). Emitted as a call to preamble ball_object_set_field in C++ self-host.
unwrap(BallValue val) Object?
Unwrap a BallValue back to a raw Dart Object?.
wrap(Object? raw) BallValue
Wrap a raw Dart Object? into the BallValue hierarchy.

Typedefs

BallCallable = FutureOr<Object?> Function(String module, String function, Object? input)
A callable that lets handlers invoke other Ball functions without holding a direct BallEngine reference.
BallRawMap = Map<String, Object?>
The engine's own name for the RAW string-keyed map the portable ordered-set value ({'__ball_set__': [...]}) actually is — the representation, not the user-visible Map type.

Exceptions / Errors

BallException
A typed exception thrown by a Ball program's throw expression. Preserves the original value so catch clauses can match on type.
BallRuntimeError
Error thrown when a ball program encounters a runtime error.