concinnity_core/behavior/mod.rs
1//! The behavior virtual machine: an authored [`Behavior`](crate::components::Behavior)
2//! compiled to slot-resolved form, and the evaluator that runs it.
3//!
4//! [`compile`] resolves every authored name to a dense slot once, producing a
5//! [`Program`]; [`exec`] runs a program's body against a [`View`] of what the
6//! body may read this tick. Evaluation mutates nothing: it appends [`Effect`]s
7//! the caller applies afterwards, which is what lets bodies run concurrently
8//! without observing each other's writes.
9//!
10//! [`BehaviorSystem`] is what drives the two over a world each tick: it gathers
11//! the view, runs the bodies, and applies their effects. Nothing below reads a
12//! clock, a file, or a device, which is why the whole of it sits in the
13//! vocabulary rather than in a host. Where persisted state is kept
14//! ([`BehaviorStore`]) and how a tick's runs fan out ([`EvalScheduler`]) are the
15//! host's to supply; a world with neither runs its behaviors serially and
16//! persists nothing.
17
18mod compile;
19mod program;
20mod run;
21mod system;
22mod value;
23
24pub use compile::compile;
25pub use program::{CExpr, CNode, COp, Program, VarTable};
26pub use run::{Effect, SpawnEffect, View, exec};
27pub use system::{
28 BehaviorState, BehaviorStore, BehaviorSystem, EvalBucket, EvalScheduler, def_hash,
29};
30pub use value::{Arith, Cmp, Val};