Skip to content

Enter State Machine Symbols

Rob Bocchino edited this page Jul 17, 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 state machine member smm of smd as follows:

  1. Action, guard, junction, and signal definitions: If smm is an action, guard, junction, 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 name group for the definition kind.

    3. If smm is a junction definition that appears inside a state definition, then 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 member 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.

Clone this wiki locally