VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>VDM</strong>-<strong>10</strong> <strong>Language</strong> <strong>Manual</strong><br />
state designator = name<br />
| field reference<br />
| map or sequence reference ;<br />
field reference = state designator, ‘.’, identifier ;<br />
map or sequence reference = state designator, ‘(’, expression, ‘)’ ;<br />
multiple assign statement = ‘atomic’, ‘(’ assign statement, ‘;’,<br />
assign statement,<br />
[ { ‘;’, assign statement } ] ‘)’ ;<br />
Semantics: The assignment statement corresponds to a generalisation of assignment statements<br />
from traditional high level programming languages. It is used to change the value of the<br />
global or local state. Thus, the assignment statement has side-effects on the state. However,<br />
in order to be able to simply change a part of the state, the left-hand side of the assignment<br />
can be a state designator. A state designator is either simply the name of a global variable, a<br />
reference to a field of a variable, a map reference of a variable, or a sequence reference of a<br />
variable. In this way it is possible to change the value of a small component of the state. For<br />
example, if a state component is a map, it is possible to change a single entry in the map.<br />
An assignment statement has the form:<br />
✞<br />
✡✝<br />
sd := ec<br />
where sd is a state designator, and ec is either an expression or a call of an operation. The<br />
assignment statement denotes the change to the given state component described at the righthand<br />
side (expression or operation call). If the right-hand side is a state changing operation<br />
then that operation is executed (with the corresponding side effect) before the assignment is<br />
made.<br />
Multiple assignment is also possible. This has the form:<br />
✞<br />
✡✝<br />
atomic (sd1 := ec1;<br />
...;<br />
sdN := ecN<br />
)<br />
All of the expressions or operation calls on the right hand sides are executed or evaluated,<br />
and then the results are bound to the corresponding state designators. The right-hand sides<br />
are executed atomically with respect to invariant evaluation. However in the case of a multithreaded<br />
concurrent <strong>VDM</strong>++ or <strong>VDM</strong>-RT model, execution is not necessarily atomic with<br />
respect to task switching.<br />
<strong>10</strong>2<br />
✆<br />
✆