lower

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lower provides AST → execution IR lowering. Converts declarative members (TransitionMember, EntryMember) to operational graphs (nodes + edges) that executors consume.

Index

Constants

View Source
const (
	EntryTransitionAccepterSourceMessage = "A transition with an accepter must have a state as its source. " +
		"(SysML v2; pilot validateTransitionUsageTriggerActions)"
	EntryTransitionShorthandEffectMessage = "a shorthand transition out of an entry action may carry a guard at most; " +
		"write `entry action boot; transition boot do action mark then s;` to give the transition an explicit source " +
		"(SysML v2 7.18.3 EntryTransitionMember)"
)
View Source
const (
	ProbabilityFQN     = semantics.ProbabilityFQN
	ProbabilityFeature = semantics.ProbabilityFeature
)

ProbabilityFQN names the OpenSysML metadata type by which a model weights the successions out of a decision node; ProbabilityFeature is the weight it binds.

View Source
const (
	ContinuousDynamicsFQN = "StateSpaceRepresentation::ContinuousStateSpaceDynamics"
	DiscreteDynamicsFQN   = "StateSpaceRepresentation::DiscreteStateSpaceDynamics"
	ZeroCrossingEventFQN  = "StateSpaceRepresentation::ZeroCrossingEventDef"
	IntegrateFQN          = "StateSpaceRepresentation::Integrate"
	EulerFQN              = "StateSpaceIntegration::Euler"
	RK4FQN                = "StateSpaceIntegration::RK4"
	FixedStepDynamicsFQN  = "StateSpaceIntegration::FixedStepDynamics"
)

The library declarations state-space dynamics are lowered against, by qualified name.

View Source
const (
	StateSpaceFeature = "stateSpace"
	InputFeature      = "input"
	OutputFeature     = "output"
	TimeStepFeature   = "timeStep"
	StopTimeFeature   = "stopTime"
	TimeFeature       = "time"
	GuardFeature      = "guard"
	TerminalFeature   = "terminal"
	GetDerivativeCalc = "getDerivative"
	GetDifferenceCalc = "getDifference"
	GetOutputCalc     = "getOutput"
	GetNextStateCalc  = "getNextState"
	IntegrateCalc     = "integrate"
)

The protocol's member names, as StateSpaceRepresentation declares them.

View Source
const (
	// StepMultiplicityNotFixedCode identifies a step that has no exact finite count.
	StepMultiplicityNotFixedCode = "action-step-multiplicity-not-fixed"
	// StepMultiplicityUnsupportedCode identifies a repeated step with unsupported links.
	StepMultiplicityUnsupportedCode = "action-step-multiplicity-unsupported"
	// StepOrderUnsatisfiableCode identifies succession multiplicities that exclude a step count.
	StepOrderUnsatisfiableCode = "action-step-order-unsatisfiable"
	// StepOrderOpenCode identifies a succession that does not establish repeated-step ordering.
	StepOrderOpenCode = "action-step-order-open"
)
View Source
const EntryTransitionTargetFormat = "transition out of the entry action reaches %s, " +
	"which is not a state or junction/choice route the body can start in (SysML v2 7.18.3)"

EntryTransitionTargetFormat reports a transition out of the entry action whose target is a vertex the body cannot start in.

View Source
const NoTransitionSourceMessage = "transition without a source has no member before it to leave: " +
	"it leaves the state declared before it in the same body (SysML v2 7.18.3), and none precedes it"

NoTransitionSourceMessage reports the sourceless shorthand with no member before it to leave, shared by the check reporting it and the lowering backstopping it.

View Source
const NotAVertexFormat = "transition endpoint %s names a %s that is not a vertex of this state machine"

NotAVertexFormat reports an endpoint naming an element outside the machine's vertices, shared by the check reporting it and the lowering backstopping it.

View Source
const ProbabilityTolerance = 1e-6

ProbabilityTolerance is how far the constant weights out of one decision may sum from 1.0 and still be taken as summing to it.

View Source
const StateActionFQN = "States::StateAction"

StateActionFQN names the library state every state specializes, whose content (self, substates, transitions) a consumer of the graph carries natively.

View Source
const TransitionSourceMarkerFormat = transitionSourceLeavesFormat +
	"which is not a state of this state machine (SysML v2 7.18.3): write `transition first <state> … then …;` to leave one"

TransitionSourceMarkerFormat reports the shorthand whose nearest preceding member is a `first start then s;` succession or a `done;` marker, not a state.

View Source
const TransitionSourceNotVertexFormat = transitionSourceLeavesFormat +
	"which is not a state of this state machine (SysML v2 7.18.3)"

TransitionSourceNotVertexFormat reports the shorthand whose nearest preceding member is not a state, shared the same way.

View Source
const TransitionSourcePseudostateFormat = transitionSourceLeavesFormat +
	"which is a pseudostate rather than a state (SysML v2 7.18.3): write `transition first %s … then …;` to leave it"

TransitionSourcePseudostateFormat reports the shorthand whose nearest preceding member is a pseudostate, which only a transition naming it as `first` leaves.

View Source
const TransitionSourceRegionFormat = transitionSourceLeavesFormat +
	"which is an orthogonal region of a parallel state rather than a state of this state machine (SysML v2 7.18.3)"

TransitionSourceRegionFormat reports the shorthand whose nearest preceding member is an orthogonal region of a parallel state, which no transition leaves.

Variables

View Source
var (
	ErrCyclicSpecialization      = errors.New("action specializes itself")
	ErrRedefinedStepMissing      = errors.New("redefined action step not found")
	ErrIncompatibleRedefinedStep = errors.New("redefining feature is not an action step")
	ErrAmbiguousInheritedStep    = errors.New("inherited succession reaches more than one redefining step")
)
View Source
var (
	// ErrNoSequence is an occurrence whose body holds neither a lifeline with an
	// event occurrence nor a use of a nested interaction.
	ErrNoSequence = errors.New("no lifeline of the occurrence holds an event occurrence")
	// ErrMessageEndUnowned is a message end naming no event occurrence of a lifeline.
	ErrMessageEndUnowned = errors.New("message end names no event occurrence of a lifeline")
	// ErrSequenceCycle is a set of orders no realization order satisfies.
	ErrSequenceCycle = errors.New("the orders between the events form a cycle")
)
View Source
var ErrNoTransitionSource = errors.New(NoTransitionSourceMessage)

ErrNoTransitionSource marks a transition written without a source that no member precedes in its body.

View Source
var ErrProbability = errors.New("invalid Probability metadata")

ErrProbability is the typed error every ill-formed use of Probability wraps.

View Source
var ErrRecursiveStateTyping = errors.New("recursive state typing")

ErrRecursiveStateTyping reports a state definition whose content contains a state typed by that same definition, which has no finite materialization.

View Source
var ErrUnsupportedStateContent = errors.New("unsupported state machine content")

ErrUnsupportedStateContent reports content of a state machine that lowering cannot represent, rather than dropping it.

View Source
var ErrUnsupportedStateSpace = errors.New("unsupported state-space dynamics")

ErrUnsupportedStateSpace reports a state-space action whose shape the runner cannot execute: a protocol member it does not provide, or one it cannot integrate.

Functions

func AcceptedNames

func AcceptedNames(trigger ast.Node) []string

AcceptedNames lists the names a classified trigger binds when it fires: the payload an accept declares, or a call trigger's parameters, in order.

func ActionEndpointAccepted

func ActionEndpointAccepted(nodes []ast.Node, hasInitial bool, ref ast.Node, source bool) bool

ActionEndpointAccepted reports whether an action endpoint names a lowered node or one of the implicit start/done markers.

func ActionNodes

func ActionNodes(actionDecl ast.Node, scope *symbols.Scope) (nodes []ast.Node, hasInitial bool, err error)

ActionNodes returns the nodes accepted by action lowering and whether the action has an initial node after interpreting `first <node>`.

func BehaviorMembers

func BehaviorMembers(decl ast.Node) ([]ast.Node, error)

BehaviorMembers are the members of a behavior declaration, and an error for a node that declares no behavior.

func BehaviorOrderHasExecutableEnd added in v0.10.0

func BehaviorOrderHasExecutableEnd(model *semantics.Model, order BehaviorOrder) bool

BehaviorOrderHasExecutableEnd reports whether an order can name an object behavior.

func BlockNodes

func BlockNodes(stmts []Statement) []ast.Node

BlockNodes returns the action nodes the blocks among stmts declare, in declaration order: the nodes a body's performance runs as subperformances.

func BodyDivides added in v0.10.0

func BodyDivides(graph *ActionGraph, node ast.Node) bool

BodyDivides reports whether another performance interleaving inside node's performance may change an outcome: two or more of the body's moves depend on a move another performance may make concurrently. With one such move at most, every interleaving reorders only independent moves, so the body runs as one move.

func BodySharesMoves added in v0.10.0

func BodySharesMoves(graph *ActionGraph, node ast.Node) bool

BodySharesMoves reports whether two or more of node's moves may touch what another performance does: alongside moves outside its flow, such a body may be divided by one.

func BodyStatementMembers

func BodyStatementMembers(members []ast.Node) []ast.Node

BodyStatementMembers returns the members of a node body that state work to perform, in declaration order: what a body declares (a parameter, a doc comment) is a feature of the node, not a step of the flow through it.

func CalcBodyWithOrder added in v0.10.0

func CalcBodyWithOrder(owner ast.Node, members []ast.Node, scope *symbols.Scope, resolver *resolve.Resolver) ([]Statement, *StatementOrder)

CalcBodyWithOrder lowers the body and its calculation-statement order.

func CarriesObjects added in v0.10.0

func CarriesObjects(node ast.Node) bool

CarriesObjects reports whether node is a control node object flows pass through, by the features it declares: a fork, a join or a merge.

func CaseFlowStart

func CaseFlowStart(graph *ActionGraph) (ast.Node, error)

CaseFlowStart finds the step a flow starts at where no `first` or start node states one: the single step no succession leads to that the flow performs (performedStep). Two such steps leave the start unstated, and none is a cycle; either is reported.

func CheckBehaviorOrderMultiplicity added in v0.10.0

func CheckBehaviorOrderMultiplicity(scope *symbols.Scope, earlier, later ast.Node, earlierMultiplicity, laterMultiplicity *ast.Multiplicity, decl ast.Node, model *semantics.Model) error

CheckBehaviorOrderMultiplicity applies the action-step succession rule at one performance per end.

func ConstraintBodyWithOrder added in v0.10.0

func ConstraintBodyWithOrder(scope *symbols.Scope, members []ast.Node, stmts []Statement) ([]Statement, *StatementOrder)

ConstraintBodyWithOrder returns a constraint body's statements with its successions between statements recorded as precedence.

func DeclaresNodeFeature

func DeclaresNodeFeature(m *ast.Usage) bool

DeclaresNodeFeature reports whether an action member is a parameter or attribute.

func DescribeMember

func DescribeMember(member ast.Node) string

DescribeMember names a state machine member in modelling terms, for a message about content that cannot be lowered where it was written.

func EndpointRef

func EndpointRef(target ast.Node) ast.Node

EndpointRef is the node a connector end names a vertex with: a qualified name or a feature chain, unwrapped from a feature reference; nil for anything else.

func EndpointText

func EndpointText(target ast.Node) string

EndpointText renders an endpoint as written (`c::c1`, `c.c1`), for a message about it.

func FeaturePath

func FeaturePath(node ast.Node) string

FeaturePath renders the feature a node names as a dotted path, so a nested port keeps every segment it was written with. It returns "" for a node that names no feature.

func FlowSharesMoves added in v0.10.0

func FlowSharesMoves(graph *ActionGraph) bool

FlowSharesMoves reports whether two or more moves of a performance of graph's flow, its start shot and its subflows' moves included, may touch what another performance does; the attributes and in parameters the performance holds its own values of are not shared.

func FlowStartError added in v0.10.0

func FlowStartError(graph *ActionGraph) error

FlowStartError reports a flow stating steps that nothing can start: one whose successions form a cycle over every step, so no step is unpreceded. A flow with a start, one stating no step, and one whose only unpreceded steps are not composite subactions (`ref` and `perform` usages, control nodes, which are performed only where a succession reaches them) have none.

func GatedFlowAccepted added in v0.10.0

func GatedFlowAccepted(nodes []ast.Node, sourceRef ast.Node, flow *ast.Usage) bool

GatedFlowAccepted reports whether a succession from sourceRef may lead to flow: a succession flow leaving the node sourceRef names, whose delivery the succession gates.

func ImplicitSource

func ImplicitSource(members []ast.Node, transition *ast.TransitionMember) (ast.Node, error)

ImplicitSource returns the body member a transition written without a source leaves, or ErrNoTransitionSource when no member precedes it in members.

func InstantDelay added in v0.10.0

func InstantDelay(trigger ast.Node) (*ast.TimeEvent, bool)

InstantDelay is the time event of an accept or transition trigger that may end the instant: a relative delay written as a number, with or without a unit.

func IsCaseNode

func IsCaseNode(u *ast.Usage) bool

IsCaseNode reports whether a usage is a case nested in a body as a step of it: an analysis usage (SysML v2 §7.22) or a verification usage (§7.23), performed as the calculation it is. Its own body is the case's, run by the case, so the flow it is a node of lowers none of it. A directed one is a parameter, referential and so no subperformance (Kernel Semantic Library `composite step subperformances`).

func IsDeferredKeeper added in v0.10.0

func IsDeferredKeeper(resolver *resolve.Resolver, scope *symbols.Scope, node *ast.Usage) bool

IsDeferredKeeper reports whether an accept node carries a DeferredKeeper annotation, read in the scope the node was written in. Detection is by resolved annotation type, never by the annotation's spelling.

func IsEntryTransition

func IsEntryTransition(source ast.Node) bool

IsEntryTransition reports whether the member a sourceless transition leaves is the entry action of its body, whatever else the transition was written with.

func IsPerformedActionUsage added in v0.10.0

func IsPerformedActionUsage(usage *ast.Usage) bool

IsPerformedActionUsage reports whether usage binds a classifier-level performed action.

func IsResult

func IsResult(stmt Statement) bool

IsResult reports a statement that returns a value on some path through it: a `return`, or control flow with one inside. The results end a lowered body.

func IsStateSource

func IsStateSource(source ast.Node) bool

IsStateSource reports whether a vertex the shorthand found before it is one it may leave: SysML v2 7.18.3 names the previous state usage, which a pseudostate, a one-ended `first s;` marker and a `done;` marker are not.

func IsStateSourceDecl added in v0.10.0

func IsStateSourceDecl(resolver *resolve.Resolver, scope *symbols.Scope, source ast.Node) bool

IsStateSourceDecl is IsStateSource for a declaration as written: a state usage carrying a StateMachines pseudostate annotation is no transition source, as the pseudostate it lowers to is not.

func IsTerminateUsage

func IsTerminateUsage(node ast.Node) bool

IsTerminateUsage reports a terminate action usage (`action stop terminate;`), which a state body declares as a vertex a transition may end at.

func PerformsLeafStatements added in v0.10.0

func PerformsLeafStatements(members []ast.Node) bool

PerformsLeafStatements reports whether a nested action node's members are a leaf body performing statements: they state no flow of their own (runsOwnFlow) and write a statement directly among them.

func PerformsSteps

func PerformsSteps(decl ast.Node) bool

PerformsSteps reports whether decl is a behavior whose body performs the action nodes among its members as steps: an analysis case (SysML v2 §7.22) or a verification case (§7.23), each a calculation and an action. A calc's body reads them as declarations only.

func PseudostateMetadata added in v0.10.0

func PseudostateMetadata(resolver *resolve.Resolver, scope *symbols.Scope, usage *ast.Usage) (ast.PseudostateKind, bool)

PseudostateMetadata reports the pseudostate kind usage declares by carrying a StateMachines pseudostate annotation (`#choice state pick;`), for the member scope it was written in. Detection is by resolved annotation type, never by the annotation's spelling.

func ReadsAtStart added in v0.10.0

func ReadsAtStart(graph *ActionGraph, node ast.Node) bool

ReadsAtStart reports whether a performance of node, beginning, evaluates initial values at its start shot before its body runs.

func Returns

func Returns(stmts []Statement) bool

Returns reports whether the statements return a value on some path, so a calculation whose body only computes can be told from one that has no result.

func SendPayload

func SendPayload(m *ast.SendStatement) ast.Node

SendPayload returns the message a send with no argument carries: the value its body binds the payload parameter to (`send { in :>> payload = s; }`).

func SendPayloadParameter

func SendPayloadParameter(m *ast.SendStatement) *ast.Usage

SendPayloadParameter returns the body feature redefining SendAction::payload: by name in a `:>>` clause, else by position as the first parameter of an argument-less send.

func SendTarget

func SendTarget(node ast.Node) (string, bool)

SendTarget renders a send's target and reports whether it is a feature chain (`alpha.inPort`) rather than a name in a namespace (`R`, `P::R`).

func ShadowedKey added in v0.11.0

func ShadowedKey(sym *symbols.Symbol) string

ShadowedKey is the name a performance binds a hidden inherited feature under: the declaring type's name and the feature's, `Base::go`, which no simple name spells.

func StartFlow

func StartFlow(graph *ActionGraph)

StartFlow gives a flow performed whole — a case body's, a state behavior's, an action's — the nodes its performance starts at: the ordered part's start, where no `first` states one its one unpreceded step, and every composite subaction no succession leads to as a concurrent start (startsConcurrently). Where nothing can start a flow stating steps, the graph keeps no start and running it reports why (FlowStartError).

func StatementNode added in v0.11.0

func StatementNode(stmt Statement) ast.Node

StatementNode is the syntax a lowered statement came from, nil for none.

func StatesBehaviorBody

func StatesBehaviorBody(members []ast.Node) bool

StatesBehaviorBody reports whether members state a behavior body rather than only annotating the declaration or binding the behavior's parameters (`exhibit m { in x = y; }`, `exhibit m : M { doc /* … */ }`).

func TerminatedOccurrence added in v0.11.0

func TerminatedOccurrence(m *ast.Usage) *ast.TerminateStatement

TerminatedOccurrence returns the occurrence a terminate action usage names (`action stop terminate process;`), nil when it terminates its own container.

func TransitionGroups

func TransitionGroups(source ast.Node, transitions []*Transition) [][]int

TransitionGroups returns the positions of the transitions out of source that compete for one event: every branch out of a pseudostate, and for a state the completion transitions and the transitions of each trigger spelling, each group in declaration order.

func TriggerKey

func TriggerKey(trans *Transition) string

TriggerKey is the key of the event a transition reacts to: the transitions out of one state sharing it compete for the same occurrences and are checked for their weights as one group; "" keys the completion group. The lowered transition's resolved GroupKey is returned when set.

func TriggerName

func TriggerName(trigger ast.Node) string

TriggerName describes a transition's trigger for a diagnostic and a choice line, as the runtime spells it: the signal or operation accepted, or the event's kind alone.

func TypeText

func TypeText(u *ast.Usage) string

TypeText spells the type a usage declares with `:` as the notation writes it (each segment quoted when it must be), or "" without one.

func VertexDeclsResolving added in v0.10.0

func VertexDeclsResolving(stateMachineDecl ast.Node, scope *symbols.Scope, resolver *resolve.Resolver) (map[ast.Node]bool, error)

VertexDeclsResolving returns every declaration a transition of this state machine may name as an endpoint, as the lowered graph collects them; a nil resolver reads no metadata vertices.

func VertexKind

func VertexKind(decl ast.Node) string

VertexKind names what an endpoint reached in modelling terms, for a message a modeller reads.

func ViaPortPath

func ViaPortPath(node ast.Node) (path string, self bool)

ViaPortPath renders the port a `via` names as the connector ends of the sender's owner write it, and reports whether it was written from `this`: `this.p` is the sender's own port p, whatever the behavior binds `p` to.

func WeightInRange

func WeightInRange(w float64) bool

WeightInRange reports whether a drawn or constant weight is a probability.

Types

type Accept

type Accept struct {
	ParamName    string
	SignalType   *ast.QualifiedName
	ViaPort      string
	ViaSelf      bool // ViaPort was written from `this`, as Send.ViaSelf
	SubsetsEvent ast.Node
	Trigger      ast.Node
	// Scope is the scope the accept was declared in, in which SignalType resolves.
	Scope *symbols.Scope
	// Keeper reports the accept keeps the signal for a state deferring it, as a
	// DeferredKeeper annotation on the node declares (`#MigrationMetadata::DeferredKeeper
	// action receive accept kept : Sig;`): it takes an occurrence no other accept
	// of the state's behavior is ready for.
	Keeper bool
	// Payload is the feature the accept declares its payload as, which the nodes
	// of its body resolve ParamName to where no nearer declaration binds the name.
	Payload *symbols.Symbol
}

Accept is a lowered accept parameter: `action r accept msg : Warning;`. SignalType is the parameter's declared type name as written, nil when it was declared without one, in which case the node accepts a message of any type.

ViaPort is the port named by `accept msg : Warning via p`, empty when the accept named none. A port-routed message is only offered to an accept on the port it arrived at, so the two forms do not consume each other's messages.

SubsetsEvent is the event feature the payload subsets (`accept :> shutDown`), as written, nil for none: the accept waits for that one event.

Trigger is the time or change event of `accept at t` / `accept after d` / `accept when c`, nil when the accept waits for a message instead.

type ActionEdge

type ActionEdge struct {
	Source             ast.Node
	Target             ast.Node
	Guard              ast.Node
	Decl               ast.Node
	Probability        *Probability
	Name               string
	SourceMultiplicity *ast.Multiplicity
	TargetMultiplicity *ast.Multiplicity
	// DeclaredOrder marks the succession a block's declaration order synthesizes
	// rather than the model states: the executor's order, not a written one.
	DeclaredOrder bool
	// Carries marks the succession of a succession flow, which delivers a value
	// as well as ordering its ends.
	Carries bool
	// Gate is the succession that leads to a succession flow, whose guard and name the
	// edge takes; nil when the flow follows its source unconditionally.
	Gate ast.Node
}

ActionEdge is one succession out of a node: the node it leaves, the target it reaches, the guard it carries and its declaration (nil when implicit). No two edges of a graph compare equal. Probability is the weight its `@Probability` states, nil for an unweighted succession. Name is the name the succession was declared with, "" for an anonymous one.

type ActionGraph

type ActionGraph struct {
	// Scope is the scope the action's body was declared in, in which every
	// expression written directly among its members resolves its names. A nested
	// node or a body-local block carries its own scope instead.
	Scope *symbols.Scope

	// Attributes are the attribute defaults the action declares, in order.
	Attributes []Attribute

	// Parameters are the directed parameters the action declares itself (`in
	// bread : Bread;`, `out toast : Toast;`, `return r;`), in declaration order:
	// the pins on its own frame. A usage's inherited ones are its type's.
	Parameters []Feature

	// Nodes in the graph (InitialNode, FinalNode, ExecutionNode, etc.)
	Nodes []ast.Node

	// Edges: source node → successions in declaration order.
	Edges map[ast.Node][]ActionEdge

	// Multiplicities are the declarations on action nodes themselves.
	Multiplicities map[ast.Node]*ast.Multiplicity

	// DataFlows: source node → list of object flows
	DataFlows map[ast.Node][]ObjectFlow

	// Bodies: node → the statements that node executes, in declaration order
	Bodies map[ast.Node][]Statement

	// Features: node → the parameters and attributes the node declares itself,
	// in declaration order; each performance of the node holds its own values.
	Features map[ast.Node][]Feature

	// Scopes: node → the namespace the node owns, which its features resolve in.
	Scopes map[ast.Node]*symbols.Scope

	// Bindings are the bindings with an end at a node's pin (`bind add.a = x;`).
	Bindings []PinBinding

	// ValueBindings are the bindings a node's pins state by their values naming a
	// feature (`in b = bread;`, `in t = heat.t;`, `out x :>> x = y;`), one per pin,
	// in node then declaration order, with the other end resolved as a Binding's
	// is: a view draws them. The executor reads a pin's value as the pin's own,
	// so only an `inout` pin's, which writes back, is in Bindings as well.
	ValueBindings []PinBinding

	// Accepts: node → the message that node waits for
	Accepts map[ast.Node]Accept

	// Subflows: node → the flow the node's own members state, present only for a
	// node that states one. Its subactions are subperformances of the node, so it
	// completes only when that flow does (action_subflow.go).
	Subflows map[ast.Node]*Subflow

	// Enclosing and EnclosingNode are the graph and node a nested flow runs under,
	// whose pins a write under the flow streams from; nil for the outermost flow.
	Enclosing     *ActionGraph
	EnclosingNode ast.Node

	// Initial is the node the flow's ordered part starts at: the one a `first`
	// names, else its one node no succession leads to; nil where neither exists.
	Initial ast.Node

	// Concurrent are the composite subactions no succession leads to, other than
	// Initial, in declaration order: each starts when a performance of the flow
	// does, unordered against Initial and against each other (StartFlow).
	Concurrent []ast.Node

	// Invalid is the error a stated body's flow failed to lower with,
	// reported at initialize().
	Invalid error

	// FinalNodes (may be multiple)
	Finals []ast.Node

	// Connections are the connectors declared in the action body, which is how
	// a `send ... via <port>` finds the ports it reaches.
	Connections []Connection

	// StatementRuns marks the nodes of a block's own flow that stand for a run of
	// statements rather than for an action node (block_graph.go). Such a node is
	// keyed by the first statement of the run, whose name names no step.
	StatementRuns map[ast.Node]bool

	// StatementOrders holds order metadata for body lists lowered as part of a
	// calculation block's own flow.
	StatementOrders map[ast.Node]*StatementOrder

	// UnstatedCaseFlow marks an unordered case body lifted into an action graph.
	UnstatedCaseFlow bool

	// BlockNodes lists, per node, the action nodes its body's blocks (an `if` branch,
	// a loop body) declare, in declaration order: subperformances reached by name from it.
	BlockNodes map[ast.Node][]ast.Node

	// Performs records the inherited action type a redefining node performs
	// when the node has no own invocation.
	Performs map[ast.Node]PerformedType

	// MergedTypedSubflows records typed action nodes whose body was merged into
	// their subflow, so runtime does not perform the typing a second time.
	MergedTypedSubflows map[ast.Node]PerformedType
	// contains filtered or unexported fields
}

ActionGraph is the execution IR for actions. Nodes represent control flow points, edges represent flow paths.

func BlockFlows

func BlockFlows(stmts []Statement) []*ActionGraph

BlockFlows returns the flows the blocks among stmts state, those of nested blocks stating none of their own included.

func NestedFlow

func NestedFlow(in *ActionGraph, node, next ast.Node) *ActionGraph

NestedFlow returns the flow next is a node of among those a performance of node, a node of in, holds as its own: the flow node owns, or a block flow of its body. nil when next is no such node.

func ToActionGraph

func ToActionGraph(actionDecl ast.Node, scope *symbols.Scope) (*ActionGraph, error)

ToActionGraph converts an action AST (Usage or Definition) to an ActionGraph. scope is the scope the action's body was declared in — the scope the action itself owns — which every expression the graph carries is evaluated in. Returns error if graph is malformed (e.g., no initial node, dangling edges). Without the name-resolution tier's resolver a Probability annotation cannot be told from any other metadata, so none is read; a caller holding one uses ToActionGraphWith.

func ToActionGraphWith

func ToActionGraphWith(actionDecl ast.Node, scope *symbols.Scope, resolver *resolve.Resolver) (*ActionGraph, error)

ToActionGraphWith is ToActionGraph reading the metadata the resolver identifies: a succession's `@Probability { p = ...; }` becomes its edge's weight.

func ToActionInterface

func ToActionInterface(actionDecl ast.Node, scope *symbols.Scope) (*ActionGraph, error)

ToActionInterface lowers only the attributes an action declares, for a performance that runs no body of it: an external tool's. Its flow is empty whatever the body states.

func ToActionNodeFlow added in v0.10.0

func ToActionNodeFlow(node ast.Node, scope *symbols.Scope, resolver *resolve.Resolver) *ActionGraph

ToActionNodeFlow lowers one action node as the sole node of a block flow.

func (*ActionGraph) BindingFootprints added in v0.11.0

func (g *ActionGraph) BindingFootprints() map[ast.Node]Footprint

BindingFootprints is node → what binding the node's own features, pins and accepted payload touches, apart from the statements its body runs: what a performance's inputs are bound from and where its outputs go. Computed on first use, as Footprints is.

func (*ActionGraph) CheckStep added in v0.10.0

func (g *ActionGraph) CheckStep(node ast.Node, model *semantics.Model) error

CheckStep classifies a declared multiplicity and its incident successions.

func (*ActionGraph) CrossesPerPerformance added in v0.10.0

func (g *ActionGraph) CrossesPerPerformance(node ast.Node, model *semantics.Model) bool

CrossesPerPerformance reports whether node, a step performed n times, leads its every performance into a join or merge: the edge is bijective, so the control node fires once per performance rather than behind a barrier.

func (*ActionGraph) DeclScope added in v0.11.0

func (g *ActionGraph) DeclScope(decl ast.Node) *symbols.Scope

DeclScope is the scope a declaration of the graph was written in, where the names its expressions spell resolve: the general's body where inherited, else the action's own.

func (*ActionGraph) DocOf

func (g *ActionGraph) DocOf(decl ast.Node) string

DocOf is the document a declaration of the graph was written in: the general's where inherited, else the action's own; "" outside any document.

func (*ActionGraph) Footprints

func (g *ActionGraph) Footprints() map[ast.Node]Footprint

Footprints is node → what advancing a token through the node may read, write, send, accept and converge on, for the model checker's independence relation. It is computed from the lowered graph on first use and shared by every caller.

func (*ActionGraph) HasStepMultiplicity added in v0.10.0

func (g *ActionGraph) HasStepMultiplicity(node ast.Node, model *semantics.Model) bool

HasStepMultiplicity reports whether a node has an owned or effective step multiplicity, including recorded library facts.

func (*ActionGraph) Incoming added in v0.9.2

func (g *ActionGraph) Incoming(node ast.Node) []ActionEdge

Incoming returns the successions into node, in the declaration order of the nodes they leave. The result is shared: callers must not modify it.

func (*ActionGraph) Inherited

func (g *ActionGraph) Inherited() []Inherited

Inherited lists the declarations the action's content came from besides its own — the actions it specializes, then those its subflows specialize — each once.

func (*ActionGraph) MultiplicityText added in v0.10.0

func (g *ActionGraph) MultiplicityText(node ast.Node, model *semantics.Model) string

MultiplicityText returns the source text of node's effective multiplicity.

func (*ActionGraph) Resolver added in v0.12.0

func (g *ActionGraph) Resolver() *resolve.Resolver

Resolver is the resolver the graph was lowered with, nil for none.

func (*ActionGraph) Semantics added in v0.12.0

func (g *ActionGraph) Semantics() *semantics.Model

Semantics is the semantic model over the graph's resolver, built once and shared by every footprint of the graph; nil without a resolver.

func (*ActionGraph) StartUsage

func (g *ActionGraph) StartUsage(node ast.Node) (Effect, bool)

StartUsage returns the start a performed action node stands for (`perform obj.beh.start;`), the last of its body; false for a node that performs otherwise.

func (*ActionGraph) Starts added in v0.10.0

func (g *ActionGraph) Starts() []ast.Node

Starts returns the nodes a performance of the flow starts at: Initial, where the flow has one, then each concurrent start in declaration order.

func (*ActionGraph) StatementList added in v0.10.0

func (graph *ActionGraph) StatementList() ([]Statement, bool)

StatementList returns a graph's sequential statement nodes as one list.

func (*ActionGraph) StepCount added in v0.10.0

func (g *ActionGraph) StepCount(node ast.Node, model *semantics.Model) (int64, error)

StepCount returns the fixed number of performances an owned or inherited multiplicity governs; when none does, the step performs once.

func (*ActionGraph) StepError added in v0.10.0

func (g *ActionGraph) StepError(node ast.Node, model *semantics.Model, code, reason string, declaration ast.Node) *StepMultiplicityError

StepError constructs the shared diagnostic used when a consumer refuses a repeated step for a reason outside the built-in succession checks.

func (*ActionGraph) StepMultiplicity added in v0.10.0

func (g *ActionGraph) StepMultiplicity(node ast.Node, model *semantics.Model) (*ast.Multiplicity, *symbols.Scope)

func (*ActionGraph) TerminateUsage

func (g *ActionGraph) TerminateUsage(node ast.Node) (Effect, bool)

TerminateUsage returns the terminate a terminate action usage stands for, the last of its node's body after the statements it declares; false for a node that is none.

type Assert added in v0.10.0

type Assert struct {
	Node  *ast.Usage
	Sym   *symbols.Symbol // the assertion's symbol, nil where the scope does not declare it
	Scope *symbols.Scope  // the scope the assertion was declared in
}

Assert is an `assert constraint` a succession orders among a flow's steps: the flow reaching it checks the conditions Sym states.

type Assign

type Assign struct {
	Target string
	// Qualified marks a namespace-qualified target (`Scope::azimuth`): it names
	// the feature on the object its qualifier names, no host binding applies.
	Qualified bool
	// Owner is the qualifier's symbol (`Probe` in `Probe::count`) and Feature the
	// feature it names; both are set only when Qualified is.
	Owner   *symbols.Symbol
	Feature *symbols.Symbol
	// Chain is the chained target the assignment writes through (`s.reading`),
	// nil when the target was a plain name the body's host binds.
	Chain *AssignTarget
	Value ast.Node
	Node  ast.Node       // the statement itself, for diagnostics
	Scope *symbols.Scope // the scope the statement was declared in
}

Assign is a lowered assignment: `assign <Target> := <Value>`. Target is the feature written — the target's last segment — empty when the target names no feature.

type AssignTarget

type AssignTarget struct {
	// Base is the expression the chain starts from, evaluated in the statement's
	// own scope.
	Base ast.Node
	// Steps are the features walked from Base to the object written, in order.
	Steps []string
	// Text is the target as written (`a.b.c`), for diagnostics.
	Text string
}

AssignTarget is a chained assignment target: `assign a.b.c := v` walks `b` from `a` and writes `c` on the object it reaches.

type Attribute

type Attribute struct {
	Name string
	// Direction is the parameter direction written, DirNone for a plain attribute.
	Direction ast.FeatureDirection
	IsResult  bool // a `return` parameter, what the behavior yields
	// Type is the declared type as written (`Natural`, `Vehicle::Mode`), "" without one.
	Type    string
	Value   ast.Node
	Binding bool
	Node    ast.Node // the declaration itself, for diagnostics
	// Scope is the scope the declaration was written in, in which its default
	// resolves; nil where the owner's own scope resolves it.
	Scope *symbols.Scope
	// Optional reports an effective multiplicity with lower bound 0 (`x : Integer[0..1]`):
	// the feature may hold no value at all. The run resolves it, as it does Scope.
	Optional bool
	// Symbol is the feature the attribute declares, which a performance holding it
	// binds its cell by; nil when no scope declares Node.
	Symbol *symbols.Symbol
	// Shadowed marks an inherited feature a same-named member of the specialization
	// hides without redefining it (KerML 1.0 §8.2.3.5.3): both are held, and Name is
	// then the hidden one's owner-qualified key (ShadowedKey).
	Shadowed bool
}

Attribute is a lowered attribute default written among a behavior's members (`attribute h : LengthValue = 500.0 [m];`), whose Value resolves in the graph's own scope.

func (Attribute) Output

func (a Attribute) Output() bool

Output reports whether the feature is written back rather than read: an `out` or `return` parameter, which no caller and no witness may fix.

type BehaviorOrder added in v0.10.0

type BehaviorOrder struct {
	Decl      ast.Node
	Name      string
	File      string
	Span      source.Span
	Featuring *symbols.Symbol
	Earlier   BehaviorOrderEnd
	Later     BehaviorOrderEnd
	Refusal   *BehaviorOrderRefusal
}

BehaviorOrder is a succession outside a behavior body, ordering performances of the objects it relates.

func BehaviorOrders added in v0.10.0

func BehaviorOrders(model *semantics.Model, roots ...*symbols.Scope) []BehaviorOrder

BehaviorOrders lowers succession declarations owned outside behavior bodies.

type BehaviorOrderEnd added in v0.10.0

type BehaviorOrderEnd struct {
	Path         []*symbols.Symbol
	Multiplicity *ast.Multiplicity
	Span         source.Span
}

BehaviorOrderEnd is one endpoint relative to its featuring instance or package.

type BehaviorOrderRefusal added in v0.10.0

type BehaviorOrderRefusal struct {
	Code   string
	Reason string
	Span   source.Span
}

BehaviorOrderRefusal records why a lowered order cannot constrain execution.

type Binding

type Binding struct {
	Ends  [2]BindingEnd
	Scope *symbols.Scope
	Decl  *ast.Usage
	// Multiplicity is the connector's own as written (`binding [1] bind …`), nil when none.
	Multiplicity *ast.Multiplicity
}

Binding is a lowered binding connector with its two endpoint expressions and the scope in which those expressions were declared.

func EndValueBindings added in v0.12.1

func EndValueBindings(decl ast.Node, scope *symbols.Scope) []Binding

EndValueBindings lowers each `=` or `default =` in a connector end's body as a binding of the end's feature to the value expression (SysML v2 §7.13.4, an implicit binding; a default yields to own values).

func NamespaceBindings added in v0.10.0

func NamespaceBindings(scope *symbols.Scope) []Binding

NamespaceBindings lowers the binding connectors a namespace scope owns directly. ToBindings reads a declaration's members, which a package or namespace body is not, so bindings owned there are collected from the scope's own symbols.

func ToBindings

func ToBindings(decl ast.Node, scope *symbols.Scope) []Binding

ToBindings lowers binding connectors directly declared by a type or usage. Namespace-owned bindings are intentionally left to callers to exclude.

func (Binding) ThroughEnds added in v0.12.0

func (b Binding) ThroughEnds(roots map[string]string, owned map[string]bool, self Hop) (Binding, bool)

ThroughEnds re-roots a path at what roots maps its head to and leads an expression end, a path through a feature owned names, or one already on a connector object, to the connector at self; false if it cannot.

type BindingEnd

type BindingEnd struct {
	Path string
	Expr ast.Node
	// Index selects one element of the feature Path reaches (`xs#(2)`), nil for the whole feature.
	Index        ast.Node
	Multiplicity *ast.Multiplicity
	// Via leads from the binding's holder to the connector object an expression or a path end is
	// read on, empty for the holder itself; Default marks the expression of a `default =` value.
	Via     []Hop
	Default bool
}

BindingEnd is one binding endpoint. Path is the runtime lvalue path, empty for an end that is read as an expression — an indexed end `xs#(2)` selects one element of a feature and is no feature to write through; Expr retains the lossless expression for diagnostics and calc evaluation; Multiplicity is the end multiplicity as written (`bind [0..1] a = b`), nil when none.

func (BindingEnd) HolderPath added in v0.12.1

func (e BindingEnd) HolderPath() string

HolderPath is the feature path the end reaches from the binding's holder: empty for an expression, or a path read on a connector object Via leads to.

type Block

type Block struct {
	Statements []Statement
	Node       ast.Node // the loop or branch the block belongs to
	// Order is the lowered statement order for a calculation or constraint block.
	// Action blocks leave it nil and derive their order from the enclosing graph.
	Order *StatementOrder
	// Scope is the block's own scope, which its declarations, and a loop's
	// condition, resolve in.
	Scope *symbols.Scope
	// Graph is the block's own token flow, present where a member of the block is
	// an action node rather than a statement — a nested action declaration, a
	// `perform` — which only a flow of its own executes with the succession
	// semantics it has (block_graph.go). Statements is empty for such a block: the
	// statements are the bodies of the flow's nodes.
	Graph *ActionGraph
	// Own marks the flow a case body states of its own (case_body.go), which runs
	// in the body's frame rather than a block's so its results read what it left.
	Own bool
	// Stated marks Graph as the token flow the body's successions, control nodes
	// or accepts state; unset, Graph runs the body's steps in declaration order.
	Stated bool
}

Block is a lowered body-local statement list: the body of a loop or of one branch of a conditional. It is a namespace of its own (symbols/builder.go), so the names its Declare statements introduce do not leak out of it.

func (Block) Steps

func (block Block) Steps() []Statement

Steps returns the statements the block runs, wherever they live: its statement list, or the bodies of the nodes of its own token flow, in declaration order.

type Channel

type Channel struct {
	Signal  string
	Port    string
	Type    *ast.QualifiedName
	Message ast.Node
	Scope   *symbols.Scope
	Via     bool
	Drops   bool
	Own     bool
}

Channel is one message a move sends or waits for: the signal type as written ("" for any) and the port it travels through ("" for none). Type is the accept's type reference and Message the send's message, each resolving in Scope; Via marks a send routed by connections, Drops a machine's dispatch, which may discard a message sent to its object. Own marks a send naming no target, for the sending object.

func (Channel) String

func (c Channel) String() string

type ChannelsMeet added in v0.10.0

type ChannelsMeet func(a Channel, aSends bool, b Channel, bSends bool) bool

ChannelsMeet reports whether a message operation of one move may not commute with one of another: each channel with whether it sends.

type ClassifierBehavior

type ClassifierBehavior struct {
	Kind ClassifierBehaviorKind
	// Name is the name the behavior answers to on the object, which is the
	// effective name of the declaration binding it.
	Name string
	// Decl is the `exhibit`/`perform` declaration itself.
	Decl *ast.Usage
	// StatesBody reports whether Decl states the behavior's body. A declaration
	// that states none names the element that holds one instead.
	StatesBody bool
	// NamesBehavior reports whether Decl names the element holding the body: the
	// reference form (`perform a;`, `exhibit m;`), a `references`/`::>` clause
	// or a typing. A declaration naming none is the body itself
	// (SysML v2 §8.3.16, eventOccurrence; §8.3.17, performedAction/exhibitedState).
	NamesBehavior bool
	// Arguments are the values the declaration binds to the behavior's
	// parameters (`exhibit m { in controller = vehicleController; }`), in
	// declaration order.
	Arguments []Attribute
}

ClassifierBehavior is a behavior every object of a type runs because the type exhibits or performs it: the declaration that binds it, whether that declaration states a body of its own or names an element holding one, and the values it binds to the behavior's parameters.

func ClassifierBehaviorOf

func ClassifierBehaviorOf(member ast.Node) (ClassifierBehavior, bool)

ClassifierBehaviorOf reports the behavior a type's member binds to every object of that type, and false for a member that binds none: a state or action a type merely owns is not one its objects run.

func ClassifierBehaviorsOf

func ClassifierBehaviorsOf(members []ast.Node) []ClassifierBehavior

ClassifierBehaviorsOf reports the behaviors the given members bind, in declaration order.

func StartableBehaviorOf

func StartableBehaviorOf(member ast.Node) (ClassifierBehavior, bool)

StartableBehaviorOf reports the behavior a type's member holds for its objects to start: one the type exhibits or performs, or an action or state usage it merely declares (`action beh : Beh;`), which an object runs once a `perform obj.beh.start` starts it and not before.

type ClassifierBehaviorKind

type ClassifierBehaviorKind int

ClassifierBehaviorKind is how a type binds a behavior to its objects.

const (
	// ExhibitedState is a state machine the type exhibits: `exhibit state m { … }`,
	// `exhibit state m : M;`, `exhibit m;` (SysML v2 §7.16.6, Part::exhibitedStates).
	ExhibitedState ClassifierBehaviorKind = iota
	// PerformedAction is an action the type performs: `perform action a { … }`,
	// `perform action a : A;`, `perform a;` (Part::performedActions).
	PerformedAction
)

func (ClassifierBehaviorKind) String

func (k ClassifierBehaviorKind) String() string

String names the kind in diagnostics.

type Connection

type Connection struct {
	Ends      []string
	Variation string          // variation point the connection is a variant of, empty when it is not
	Variant   string          // name of the variant declaring it, empty when it is not one
	Owner     ConnectionOwner // what declares it, whose selection governs a variant's connection
	Scope     *symbols.Scope  // scope the end paths resolve in, nil when unknown
}

Connection is a lowered connector: the ends it joins, by the name each end resolves to. A `connect a to b` has two ends; a multi-end `connect` has more, and every end is reachable from every other.

A connection a `variant interface` declares joins its ends only where that variant is the one selected, so it carries the variation it belongs to, its own name, and what owns it: routing must ask what that owner bound the variation to before delivering through it (SysML v2 §7.20).

An end keeps the whole path it was written as (`sensor.out`, `p.q`), so a nested port is joined as itself and not as a same-named port elsewhere; Scope is where those paths resolve, which is what routing asks to learn the direction an end's flow features carry.

func ToObjectConnections

func ToObjectConnections(decl ast.Node, scope *symbols.Scope) []Connection

ToObjectConnections lowers the connectors declared in the body of a type an object is of. A `send … via p` of a behavior an object performs routes through the object's connections as well as through the behavior's own, and it is that object's selection that realizes a variant's connection among them.

type ConnectionOwner

type ConnectionOwner int

ConnectionOwner is what a lowered connection belongs to, which decides whose selection governs it when it is a variant's: a behavior activation, or the object performing the behavior.

const (
	// OwnerBehavior marks a connection declared in the behavior's own body.
	OwnerBehavior ConnectionOwner = iota
	// OwnerObject marks a connection declared in the body of a type an object
	// performing the behavior is of.
	OwnerObject
)

type Declare

type Declare struct {
	Name     string
	Value    ast.Node
	Binding  bool
	BodyData bool           // expression-valued state action execution stored as state data
	Node     ast.Node       // the declaration itself, for diagnostics
	Scope    *symbols.Scope // the scope the declaration was written in
	// Symbol is the feature the declaration introduces, which the block's frame
	// binds its value by; nil when no scope declares Node.
	Symbol *symbols.Symbol
}

Declare is a lowered declaration in a body-local block: `attribute i = 0;` written inside a loop or an `if` branch. The name it declares is a member of that block, so the executor binds it in the block's own frame and discards it when the block exits. Value is nil when the declaration carried none.

type DeclareUsage

type DeclareUsage struct {
	Name  string
	Node  *ast.Usage     // the declaration itself, for diagnostics
	Scope *symbols.Scope // the scope the usage was declared in
}

DeclareUsage is a calc usage declared in a body-local block: `calc p : Pair { in k = h; }` written inside a loop or an `if` branch. It states no step of the computation; it declares the usage and marks where it becomes reachable, so the statements after it read its outputs from one evaluation of its body per execution of the block.

type DeferredSignal added in v0.10.0

type DeferredSignal struct {
	// Type names the signal definition, as the annotation writes it.
	Type *ast.QualifiedName
	// Scope is where Type resolves: the annotated state's body.
	Scope *symbols.Scope
}

DeferredSignal is one signal a state defers, as a DeferredEvent annotation on the state names it: `@MigrationMetadata::DeferredEvent { ref :>> signal : Sig; }`.

func DeferredSignals added in v0.10.0

func DeferredSignals(resolver *resolve.Resolver, scope *symbols.Scope, usage *ast.Usage) []DeferredSignal

DeferredSignals reads the signals a state usage defers, for the scope it was written in: one per DeferredEvent annotation whose body types its `signal`, in declaration order, each with the state's body scope, where the body reads. Detection is by resolved annotation type, never by the annotation's spelling.

type DeferredSubflow added in v0.11.0

type DeferredSubflow struct {
	// contains filtered or unexported fields
}

DeferredSubflow is a typed action body nested in its own type, lowered when a performance of the node first starts: eagerly, unfolding it would never end.

type Effect

type Effect struct {
	Kind  EffectKind
	Node  ast.Node
	Scope *symbols.Scope // the scope the statement was declared in
	// Terminates says what a terminate ends; Target is the action node it names
	// (TerminateNode), TargetExpr the target as written, nil for none. For a
	// start, Target is the behavior started (`obj.beh`) and TargetExpr its `start`.
	Terminates TerminateTarget
	Target     ast.Node
	TargetExpr ast.Node
}

Effect is a statement acting on the world outside the body — perform, accept, terminate, start — lowered so a host rejecting it (a calculation) can say so.

type EffectKind

type EffectKind int

EffectKind names a statement that acts on the world outside the body it stands in.

const (
	EffectPerform EffectKind = iota
	EffectAccept
	EffectTerminate
	// EffectStart is `perform obj.beh.start;`: the behavior the chain names begins on
	// its object and runs on its own, the statement done once it has started.
	EffectStart
)

func (EffectKind) String

func (k EffectKind) String() string

type EndpointResolver

type EndpointResolver interface {
	// Endpoint returns the declaration an endpoint names, written in scope, and
	// whether it names a vertex at all. target is a name or a feature chain (`c.c1`).
	Endpoint(scope *symbols.Scope, target ast.Node) (decl ast.Node, ok bool)
}

EndpointResolver resolves the vertex a transition endpoint names, implemented by the name-resolution tier (*resolve.Resolver) so lowering matches no names itself.

func NewLibraryStateTypes

func NewLibraryStateTypes(resolver *resolve.Resolver) EndpointResolver

NewLibraryStateTypes is the LibraryStateTypes over resolver, nil without one: lowering then names its endpoints from the scope tree alone.

type EntryTransition

type EntryTransition struct {
	// Decl is the member as written: a TransitionMember, a SuccessionEdge, a
	// succession usage or a `first start then s;` marker.
	Decl ast.Node
	// Guard is nil for an unconditional entry transition.
	Guard  ast.Node
	Target *ast.StateNode
	Via    *ast.PseudostateNode
	Effect []StateBehavior
	// Scope is the scope Guard resolves in.
	Scope *symbols.Scope
}

EntryTransition is a transition out of a body's entry action. Alternatives are kept in declaration order, the order the guards are tried in.

type EntryTransitionShapeError

type EntryTransitionShapeError struct {
	Transition *ast.TransitionMember
}

EntryTransitionShapeError marks a triggered or shorthand effect transition out of the entry action.

func (*EntryTransitionShapeError) Error

func (e *EntryTransitionShapeError) Error() string

type EntryTransitionTargetError

type EntryTransitionTargetError struct {
	Target ast.Node
}

EntryTransitionTargetError marks a transition out of the entry action whose target is not a state or an allowed junction/choice.

func (*EntryTransitionTargetError) Error

type Feature

type Feature struct {
	Name      string
	Direction ast.FeatureDirection
	IsResult  bool // a `return` parameter, what the node stands for read as a value
	Value     ast.Node
	Binding   bool
	Node      ast.Node // the declaration, for diagnostics
	Scope     *symbols.Scope
	// Shadowed marks an inherited feature a same-named nearer feature hides without
	// redefining it; Name is then its ShadowedKey (see Attribute.Shadowed).
	Shadowed bool
}

Feature is one parameter or attribute an action node declares itself. Value is its declared value (nil when none), resolving in Scope, the node's scope.

func (Feature) Output added in v0.9.2

func (f Feature) Output() bool

Output reports whether the feature is written back rather than read: an `out` or `return` parameter.

type Flow added in v0.12.0

type Flow struct {
	Reads  []Place
	Writes []Place
}

Flow is one statement's data flow: its writes stand on its reads.

type FlowKind

type FlowKind int

FlowKind is how a data flow carries its values: streaming, as a `flow` is unless designated otherwise (Flows::Flow), or as a succession flow (Flows::SuccessionFlow).

const (
	// FlowStreaming delivers each value the source pin takes to the target's ongoing
	// performances, or ahead of its next one while none is under way.
	FlowStreaming FlowKind = iota
	// FlowSuccession delivers the value the source pin holds once the source
	// completes, and the target begins no sooner.
	FlowSuccession
)

func (FlowKind) String

func (k FlowKind) String() string

String names the kind as the notation spells it.

type Footprint

type Footprint struct {
	Reads      []Place
	Writes     []Place
	Sends      []Channel
	Accepts    []Channel
	Control    []ast.Node
	Completion bool
	Dynamic    bool
	Creates    bool
	Routes     bool
	// Flows are the data flows of the move's statements, one each: what the
	// statement writes stands on what it reads. None for a move described whole.
	Flows []Flow
}

Footprint is what one atomic move (one token advancing one node, one transition firing) may touch. Control lists the joins and merges it arrives at; Completion marks a move that may queue a completion event; Dynamic an unresolved target. Creates marks a move that may create an object starting no behavior; Routes one sending through connections, which reads whatever the objects' structure holds.

func ConstraintBodyFootprint added in v0.10.0

func ConstraintBodyFootprint(scope *symbols.Scope, stmts []Statement) Footprint

ConstraintBodyFootprint projects the reads and writes of one constraint performance, marking declarations in its body-local scopes as local.

func ExpressionFootprint added in v0.11.0

func ExpressionFootprint(resolver *resolve.Resolver, sem *semantics.Model, scope *symbols.Scope, expr ast.Node) Footprint

ExpressionFootprint is what evaluating expr in scope reads: the places a guard or condition depends on, dynamic where the declarations do not decide them.

func FlowFootprint added in v0.10.0

func FlowFootprint(graph *ActionGraph) Footprint

FlowFootprint is what running the flow may touch: every node's footprint and those of the flows its nodes own; a node performing an action is dynamic.

func (Footprint) Dependent

func (f Footprint) Dependent(g Footprint) bool

Dependent reports whether the two moves may not commute: a data race, both touching the bus (a send meeting an accept, two accepts competing for one message, two sends ordering it), both queuing a completion, convergence on one join or merge, creation meeting creation or an extent, routing meeting a structural write, or a dynamic target.

func (Footprint) DependentBy added in v0.10.0

func (f Footprint) DependentBy(g Footprint, rel Relation) bool

DependentBy is Dependent under what rel knows of the moves' executors.

func (Footprint) PlacesEqual added in v0.12.1

func (f Footprint) PlacesEqual(g Footprint) bool

PlacesEqual reports whether the two footprints read and write the same places by the same statements, so one Standing serves both.

func (Footprint) Standing added in v0.12.1

func (f Footprint) Standing() *Standing

Standing indexes the footprint's flows by what they read and write.

func (Footprint) String

func (f Footprint) String() string

String renders the footprint one clause per line, names sorted, for tests and the checker's report.

type ForkPlan

type ForkPlan struct {
	Owner    *ast.StateNode
	Branches map[*ast.StateRegion]*Transition
}

ForkPlan is where a fork's branches lead: one per orthogonal region of Owner, each region starting at its branch's target after the branch's effect.

func (*ForkPlan) Targets

func (p *ForkPlan) Targets() map[*ast.StateRegion]*ast.StateNode

Targets is the state each region starts in.

type Hop added in v0.12.1

type Hop struct {
	Feature   string
	Anonymous *ast.Usage
}

Hop is one step from a holder to a connector object it holds: by feature name, or by the declaration of an anonymous connector member.

func (Hop) Reaches added in v0.12.1

func (h Hop) Reaches() bool

Reaches reports a hop that leads somewhere: a named feature or an anonymous declaration.

type If

type If struct {
	Condition ast.Node
	Then      Block
	Else      *Block
	Node      ast.Node       // the conditional itself, for diagnostics
	Scope     *symbols.Scope // the scope the conditional, and so its condition, was declared in
}

If is a lowered conditional. The condition is evaluated in the enclosing body, outside both branches. Else is nil when the conditional declared none.

type Inherited

type Inherited struct {
	Decl ast.Node
	Body *symbols.Scope
}

Inherited is a declaration a graph took content from besides the one lowered (a definition typing or specializing it or a state of it); Body is its body's scope.

type Integrator

type Integrator int

Integrator is a fixed-step integration scheme the runtime provides for Integrate.

const (
	// IntegratorUnstated leaves the scheme to the run's default.
	IntegratorUnstated Integrator = iota
	IntegratorEuler
	IntegratorRK4
)

func (Integrator) String

func (i Integrator) String() string

String names the integrator as the library does.

type JoinPlan

type JoinPlan struct {
	Owner   *ast.StateNode
	Regions map[*Transition]*ast.StateRegion
}

JoinPlan is where a join's incoming segments come from: Regions maps each to the orthogonal region of Owner it leaves, Owner being the innermost state all the sources lie below, nil when only the machine's own regions do.

type LibraryStateTypes

type LibraryStateTypes struct {
	*resolve.Resolver
	// contains filtered or unexported fields
}

LibraryStateTypes lowers a state machine through the name-resolution tier, so a definition in another document contributes, withholding States::StateAction's content.

func (*LibraryStateTypes) StartShot

func (s *LibraryStateTypes) StartShot(decl ast.Node) bool

StartShot reports the library StateAction's own `start`, the shot every state inherits: a declaration elsewhere under that name is no start shot.

func (*LibraryStateTypes) WithholdsStateType

func (s *LibraryStateTypes) WithholdsStateType(decl ast.Node) bool

WithholdsStateType reports the library's StateAction, whose content lowering must not take: TypeDecl still resolves it, so lowering looks no further.

type Loop

type Loop struct {
	Kind      ast.LoopKind
	Condition ast.Node // nil for `for`, and for a `loop` written without `until`
	// Until is the condition a `while` loop's `until` clause tests after each
	// iteration (`while c { … } until d;`), nil when it carries none.
	Until      ast.Node
	Variable   string   // `for` only: the name each element is bound to
	Collection ast.Node // `for` only: the collection iterated over
	Body       Block
	// BodyAction is the action usage the loop declares as its body (`loop action
	// body { … }`), nil for a body of statements alone.
	BodyAction *symbols.Symbol
	Node       ast.Node // the loop itself, for diagnostics
	// Scope is the scope the loop was declared in, which its collection resolves
	// in; its condition resolves in Body.Scope, which the body declares into.
	Scope *symbols.Scope
}

Loop is a lowered loop statement. Kind says when the condition is tested: before each iteration (`while`), after each iteration (`loop … until`), or not at all, iteration being driven by a collection (`for`).

Condition and Collection stay expressions because their values are only known at execution time. The iteration count is bounded by the executor's step budget, so a loop that never terminates fails the run rather than hanging it.

type ObjectFlow

type ObjectFlow struct {
	// Name is the flow's own name, when it was declared with one
	// (`flow generateToAmplify from a.out to b.in;`), and "" for the anonymous
	// form and for a flow the notation writes as an edge.
	Name      string
	SourcePin string
	TargetPin string
	Target    ast.Node
	// Kind is how the flow carries its values, as its declaration designated.
	Kind FlowKind
	// Decl is the declaration the flow was written as, for a consumer that
	// reports where it comes from.
	Decl ast.Node
	// Gate is the succession whose target is this succession flow
	// (`first a if g then f;`): the flow moves its value only when that succession is taken.
	Gate ast.Node
}

ObjectFlow represents a data flow edge between pins.

type PerformedType added in v0.10.0

type PerformedType struct {
	Target *ast.QualifiedName
	Scope  *symbols.Scope
}

PerformedType is an action invocation inherited through action-node redefinition, resolved where the redefined node was declared.

type PinBinding

type PinBinding struct {
	Node      ast.Node
	Path      []ast.Node
	Pin       string
	Other     ast.Node
	OtherNode ast.Node
	OtherPath []ast.Node
	OtherPin  string
	// OtherChain is the chain the other end walks to the object whose feature
	// OtherFeature it names (`holder.inner.mark`); nil for a node's pin or a plain name.
	OtherChain   *AssignTarget
	OtherFeature string
	// OtherOwner is the qualifier's symbol when the other end was qualified
	// (`Bench::level`), and OtherFeatureSym the feature it names.
	OtherOwner      *symbols.Symbol
	OtherFeatureSym *symbols.Symbol
	// OtherParameter is the parameter of the action itself the other end names
	// (`toast`, `ToastBread::bread`, one a usage inherits from its type), "" for
	// an end naming none; the action's own frame holds that pin.
	OtherParameter string
	Scope          *symbols.Scope // the scope the binding was written in
	Decl           *ast.Usage
	// FromValue marks the binding a pin's own value states (`inout n = ticks;`): the
	// value is the pin's initial value alone when no feature around the node holds it.
	FromValue bool
}

PinBinding is a binding connector with an end at pin Pin of Node — or, where Path is set, of the node Path reaches under it through the flows each owns (`leg.inner.v`: Node leg, Path [inner], Pin v). Other is the other end as written; OtherNode, OtherPath and OtherPin name the node pin it addresses, if any.

func PerformedPinBindings added in v0.11.0

func PerformedPinBindings(graph *ActionGraph, prefix []string, bindings []Binding) ([]PinBinding, error)

PerformedPinBindings lowers the bindings an object writes through the feature it performs graph as (`bind run.measure.report = theReport;`, prefix [run]) to pin bindings of graph's nodes, as the same bindings written in the action's body lower. Scope stays the object's, so the other end resolves where it was written.

type Place

type Place struct {
	Sym    *symbols.Symbol
	Name   string
	Local  bool
	State  *ast.StateNode
	Direct bool
	Via    *symbols.Symbol
	// Node is the node whose pin the place is, each performance of a node holding
	// its own; nil for a feature or a declaration's own value.
	Node ast.Node
}

Place is one feature a move reads or writes: the declaration the name resolves to (nil when unresolved) and the name; Local marks a pin, held per performance. State marks the activity of a state, which a transition reads and writes. Direct marks a name written alone, not reached through a chain or qualified. Via is the feature whose value holds the one a chain names (`left` in `left.raw`), nil for a name reached no such way; whether two such places hold one value is the run's to decide (features may alias), so Conflicts ignores it.

func (Place) Conflicts

func (p Place) Conflicts(q Place) bool

Conflicts reports whether the two places may name one value: places resolving to one declaration do under any of its names (a short name, a redefined name), as do same-named places, except two distinct pins, which each performance holds its own of; the activity of a state meets only itself.

func (Place) String

func (p Place) String() string

String renders the place as the name it was written under.

type Probability

type Probability struct {
	Expr ast.Node
	// Node is the annotation, for the span a message about the weight points at.
	Node ast.Node
}

Probability is the weight a succession's `@Probability { p = ...; }` states for its branch: the expression bound to p, read where the succession's guard is.

func (*Probability) Constant

func (p *Probability) Constant() (float64, bool)

Constant is the weight when its expression is a number computed from literals alone (0.7, 1 - 0.3); a weight computed from features is known only when drawn.

func (*Probability) Span

func (p *Probability) Span() source.Span

Span is where the annotation is written.

type ProbabilityError

type ProbabilityError struct {
	Node   ast.Node
	Reason string
}

ProbabilityError reports Probability metadata the lowering cannot give a meaning: at what node, and why.

func (*ProbabilityError) Error

func (e *ProbabilityError) Error() string

func (*ProbabilityError) Is

func (e *ProbabilityError) Is(target error) bool

Is makes every ProbabilityError match ErrProbability.

func (*ProbabilityError) Span

func (e *ProbabilityError) Span() source.Span

Span is where the offending annotation or succession is written.

type Relation added in v0.10.0

type Relation struct {
	Channels ChannelsMeet
	Apart    bool
	Objects  bool
	Held     func(p, q Place) bool
}

Relation is what is known of the executors two moves belong to. Channels decides which message operations meet, nil having every two meet. Apart marks two executors, each converging on control nodes of its own; Objects two run for two objects, each holding its own pins and state activity, and Held, where set, reports whether a direct place of the first move's and one of the second's are slots of different objects.

func (Relation) PlaceMeet added in v0.12.1

func (rel Relation) PlaceMeet(p, q Place) bool

PlaceMeet reports whether p, a place of the first move's, may name the value of q, a place of the second's.

type Return

type Return struct {
	Value ast.Node
	Node  ast.Node       // the return itself, for diagnostics
	Scope *symbols.Scope // the scope the returned expression was written in
}

Return is a lowered `return`: the value the enclosing behavior computes, possibly from inside a block. Value is nil when it named no expression.

type RunToCompletion

type RunToCompletion struct {
	// Value is the isRunToCompletion expression, nil for the default true.
	Value ast.Node
	// ValueScope resolves names in Value.
	ValueScope *symbols.Scope
	// ValueOwner owns Value's state data; nil denotes the machine.
	ValueOwner *ast.StateNode
	// Scope is the state named by runToCompletionScope; nil denotes the machine.
	Scope *ast.StateNode
}

RunToCompletion is the effective run-to-completion configuration of a body.

type RunToCompletionRedefinition

type RunToCompletionRedefinition struct {
	// Feature is the redefined run-to-completion feature.
	Feature string
	// Decl is the redefinition declaration.
	Decl *ast.Usage
	// Owner describes the body containing the declaration.
	Owner string
	// Written is the value as written.
	Written string
	// NotAncestor reports a resolved state outside the current state ancestry.
	NotAncestor bool
}

RunToCompletionRedefinition reports a redefinition of runToCompletionScope the graph cannot resolve to this machine or an enclosing state.

func (*RunToCompletionRedefinition) Error

func (*RunToCompletionRedefinition) Unwrap

func (e *RunToCompletionRedefinition) Unwrap() error

Unwrap makes the refusal match ErrUnsupportedStateContent, the error every other state content lowering cannot represent reports.

type Send

type Send struct {
	Message   ast.Node
	Target    string
	TargetSym *symbols.Symbol
	Node      ast.Node
	// TargetPath records that Target is a feature chain (`a.b`) reaching through
	// the sender's features, rather than a name in a namespace (`R`, `P::R`).
	TargetPath bool
	// TargetExpr is the receiver expression of an addressed send as written; the
	// runtime evaluates it to objects where Target carries no name or path.
	TargetExpr ast.Node
	IsVia      bool
	// ViaSelf records a via path written from `this`, whose root is a feature of
	// the sender even where the behavior binds that name to another object.
	ViaSelf bool
	// Receiver is the name addressed by a routed send, empty when omitted.
	Receiver     string
	ReceiverPath bool
	// ReceiverExpr is the `to` expression of a routed send, likewise evaluated to
	// objects where Receiver carries no name the sender resolves.
	ReceiverExpr ast.Node
	Scope        *symbols.Scope // the scope the statement was declared in
}

Send is a lowered send statement. Message stays an expression because its value is only known at execution time.

Target is the name the send addressed, empty for a broadcast. IsVia records that the name is a port of the sender rather than a receiver, in which case it is the whole path the port was written as and the message goes to whatever the graph's Connections join that port to.

TargetSym is the feature a via target resolves to where it was written, so routing matches the feature the name denotes rather than the name alone: a port a behavior declares under a connected port's name shadows that port. It is nil where the scope tree alone does not resolve the path.

type SequenceEvent added in v0.11.0

type SequenceEvent struct {
	Symbol   *symbols.Symbol
	Lifeline *symbols.Symbol // nil for a nested interaction use
	Use      bool
	Performs []*symbols.Symbol
	Asserts  []Assert
	// Sends and Receives are the transfers leaving and reaching the event, in declaration order.
	Sends, Receives []*Transfer
	// contains filtered or unexported fields
}

SequenceEvent is one node of the interaction: an event occurrence a lifeline holds, with the actions its body performs when the event occurs (`perform action spinCall ::> Motor::spin`) and the constraints it asserts hold there; or, with Use set, an occurrence usage of a nested interaction performed at its place.

func (*SequenceEvent) Text added in v0.11.0

func (ev *SequenceEvent) Text() string

Text names the node: an event as its lifeline's member, a use by its name.

type SequenceGraph added in v0.11.0

type SequenceGraph struct {
	Decl  ast.Node
	Scope *symbols.Scope
	// Bodies are the bodies the occurrence's members are read from: its own, then
	// those of the types it is typed by or specializes, nearest first.
	Bodies    []*symbols.Scope
	Lifelines []*symbols.Symbol
	// Events are the nodes of the interaction in declaration order: the event
	// occurrences of the lifelines and the occurrence usages of nested interactions.
	Events []*SequenceEvent
	Orders []SequenceOrder
	// Order is the nodes in realization order: topological over the stated
	// orders and each message's own send-before-receive, ties broken by
	// declaration order. A transfer is posted at its source event and taken at
	// its target event; a nested interaction is performed at its place.
	Order []*SequenceEvent
	// Transfers are the messages in the order they are taken, which is the order
	// of their target events.
	Transfers []*Transfer
}

SequenceGraph is an occurrence definition or usage lowered as an interaction: the lifelines (the usages of its body holding event occurrences), the events each holds, the nested interactions its body uses, the orders the model states between them, and its messages as transfers in the order the events admit. A message is abstract (SysML v2.1 §7.16.2) and is realized by a transfer between its two ends (§7.16.1). A usage typed by an occurrence def (`occurrence spinup : Spinup { ref part :>> c = ctrl; }`) inherits the def's lifelines, events and messages; a member of its own body hides the inherited member of its name.

func ToSequenceGraph added in v0.11.0

func ToSequenceGraph(sym *symbols.Symbol, resolver *resolve.Resolver) (*SequenceGraph, error)

ToSequenceGraph lowers an occurrence definition or usage read as an interaction. The resolver resolves the ends and the typing; nil lowers a body whose ends are all simple names of the occurrence's own members and reads no inherited body.

type SequenceOrder added in v0.11.0

type SequenceOrder struct {
	From, To *SequenceEvent
	Decl     ast.Node
}

SequenceOrder is one order stated between two nodes: a member-attached `then` or a `succession first a then b;`.

type Standing added in v0.12.1

type Standing struct {
	Reads  []Place
	Writes []Place
	// contains filtered or unexported fields
}

Standing is a footprint indexed for the many questions classifying a choice asks of one move: whether a place meets a read of it, and what it writes standing on the reads met, each distinct place its statements read decided once.

func (*Standing) WritesReading added in v0.12.1

func (s *Standing) WritesReading(meets func(Place) bool) ([]Place, bool)

WritesReading reports whether a place among Reads is met, and if so the places the move writes standing on a read of a place met: the writes of the statements reading one, or every write of the move when a read outside its statements (a guard's) or a move described whole does. The places are valid until the next call.

type StartShotResolver

type StartShotResolver interface {
	StartShot(decl ast.Node) bool
}

StartShotResolver identifies the library's inherited `start` shot, the one declaration a `first start then s;` may leave from without naming a vertex.

type StateBehavior

type StateBehavior struct {
	// Node is the behavior's declaration, unwrapped of the membership the parser
	// puts it in, and is what a diagnostic about it names.
	Node ast.Node
	// Name is the name the behavior was declared with, "" for an anonymous one.
	Name string
	// Body are the behavior's statements in declaration order. An inline action
	// body is one block, since it is a namespace of its own; every other form
	// lowers to the one statement it states.
	Body []Statement
	// Nodes are the action nodes the blocks of Body declare, in declaration order,
	// each of which performs as a subperformance of the behavior's.
	Nodes []ast.Node
	// Multiplicities are the declared action-node multiplicities in Body.
	Multiplicities map[ast.Node]*ast.Multiplicity
	// Multiplicity is a declaration on the entry, do or exit behavior itself.
	Multiplicity *ast.Multiplicity
	// Scope is the scope the behavior was declared in, which its own statements
	// and the action name it performs resolve in.
	Scope *symbols.Scope
	// Owner is the state whose attributes the behavior reads and writes: the
	// state it belongs to, or the source of the transition it is an effect of.
	Owner *ast.StateNode
	// Block is the transition whose body the behavior is one step of, shared by
	// the steps of that body and by no other: a `terminate` in one ends them all.
	// Every other behavior is a performance of its own and has none (nil).
	Block ast.Node
	// Ordered marks a Body whose statements run in the order written where a
	// schedule would otherwise pick it: a terminate node's body, then its terminate.
	Ordered bool
}

StateBehavior is one behavior a state machine performs: an entry, do or exit behavior of a state, or one effect of a transition. Every form it may be written in — an inline action body, an assignment, a send, a performed action — is lowered into the statements the runtime executes.

func LowerBehaviors

func LowerBehaviors(actions []ast.Node, block ast.Node, scope *symbols.Scope, resolver *resolve.Resolver) []StateBehavior

LowerBehaviors lowers the actions of an entry, do or exit member, or the effects of a transition, in the scope they were declared in; block is the transition whose body they are the steps of, nil for any other. resolver is the name-resolution tier's, by which a body's Probability metadata is read (ToActionGraphWith).

type StateBehaviors

type StateBehaviors struct {
	Entry []StateBehavior
	Do    []StateBehavior
	Exit  []StateBehavior
}

StateBehaviors are the lowered entry, do and exit behaviors of one state, each in declaration order.

type StateGraph

type StateGraph struct {
	// RunToCompletion contains effective RTC values for each state and the
	// machine under the nil key.
	RunToCompletion map[*ast.StateNode]RunToCompletion

	// Scope is the scope the machine's own body was declared in, in which the
	// expressions written directly among its members resolve their names.
	Scope *symbols.Scope

	// Attributes are the attributes the machine declares, in declaration order.
	Attributes []Attribute

	// StateScopes: state → the scope that state's body was declared in, which is
	// what the names in its entry, do and exit behaviors resolve against.
	StateScopes map[*ast.StateNode]*symbols.Scope

	// Behaviors: state → its lowered entry, do and exit behaviors. The executor
	// runs these rather than the state's AST members, so an inline action body is
	// executable statements by the time it is reached.
	Behaviors map[*ast.StateNode]*StateBehaviors

	// HiddenStates are graph-only composite owners synthesized for parallel
	// regions. They execute behaviors but are not user-visible state visits.
	HiddenStates map[*ast.StateNode]bool

	// HiddenRegionOf: graph-only owner → the region it stands for, so a walk up
	// the parent chain crosses it without losing which region a state is in.
	HiddenRegionOf map[*ast.StateNode]*ast.StateRegion

	// RegionState: synthesized region → the graph-only owner standing for it,
	// which holds the attributes the region's body declares.
	RegionState map[*ast.StateRegion]*ast.StateNode

	// Machine is the graph-only root state for the machine's own entry, do and
	// exit behaviors. A parallel machine's regions are TopRegions instead.
	Machine *ast.StateNode

	// States in the machine (flat list, includes nested)
	States []*ast.StateNode

	// Pseudostates of the machine in declaration order. Not keyed by name:
	// sibling regions may declare same-named pseudostates.
	Pseudostates []*ast.PseudostateNode

	// PseudostateOwner: pseudostate -> the composite state that declares it,
	// absent for one declared directly in the machine. A history pseudostate
	// restores the configuration of its owner, so the owner must survive lowering.
	PseudostateOwner map[*ast.PseudostateNode]*ast.StateNode
	// PseudostateRegion is the region its outgoing route segments run within, if any.
	PseudostateRegion map[*ast.PseudostateNode]*ast.StateRegion

	// Terminates are the machine's terminate action usages (`action stop terminate;`)
	// in declaration order: a transition ending at one ends the machine's performance.
	Terminates []*ast.Usage

	// TerminateOwner: terminate action usage -> the composite state that declares
	// it, absent for one declared directly in the machine.
	TerminateOwner map[*ast.Usage]*ast.StateNode

	// TerminateBehaviors: terminate action usage naming an occurrence (`action
	// halt terminate worker;`) -> the behavior a transition ending at the usage
	// performs in place of ending the machine: the usage's body, then the terminate.
	TerminateBehaviors map[*ast.Usage]StateBehavior

	// TerminateCompletion: terminate action usage naming an occurrence -> the
	// completion vertex of the body declaring it, which a transition ending at
	// the usage enters once its behavior has run, as one to `done` does.
	TerminateCompletion map[*ast.Usage]*ast.StateNode

	// Transitions: source node (StateNode or PseudostateNode) → list of transitions
	Transitions map[ast.Node][]*Transition

	// CompositeStates: state → regions
	CompositeStates map[*ast.StateNode][]*ast.StateRegion

	// CompositeStateOrder preserves declaration order for deterministic runtime
	// selection of an active composite owner.
	CompositeStateOrder []*ast.StateNode

	// RegionInitials: region → initial state, nil when default entry leaves it inactive.
	RegionInitials map[*ast.StateRegion]*ast.StateNode

	// ParentState: child → parent
	ParentState map[*ast.StateNode]*ast.StateNode

	// RegionOwner: region → owning composite state
	RegionOwner map[*ast.StateRegion]*ast.StateNode

	// TopRegions are the machine's own orthogonal regions, in declaration order.
	// The order is observable: it is the order regions are entered and exited in.
	TopRegions []*ast.StateRegion

	// RegionOf: state → the region that declares it (fork/join need the region a
	// target belongs to)
	RegionOf map[*ast.StateNode]*ast.StateRegion

	// InitialState (required for simple machines, nil for multi-region)
	Initial *ast.StateNode

	// EntryTransitions: the body a transition out of the entry action is written
	// in (a state, a region, nil for the machine's own body) → those transitions in
	// declaration order; the first whose guard holds names the state it starts in.
	EntryTransitions map[ast.Node][]*EntryTransition

	// ForkPlans: fork → where its branches lead, checked when the graph is built.
	ForkPlans map[*ast.PseudostateNode]*ForkPlan

	// ForkEntered: region → the forks whose branches enter it, in declaration order.
	ForkEntered map[*ast.StateRegion][]*ast.PseudostateNode

	// JoinPlans: join → where its segments come from, checked when the graph is built.
	JoinPlans map[*ast.PseudostateNode]*JoinPlan

	// Connections are the connectors declared in the state machine body, which
	// is how a `send ... via <port>` in an entry/do/exit/effect action finds the
	// ports it reaches.
	Connections []Connection

	// StateAttributes: state → the attributes it owns, its own and those it
	// inherits from the definition typing it. Each state owns its values, so two
	// usages of one definition hold two sets of them.
	StateAttributes map[*ast.StateNode][]Attribute
	// contains filtered or unexported fields
}

StateGraph is the execution IR for state machines.

func ToStateGraph

func ToStateGraph(stateMachineDecl ast.Node, scope *symbols.Scope) (*StateGraph, error)

ToStateGraph converts a state machine AST (Usage or Definition) to a StateGraph. scope is the scope the machine's body was declared in — the scope the machine itself owns — from which the scope of every state and transition it carries is derived. Its endpoints resolve against the machine's own symbols; a caller holding the name-resolution tier's uses ToStateGraphWithEndpoints instead.

func ToStateGraphWithEndpoints

func ToStateGraphWithEndpoints(stateMachineDecl ast.Node, scope *symbols.Scope, endpoints EndpointResolver) (*StateGraph, error)

ToStateGraphWithEndpoints lowers a state machine, building its transitions from the endpoints the name-resolution tier already resolved.

func (*StateGraph) AttributeScope

func (g *StateGraph) AttributeScope(attr Attribute) *symbols.Scope

AttributeScope is the scope an attribute's value resolves in, which is the body declaring it rather than the machine's when the machine inherits it.

func (*StateGraph) BehaviorFootprint added in v0.11.0

func (g *StateGraph) BehaviorFootprint(behavior StateBehavior) Footprint

BehaviorFootprint is what running the behavior touches: its table entry for an entry, do or exit behavior, computed on first use for a transition's or an entry transition's effect, which the table does not key.

func (*StateGraph) BehaviorFootprints

func (g *StateGraph) BehaviorFootprints() map[ast.Node]Footprint

BehaviorFootprints is entry, do or exit behavior (its Node) → what running it touches, computed on first use as TransitionFootprints is.

func (*StateGraph) BranchFootprints added in v0.11.0

func (g *StateGraph) BranchFootprints() map[*Transition]Footprint

BranchFootprints is segment out of a pseudostate → what taking that branch of a junction or choice may touch, computed on first use as TransitionFootprints is; a pseudostate's branches are segments of the transitions into it, so they are not among TransitionFootprints.

func (*StateGraph) BranchFootprintsFrom added in v0.11.0

func (g *StateGraph) BranchFootprintsFrom(origin *ast.StateNode, segs []*Transition) []Footprint

BranchFootprintsFrom is what taking each of segs, the branches out of one pseudostate, does for a transition that left origin: the states left and entered, their exit, entry and do behaviors, and the branch's guard, probability and effects, followed through further pseudostates as the transition's own footprint is. The exits every branch shares — origin up to the nearest of the branches' boundaries — are left out, since they happen whichever branch is drawn; a branch into a further pseudostate leaves its boundary unknown, so then nothing is left out.

func (*StateGraph) Completes

func (g *StateGraph) Completes(state *ast.StateNode) bool

Completes reports whether entering state completes the region it belongs to: it is the `done` end shot of the state or machine whose body names it.

func (*StateGraph) DeclOf

func (g *StateGraph) DeclOf(state *ast.StateNode) ast.Node

DeclOf is the declaration state was lowered from: the node the scope tree is keyed by, or the state itself when it was written as one.

func (*StateGraph) DocOf

func (g *StateGraph) DocOf(decl ast.Node) string

DocOf is the document a declaration of the graph was written in: the general's where inherited, else the machine's own; "" outside any document.

func (*StateGraph) EntryOwner

func (g *StateGraph) EntryOwner(owner ast.Node) ast.Node

EntryOwner is the body owner's entry transitions are written in, as EntryTransitions keys it: the region a state of a parallel state stands for, else owner itself.

func (*StateGraph) ForkStarted

func (g *StateGraph) ForkStarted(region *ast.StateRegion) bool

ForkStarted reports whether a fork branch enters region.

func (*StateGraph) Inherited

func (g *StateGraph) Inherited() []Inherited

Inherited lists the declarations the machine's content was materialized from besides its own, each once, in the order lowering first reached them.

func (*StateGraph) IsInitial

func (g *StateGraph) IsInitial(state *ast.StateNode) bool

IsInitial reports whether the machine may start in state: some entry transition of its body names it. Whether it starts there unconditionally is UnconditionalStart's.

func (*StateGraph) JoinSegmentFootprints added in v0.11.0

func (g *StateGraph) JoinSegmentFootprints(join *ast.PseudostateNode, segs []*Transition) []Footprint

JoinSegmentFootprints is what firing each of segs, transitions pending into one join, does on its own once the join fires: its source's activity, trigger and guard read, its effects run, and the states from its source up to the join's owner exited. The owner's exit and the join's way out follow whichever segment fires first, so they are left out of every segment's footprint, as the exits a junction's branches share are; a join without a plan leaves each footprint dynamic.

func (*StateGraph) RegionDeclOf added in v0.11.0

func (g *StateGraph) RegionDeclOf(region *ast.StateRegion) ast.Node

RegionDeclOf is the declaration region was built from: the direct substate of a parallel state or machine that supplies its body, else the region itself.

func (*StateGraph) RunToCompletionOf

func (g *StateGraph) RunToCompletionOf(state *ast.StateNode) RunToCompletion

RunToCompletionOf returns the effective configuration for state, or the machine when state is nil.

func (*StateGraph) Semantics added in v0.12.0

func (g *StateGraph) Semantics() *semantics.Model

Semantics is the semantic model over the graph's resolver, built once and shared by every footprint of the graph; nil without a resolver.

func (*StateGraph) StartOf

func (g *StateGraph) StartOf(owner ast.Node) []*EntryTransition

StartOf returns the transitions out of a body's entry action in declaration order: owner is the state whose body it is, the region, or nil for the machine's own body. A state standing for a region of a parallel state starts where that region's entry transitions say.

func (*StateGraph) StateNamed added in v0.10.0

func (g *StateGraph) StateNamed(scope *symbols.Scope, target ast.Node) (*ast.StateNode, bool)

StateNamed is the state a name or feature chain written in scope (nil: the machine's own) names, as a transition endpoint would name it.

func (*StateGraph) TransitionFootprints

func (g *StateGraph) TransitionFootprints() map[*Transition]Footprint

TransitionFootprints is transition out of a state → what firing it may touch, its route through pseudostates followed along every branch. It is computed from the lowered graph on first use and shared by every caller.

func (*StateGraph) TransitionSteps added in v0.10.0

func (g *StateGraph) TransitionSteps() map[*Transition]TransitionStep

TransitionSteps is transition out of a state → its TransitionStep, computed on first use as TransitionFootprints is.

func (*StateGraph) UnconditionalStart

func (g *StateGraph) UnconditionalStart(owner ast.Node) *ast.StateNode

UnconditionalStart is the state a body starts in whatever its guards say.

type StateRedefinitionResolver

type StateRedefinitionResolver interface {
	RedefinitionTarget(scope *symbols.Scope, decl ast.Node, target ast.Node) (*symbols.Symbol, bool)
	LibraryFeature(sym *symbols.Symbol) bool
}

StateRedefinitionResolver resolves the feature a redefinition written in a state body targets, an alias followed to what it names, and tells the library's own declarations from a model's spelled like them.

type StateSpaceDynamics

type StateSpaceDynamics struct {
	Kind StateSpaceKind
	// Action is the action lowered; Scope its body scope, where its features resolve.
	Action *symbols.Symbol
	Scope  *symbols.Scope
	// State, Input and Output are the protocol's stateSpace, input and output
	// features as the action holds them, the nearest declaration of each.
	State, Input, Output *symbols.Symbol
	// TimeStep and StopTime are the features stating the step and the instant the
	// run stops at, nil where the action declares none; Time, when declared,
	// receives the clock's instant at each step.
	TimeStep, StopTime, Time *symbols.Symbol
	// Derivative is the model's getDerivative (continuous), Difference its
	// getDifference (discrete), OutputCalc its getOutput; each concrete.
	Derivative, Difference, OutputCalc *symbols.Symbol
	// NextState is a getNextState the model bodies itself, which the runner calls
	// in place of the library's; nil when the library's runs natively.
	NextState *symbols.Symbol
	// Integrator is the scheme the model binds to the library's integrate, unstated
	// when it leaves the run's default; IntegratorType is that scheme's declaration.
	Integrator     Integrator
	IntegratorType *symbols.Symbol
	// Crossings are the zero-crossing events the dynamics raise, in declaration order.
	Crossings []ZeroCrossing
}

StateSpaceDynamics is the lowering of an action specializing the library's StateSpaceDynamics: the calcs the model provides for the protocol, how the next state is reached, the features a step reads and writes, and the zero crossings it watches.

func ToStateSpaceDynamics

func ToStateSpaceDynamics(action *symbols.Symbol, scope *symbols.Scope, model StateSpaceModel) (*StateSpaceDynamics, error)

ToStateSpaceDynamics lowers an action specializing one of the library's dynamics into what the runner steps: a member the protocol needs that the model leaves abstract, or an integrator the runtime does not provide, is an ErrUnsupportedStateSpace.

type StateSpaceKind

type StateSpaceKind int

StateSpaceKind tells continuous dynamics, stepped by integrating a derivative, from discrete ones, stepped by adding a difference.

const (
	// NotStateSpace is an action specializing neither dynamics.
	NotStateSpace StateSpaceKind = iota
	ContinuousDynamics
	DiscreteDynamics
)

func StateSpaceKindOf

func StateSpaceKindOf(action *symbols.Symbol, model StateSpaceModel) StateSpaceKind

StateSpaceKindOf classifies an action: the dynamics it specializes, if either.

func (StateSpaceKind) String

func (k StateSpaceKind) String() string

String names the kind as the library does.

type StateSpaceModel

type StateSpaceModel interface {
	// LibrarySymbol is the library declaration of this qualified name, nil when unloaded.
	LibrarySymbol(fqn string) *symbols.Symbol
	// Specializes reports whether sym is general or transitively specializes it.
	Specializes(sym, general *symbols.Symbol) bool
	// MembersOf lists sym's effective members, inherited ones masked by its redefinitions.
	MembersOf(sym *symbols.Symbol) []*symbols.Symbol
	// FeatureTypes lists the types a feature has, declared or along its redefinitions.
	FeatureTypes(sym *symbols.Symbol) []*symbols.Symbol
	// ParameterDefault is the value a feature states along its redefinitions, with its scope.
	ParameterDefault(sym *symbols.Symbol) (ast.Node, *symbols.Scope)
	// LibraryDeclared reports a declaration of a library document, not the model's.
	LibraryDeclared(sym *symbols.Symbol) bool
}

StateSpaceModel answers the semantic questions lowering state-space dynamics asks, so an inherited or redefined protocol member is found where it was declared.

type StateTypeResolver

type StateTypeResolver interface {
	TypeDecl(scope *symbols.Scope, qn *ast.QualifiedName) (ast.Node, *symbols.Scope, bool)
}

StateTypeResolver resolves the declaration a type name reaches and its body scope. Lowering falls back to the scope tree only without one or for a name it cannot resolve.

type StateTypeWithholder

type StateTypeWithholder interface {
	WithholdsStateType(decl ast.Node) bool
}

StateTypeWithholder names resolved declarations whose content lowering must not take. A withheld type is settled: it is never looked up again through the scope tree.

type Statement

type Statement interface {
	// contains filtered or unexported methods
}

Statement is one lowered statement in an action node's body. Statements are kept in declaration order so the executor never walks the node's members again to find them.

func CalcBody

func CalcBody(owner ast.Node, members []ast.Node, scope *symbols.Scope) []Statement

CalcBody lowers the computation a calculation or case body states, in declaration order and in the scope it was written in. A member stating no computation — an input parameter, documentation, a nested definition — is skipped. A result the body declares names the value answered with, not a step, so it runs after the steps; a `return` inside a branch or loop stops the body there. owner is the declaration whose body members are: a case's body whose members include action nodes performs them as its steps, lowered as one Block over the flow they state (caseSteps); a calc's does not. Without a resolver the flow's `@Probability` annotations go unread, as in ToActionGraph; a caller holding one uses CalcBodyWith.

func CalcBodyWith

func CalcBodyWith(owner ast.Node, members []ast.Node, scope *symbols.Scope, resolver *resolve.Resolver) []Statement

CalcBodyWith is CalcBody reading the metadata the resolver identifies: a weighted succession among a case's steps keeps its weight.

func CalcSteps added in v0.10.0

func CalcSteps(body []Statement) []Statement

CalcSteps returns the statements an invocation performs, excluding bindings of output features that are read when their values are needed.

func ConstraintStep added in v0.10.0

func ConstraintStep(member ast.Node, scope *symbols.Scope, resolvers ...*resolve.Resolver) (Statement, bool)

ConstraintStep lowers one member of a constraint body to the step it states, as calcStep does for a calculation body: statements run in declaration order except for precedence stated by successions between steps. false for what a constraint body states other ways: the parameters a check binds (`in x`), the conditions the body exists to hold (expressions and nested constraint, require, assume and assert members), the unnamed bindings a parameter redefinition writes, and members declaring nothing a step can run. Successions between steps supply precedence; other successions and control nodes remain unexecutable because a verdict does not run a token flow.

type StatementOrder added in v0.10.0

type StatementOrder struct {
	// contains filtered or unexported fields
}

StatementOrder is how the statements of one list may run: in runs separated by the statements that keep their place, each run's in any order, of which only those reordering two dependent statements differ.

func BodyStatementOrder added in v0.10.0

func BodyStatementOrder(graph *ActionGraph, node ast.Node, stmts []Statement) *StatementOrder

BodyStatementOrder is the order of stmts, statements of node's body in graph or of a block within it.

func CalcBodyStatementOrder added in v0.10.0

func CalcBodyStatementOrder(scope *symbols.Scope, members []ast.Node, stmts []Statement) *StatementOrder

CalcBodyStatementOrder is the order of a calculation body's statements, including any `then` successions the lowered body states.

func ConstraintBodyStatementOrder added in v0.10.0

func ConstraintBodyStatementOrder(scope *symbols.Scope, stmts []Statement) *StatementOrder

ConstraintBodyStatementOrder is the order of a constraint body's statements.

func (*StatementOrder) Dependent added in v0.11.0

func (o *StatementOrder) Dependent(i, j int, divided bool) bool

Dependent reports whether statements i and j may not commute: their footprints meet, a succession orders them, or, divided, both touch a shared place.

func (*StatementOrder) Footprint added in v0.11.0

func (o *StatementOrder) Footprint(i int) Footprint

Footprint is what statement i touches.

func (*StatementOrder) HasReversePrecedence added in v0.10.0

func (o *StatementOrder) HasReversePrecedence() bool

HasReversePrecedence reports whether an explicit succession runs against declaration order.

func (*StatementOrder) HasSkipped added in v0.10.0

func (o *StatementOrder) HasSkipped() bool

HasSkipped reports whether this order carries any non-executable successions.

func (*StatementOrder) Len added in v0.10.0

func (o *StatementOrder) Len() int

Len is how many statements the order is over.

func (*StatementOrder) Next added in v0.10.0

func (o *StatementOrder) Next(done, blocked []bool, divided bool) []int

Next lists, ascending, the statements that may run next after those done, so that the statements run in the least order, by position, of every class of orders equal up to swapping independent neighbours: each class is reached once. A statement blocked waits for one dependent on it to run first. Empty once all are done.

func (*StatementOrder) NextFixed added in v0.10.0

func (o *StatementOrder) NextFixed(done, blocked []bool, divided bool) []int

NextFixed lists the declaration-least ready statement, respecting explicit precedence without exposing a choice point under a fixed scheduling policy.

func (*StatementOrder) Ran added in v0.10.0

func (o *StatementOrder) Ran(s int, done, blocked []bool, divided bool)

Ran marks s run after those done, unblocking each statement left that depends on it and blocking each before it that does not.

func (*StatementOrder) Reorders added in v0.10.0

func (o *StatementOrder) Reorders(divided bool) bool

Reorders reports whether two of the statements may run in either order with different results: two dependent ones in one run, or with divided set (another performance interleaving between statements), two that both touch what it does.

func (*StatementOrder) Rivals added in v0.10.0

func (o *StatementOrder) Rivals(s int, done []bool, divided bool) []int

Rivals lists, ascending, the statements not done, besides s, that run with s and may not commute with it: those another may run between two moves of s, s once started.

func (*StatementOrder) Skipped added in v0.10.0

func (o *StatementOrder) Skipped(i int) bool

Skipped reports whether i is a succession represented by this order, not a statement to execute.

type StepMultiplicityError added in v0.10.0

type StepMultiplicityError struct {
	Node          ast.Node
	Step          string
	Multiplicity  string
	Code          string
	Reason        string
	Declaration   ast.Node
	InheritedFrom string
	Err           error
}

StepMultiplicityError describes a step multiplicity the executor cannot honor.

func (*StepMultiplicityError) Error added in v0.10.0

func (e *StepMultiplicityError) Error() string

func (*StepMultiplicityError) Unwrap added in v0.10.0

func (e *StepMultiplicityError) Unwrap() error

type Subflow

type Subflow struct {
	Graph *ActionGraph
	Err   error
	// Deferred is set, Graph nil, for a typed body nested in its own type: its
	// flow is lowered once, by Unfold, when a performance of it first starts.
	Deferred *DeferredSubflow
}

Subflow is the flow a nested action node's own members state. Graph is nil when those members state a flow that could not be built, which Err says; the executor reports it at initialize() rather than treating the node as a leaf.

func (*Subflow) Unfold added in v0.11.0

func (s *Subflow) Unfold() (*ActionGraph, error)

Unfold returns the flow the node's performance runs, lowering a deferred body once (per node, on the outermost flow) so every level of a recursion shares it.

type TerminateTarget

type TerminateTarget int

TerminateTarget is what a terminate names, settled where it was written.

const (
	// TerminateContaining is a terminate naming nothing: the containing performance ends.
	TerminateContaining TerminateTarget = iota
	// TerminateEnclosing is a terminate action usage: the performance its node is a step of ends.
	TerminateEnclosing
	// TerminateNode names an action usage (Effect.Target): a node of an enclosing flow,
	// or else the action occurrence the name denotes, evaluated as TerminateOccurrence is.
	TerminateNode
	// TerminateOccurrence names an occurrence by an expression the executor evaluates.
	TerminateOccurrence
)

type Transfer added in v0.11.0

type Transfer struct {
	Message  *symbols.Symbol
	Name     string
	From, To *SequenceEvent
	Payload  *ast.FlowEnds
	// contains filtered or unexported fields
}

Transfer is one message realized as a transfer from the event it leaves to the event it reaches, carrying the payload its `of` clause states.

type Transition

type Transition struct {
	// Name is the transition's own name, when it was written with one
	// (`transition maintain first idle then busy`), and "" when it was not.
	Name string
	// Decl is the declaration the transition was written as, for a consumer that
	// reports where it comes from.
	Decl   ast.Node
	Source ast.Node // *ast.StateNode or *ast.PseudostateNode
	Target ast.Node // *ast.StateNode, *ast.PseudostateNode or a terminate action *ast.Usage
	// Owner is the state whose body declares the transition, nil for the machine body.
	Owner   *ast.StateNode
	Trigger ast.Node // TimeEvent, ChangeEvent, SignalEvent, CallEvent, nil = completion
	// Accepted names what the trigger binds when the transition fires — an accept's
	// payload, a call's parameters — in declaration order; nil binds nothing.
	Accepted []string
	Guard    ast.Node // guard expression, nil = no guard
	// Effect are the transition's effect behaviors, lowered the same way a state's
	// entry, do and exit behaviors are.
	Effect []StateBehavior
	// Via is the port the accepted occurrence must arrive at
	// (`accept Ping via commPort`), and "" when the trigger names no port, in
	// which case an occurrence reaching the machine by any route fires it.
	Via string
	// ViaSelf records a via path written from `this`, whose root is a feature of
	// the performer however the machine's data would resolve the name.
	ViaSelf bool

	// Scope is the scope the transition was declared in, in which the expressions
	// its trigger carries — a time event's duration, a change event's condition —
	// resolve their names.
	Scope *symbols.Scope

	// BodyScope is the scope the transition's guard and effect resolve in. It is
	// Scope, except for a call trigger, whose parameters are visible to the guard
	// and effect and nowhere else (`accept setSpeed(v) if v > 0`).
	BodyScope *symbols.Scope

	// Probability is the weight `@Probability { p = ...; }` states for the
	// transition, read where its guard is; nil when the transition is unweighted.
	Probability *Probability

	// GroupKey is the resolved trigger spelling this transition competes under:
	// TriggerKey returns it when set, else computes the un-resolved spelling.
	GroupKey string
}

Transition represents a state transition (lowered from TransitionEdge or TransitionMember).

type TransitionSourceError

type TransitionSourceError struct {
	Source ast.Node
	Region bool
}

TransitionSourceError marks a sourceless transition whose preceding member, Source, is not a state of the machine; Region records that it is a region of a parallel state.

func (*TransitionSourceError) Error

func (e *TransitionSourceError) Error() string

type TransitionStep added in v0.10.0

type TransitionStep struct {
	Footprint Footprint
	Enters    []*ast.StateNode
}

TransitionStep is what firing a transition may do short of the do behaviors it starts: its Footprint, and every state it may enter, whose do behaviors start.

type Unsupported

type Unsupported struct {
	Description string
	Node        ast.Node
	Scope       *symbols.Scope // the scope the member was declared in
}

Unsupported is a body member the lowering layer recognizes but cannot yet turn into an executable statement. It is lowered rather than dropped so that reaching it fails the execution with a diagnostic instead of silently producing a wrong answer. Description names the construct.

type ZeroCrossing

type ZeroCrossing struct {
	Name string
	// Event is the event occurrence usage; EventType the ZeroCrossingEventDef
	// specialization typing it, which the raised event carries.
	Event     *symbols.Symbol
	EventType *symbols.Symbol
	Guard     ast.Node
	// GuardScope is where the guard was written, its names resolving there.
	GuardScope *symbols.Scope
	// Terminal is the expression stating whether the crossing ends the run, nil for never.
	Terminal      ast.Node
	TerminalScope *symbols.Scope
}

ZeroCrossing is one event occurrence among the dynamics' zeroCrossingEvents: its guard, whose sign change raises the event, and whether that ends the run.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL