-
Notifications
You must be signed in to change notification settings - Fork 35
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 map updated if the check passes; otherwise an error.
-
Compute the reverse junction map.
-
Compute the type options of all the typed elements.
-
Check the types of the actions and guards.
-
Let m be the reverse junction map of sma.
-
Visit each typed element of smd.
-
Let n be the node being visited.
-
If n is an initial transition specifier or a state transition specifier whose destination is a junction j, then add n to m(j).
-
Otherwise n is a junction definition j. For each enter expression e in j, if the destination is a junction j', then add n to m(j').
-
-
Let m be the type map of sma.
-
Set the visited symbol set of sma to the empty set.
-
Visit each typed element of smd.
-
Let n be the node being visited.
-
If n is an initial transition specifier, then set m(n) to None.
-
Otherwise if n is a state definition sd, then for each state transition specifier sts in sd
-
Let o be the type option specified in the signal of sts.
-
Set m(sts) to o.
-
-
Otherwise n is a junction j.
-
Let m be the reverse junction map of sma.
-
Let E be the set of typed elements m(n).
-
Visit each typed element in E.
-
Let O be the set of type options of elements of E.
-
Let o be the common type option of O. If there is no common type, then return an error.
-
-
-
Visit each typed element e of smd.
-
Let o be the type option associated with e in the type map.
-
If e is a initial transition 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 junction definition, then check that all guards and actions specified in e have type options o' such that o is covertible to o'.
-