-
Notifications
You must be signed in to change notification settings - Fork 35
Enter State Machine Symbols
This algorithm traverses a source model and enters symbols into their scopes.
-
A list tul of translation units.
-
An Statemachine analysis data structure a representing the results of analysis so far.
-
Translation unit lists: Visit each translation unit tu in tul in order.
-
Translation units: Visit a translation unit tu by visiting its members tum.
-
Translation unit members: Visit a translation unit member tum as follows:
-
State and Junction definitions: If tum is a state or junction definition d with name n, then
-
Look up the symbol sym with unqualified name n in the innermost nested scope of a in the state name group.
-
If sym exists and is a state symbol, then let s be the scope corresponding to sym in the symbol-scope map of a.
-
Otherwise if sym exists then report an error.
-
Otherwise
-
Let s be a fresh scope.
-
Construct a state symbol sym.
-
Add the mapping from n to sym in the innermost nested scope of a in every state group.
-
Add sym to the parent symbol map of a.
-
-
Add n to the scope name list of a.
-
Push s onto the nested scope of a.
-
Visit each State member of d, yielding a new analysis data structure a.
-
Let s' be the innermost nested scope of a.
-
Add the mapping from sym to s' in the symbol-scope map of a.
-
-
Pop s' off the nested scope of a.
-
Remove n from the scope name list of a.
-
-
Action definitions: If tum is a action definition d with name n, then
-
Construct the unique symbol s of the correct kind for d.
-
Add the mapping from n to s in the global scope of a in the action name group.
-
Add s to the parent symbol map of a.
-
-
Signal definitions: If tum is a signal definition d with name n, then
-
Construct the unique symbol s of the correct kind for d.
-
Add the mapping from n to s in the global scope of a in the signal name group.
-
Add s to the parent symbol map of a.
-
-
Guard definitions: If tum is a guard definition d with name n, then
-
Construct the unique symbol s of the correct kind for d.
-
Add the mapping from n to s in the global scope of a in the guard name group.
-
Add s to the parent symbol map of a.
-
-