-
Notifications
You must be signed in to change notification settings - Fork 34
Check Typed Elements
This algorithm assigns a type option to each typed element. It checks the type options for consistency with the semantic rules.
-
A state machine definition smd.
-
A state machine analysis data structure sma representing the results of analysis so far.
-
sma with the type option map updated if the check passes; otherwise an error.
-
Compute the type option map.
-
Check the types of the actions and guards.
Algorithm:
-
Let m be the type option map of sma.
-
Visit each typed element e of smd.
Visiting typed elements: To visit a typed element e, do the following:
-
If the mapping m(e) exists, then do nothing.
-
Otherwise if e is an initial transition specifier, a state entry specifier, or a state exit specifier, then then set m(e) to None.
-
Otherwise if e is a state transition specifier sts, then
-
Let o be the type option specified in the signal of sts.
-
Set m(sts) to o.
-
-
Otherwise e is a choice c.
-
Let r be the reverse transition graph of sma.
-
If r.arcMap(j) is empty, then set m(j) to None. This happens when c is the initial node of the transition graph.
-
Otherwise
-
Let E be the set of typed elements implied by the arc set r.arcMap(j).
-
Visit each typed element in E.
-
Let O be the set of type options m(e) such that e is an element of E.
-
Let o be the common type option of O. If there is no common type option, then return an error.
-
Set m(j) to o.
-
-
-
Visit each typed element e of smd.
-
Let o be the type option associated with e in the type option map.
-
If e is a initial transition specifier, a state entry specifier, or a state exit specifier, then check that o is convertible to the type option of each of the actions specified in e.
-
Otherwise if e is a state transition specifier or choice definition, then check that all guards and actions specified in e have type options o' such that o is convertible to o'.
-