vertep-core is the center of Vertep. It holds the chart IR (a tree of states, transitions,
executable content, invokes and data, kept in document order), the well-formedness validator,
the type checker, and the W3C SCXML interpretation algorithm as two pure functions:
session::start and session::step. They take a session as a value plus one input and return
the next session and a list of effects ("deliver tick in 30 s", "cancel light-timer").
The core has no I/O, no async and no clock. It is no_std with alloc and builds for
embedded targets.
Every other crate builds on it. vertep-scxml, vertep-yaml and the statechart! macro read
charts into this IR; vertep-rdf projects it to RDF and hashes it; the datamodel crates
(vertep-dm-cel, vertep-dm-ecma, vertep-dm-rust) implement its Datamodel trait; and
vertep-runtime wraps step in a durable actor shell. The null datamodel lives here.
Depend on vertep-core directly when you write your own host (a game loop, an embedded
controller, a test harness), a datamodel, or a chart surface. For actors, journals and storage,
use the vertep facade, which re-exports this crate as
vertep::core.
Install
[]
= "0.1"
# Without the standard library (alloc only):
# vertep-core = { version = "0.1", default-features = false }
| Feature | Default | What it turns on |
|---|---|---|
std |
yes | std support; without it the crate is no_std with alloc |
serde |
no | Serialize and Deserialize for the IR, sessions, inputs and effects |
Example
A door with two states, built directly in the IR, run on the null datamodel:
use CompiledChart;
use ;
use ;
use NullDatamodel;
use ;
use ;
CompiledChart::new runs the validator and builds the tables step needs. The session is a
plain value: step consumes it and returns the next one, with the effects the host must carry
out (Effect::Send, Effect::Cancel, Effect::Invoke, Effect::Log, ...). Time and the random
seed travel inside each Input through Environment, so the same inputs always give the same
outcome. Charts usually come from a reader instead of being built by hand; see
vertep-scxml and
vertep-yaml.
Key types
| Item | What it is |
|---|---|
ir::Chart, ir::State, ir::Transition, ir::Exec |
The chart IR, the hub every surface reads into |
compile::CompiledChart |
A validated chart with the indexes step uses |
validate::validate, validate::Violation |
The W3C SCXML structural rules, reported all at once |
session::start, session::step |
The pure interpreter: session + input -> session + effects + trace |
session::Session, session::Effect, session::Outcome |
Session state, effects for the host, the result of a macrostep |
datamodel::Datamodel, datamodel::DatamodelRegistry |
The contract every datamodel implements, and how hosts pick one by name |
null::NullDatamodel, null::create_datamodel_for |
The SCXML null datamodel; create a chart's datamodel from a registry |
types::check_chart, types::Type |
The one type language and checker shared by the loaders, the macro and the runtime |
tape::TapeDatamodel |
Records every datamodel request and answer, for the Lean differential oracle |
identity::assign_generated_ids |
Gives anonymous states stable identifiers |
Documentation
- Website: https://volland.github.io/vertep/docs/concepts.html (configuration, macrostep, effects and the determinism rule)
- API reference: https://docs.rs/vertep-core
- Examples: https://volland.github.io/vertep/examples/traffic-light.html (an SCXML traffic light driven through
startandstep) - Articles: https://volland.github.io/vertep/articles/statecharts.html
License
MIT OR Apache-2.0, at your option.