State annotations
Annotations are currently an experimental work-in-progress language feature. Their design may change in a backward incompatible manner. |
A state annotation adds state information to a location in an automaton. For basic information on state annotations, see the language tutorial. Here we discuss further details.
State annotations (@state
) can be added to the following elements in CIF specifications:
Locations of automata.
The annotation has the following additional constraints, in addition to the general constraints that apply to all annotations:
A single location may have multiple state annotations, if that location represents multiple states of a state space.
Each argument of a state annotation represents either an automaton with its current location, or a variable with its current value.
There can be any number of arguments (including no arguments), as models may have any number of automata and variables.
The name of the argument must be the absolute name of the corresponding automaton or variable.
Argument values, and parts of argument values (in case of containers), must be literals of type
bool
,int
,real
,string
,tuple
,list
,set
, ordict
. This implies that the values must be statically evaluable, and that evaluating an argument value must not result in an evaluation error.If at least one location in an automaton has at least one state annotation, all other locations in that same automaton must also have at least one state annotation, as all these locations should then represent a least one state from the state space.
Different state annotations on the same or different locations of a single automaton must have the same arguments, and the values of matching arguments must have compatible types (ignoring ranges), as they should represent states from the same state space.
Most values can thus be represented as literals, but there are some exceptions. The following overview indicates how to represent locations and different types of values:
Location / value | Represented as |
---|---|
Location of an automaton |
String literal with the non-escaped name of the location, or |
Boolean value |
|
Integer value |
Integer literal, such as |
Real value |
Real literal, such as |
Enumeration value |
String literal with the non-escaped name of the enumeration literal. |
String value |
String literal, such as |
Tuple value |
Tuple literal, such as |
List value |
List literal, such as |
Set value |
Set literal, such as |
Dictionary value |
Dictionary literal, such as |
Function value |
String literal with the non-escaped absolute name of the function, or |