We define an abstract machine with:

  • a control stack
  • an auxiliary stack
  • memory (also called store) modelled by partial function , mapping each address to an integer. The domain of , , denotes the locations where is defined. is the function that maps each to the value , and to value .

An abstract machine is a transition system. The configuration is a triple:

Definition of control and result stacks:

Where , , and are non-terminals used in the rules defining SIMP programs. To model the execution of a program, we will define transitions between initial and final configurations.

  • Initial config:
  • Final config:

Semantics

If there is a sequence of transitions then we say that program executed in the state terminates successfully producing the state .

If there is a sequence then we say that the value of expression in the state is .

Transition Rules

A transition rule has the form , where each describe configurations. We divide these rules into two groups, one for evaluation of expressions and the other of commands.

Evaluation of expressions:

Example: Assume and we want to evaluate . Given the initial configuration, we find:

\begin{aligned} \langle !I > 0 \cdot nil, nil, m \rangle &\rightarrow \langle !I \cdot 0 \cdot > \cdot nil, nil, m \rangle \ &\rightarrow \langle 0 \cdot > \cdot nil, 4 \cdot nil, nil \rangle \ &\rightarrow \langle > \cdot nil, 0 \cdot 4 \cdot nil, m \rangle \ &\rightarrow \langle nil, \text{True} \cdot nil, m \rangle \end{aligned}$$

Evaluation of commands:

The advantage of this definition is that it explains the execution of commands step by step which is useful if we have to implement the language. However, it is not very intuitive. Many transitions are just analysing the phrase and not performing computations.

To overcome this issue, we use a structural approach to transition systems.