These examples cover the first source-to-runtime programs and initial process dispatch forms.
examples/hello.str is the first source-to-runtime gate. It checks,
builds, runs, emits hello from Strata, and records an observability trace.
just build
just run-example helloKey source ideas:
Mainis the entry process.MainMsg.Startis the entry message.emitis declared in thestepeffect list.Stop(state)terminates normally without changing state.
examples/actor_ping.str is the first actor/runtime gate. It spawns a worker,
sends a message, handles that message, updates state, terminates normally, and
records the runtime trace.
just run-example actor_pingKey source ideas:
Maindeclaresauthority spawn_worker: Cap<Spawn<Worker>>;, then useslet worker: ProcessRef<Worker> = spawn Worker;beforesend worker Ping;.WorkerMsg.Pingis checked againstWorker's message type.WorkerreplacesIdlewithHandled.- Both processes stop normally.
examples/actor_sequence.str exercises message-keyed process transitions. The
worker handles First, returns a whole replacement state with Continue(...),
then handles Second through the wildcard clause and returns a whole
replacement state with Stop(...).
just run-example actor_sequenceKey source ideas:
WorkerMsghas two variants, and each variant resolves to exactly onestepclause.- The explicit
Firstclause handlesFirst;_covers the remaining accepted message variants. Continue(SawFirst)keeps the worker alive for the next queued message.Stop(Done)terminates the worker normally.
The runtime trace records process, message, state, and output IDs alongside labels so that behavior can be checked without treating labels as executable bindings.
examples/actor_match.str exercises the whole-body match msg
authoring form. The checker resolves each arm into the same typed transition
table used by step parameter patterns.
just run-example actor_matchKey source ideas:
fn step(state: WorkerState, msg: WorkerMsg)declares a typed message parameter.match msgmust be the whole function body.- Each arm returns a whole replacement state through
Continue(...)orStop(...). - The generated Mantle artifact still dispatches by typed message IDs.
examples/init_match.str exercises a non-step whole-body match in init. The
checker resolves the fieldless enum scrutinee, proves the arms are exhaustive,
and selects the typed initial state before lowering.
just run-example init_matchKey source ideas:
match Warmis checked againstStartupMode.- Both
ColdandWarmarms return immutable wholeMainStaterecord values. - The Mantle trace starts
MaininMainState{readiness:WarmReady}, proving the selected initial state reached runtime admission.
examples/init_return_match.str exercises a pure return match expression in
init. The checker resolves the fieldless enum scrutinee, proves the arms are
exhaustive, selects one whole initial state value, and lowers that state through
the existing typed artifact state table.
just run-example init_return_matchKey source ideas:
return match Warm { ... };is accepted only becauseWarmis a fieldless enum constructor.- Each arm is statement-free and returns one immutable whole
MainStatevalue. - Mantle receives the selected typed initial state ID; it does not dispatch on the source match arm names.