# DSL reference A compact reference to the `.stm` language. Each form links back to the tutorial step that introduces it. ## Top-level declarations ```text import "lib.stm" # bring in another file (events/guards/bindings: bare) import "lib.stm" as ns # machines/fragments namespaced as ns.Name event Name { field: type other: type? } # type ∈ string|int|float|bool|any ; ? = optional guard name = # a reusable, composable predicate atom bind { handler = pkg.mod.fn } # map handler names to implementations machine Name { … } # a machine fragment Name(params) { … } # a parametrized, reusable piece ``` ## Inside a machine or state ```text initial StateName # where this (sub)machine starts state Name { … } # a state; nest states inside for a composite orthogonal Name { … } # an AND-state; each child state is a concurrent region final Name { … } # sugar: a terminal sink declaring its verdict on enter # hook: on entering on exit # hook: on leaving on activity # hook: event arrived with no transition timeout 900 # arm a durable timer (seconds) timeout context key # …with the delay read from context[key] outcome