Skip to content

Enter State Machine Symbols

Rob Bocchino edited this page Nov 4, 2024 · 14 revisions

This algorithm traverses a state machine definition and enters state machine symbols into their scopes.

Input

  1. A state machine definition smd.

  2. A state machine analysis data structure sma representing the results of analysis so far.

Output

  1. An updated state machine analysis sma' with state machine symbols entered.

Procedure

Visit each of the state machine members smm of smd as specified below.

Visiting State Machine Members

Visit a state machine member smm as follows:

  1. Action, guard, choice, and signal definitions: If smm is an action, guard, choice, or signal definition d with name n, then

    1. Construct the unique state machine symbol s of the correct kind for d.

    2. Add the mapping from n to s in the nested scope of sma in the correct name group for the definition kind. There is a separate name group for each of actions, guards, and signal definitions. Choice definitions reside in the state name group.

    3. Add s to the parent symbol map of sma.

  2. State definitions: If smm is a state definition d with name n, then

    1. Construct the unique state definition symbol sym for d.

    2. Add the mapping from n to sym in the innermost nested scope of sma in the state name group.

    3. Add sym to the parent symbol map of sma.

    4. Create a fresh state machine scope s.

    5. Push s onto the nested scope of sma.

    6. Add n to the scope name list of sma.

    7. Visit each state definition member sdm of d, yielding a new state machine analysis sma.

    8. Remove n from the scope name list of a.

    9. Let s' be the innermost nested scope of sma.

    10. Add the mapping from sym to s' in the symbol-scope map of sma.

    11. Pop s' off the nested scope of sma.

  3. Other members: For other state machine members, do nothing.

Visiting State Definition Members

Visit a state definition member sdm as follows:

  1. Choice definitions and state definitions: If sdm is a choice definition d or a state definition d, then

    1. Visit d as specified for the corresponding state machine member.

    2. Add the symbol s associated with d to the parent symbol map of sma.

  2. Other members: For other state definition members, do nothing.

Clone this wiki locally