Definition. Simple Imperative Language - Semantics [003u]

We can divide the environmental big-step semantics of our simple language into three parts:

  • Expression evaluation: Describes how arithmetic expressions are evaluated to numbers.
  • Boolean expression evaluation: Describes how boolean expressions are evaluated to boolean values (true/false).
  • Statement execution: Describes how statements are executed, transforming an initial state (environment) into a final state.

The general big-step environmental evalutation rule is denoted as:

\[ \langle t, \sigma \rangle \Downarrow v \]

Here:

  1. We have some starting term \(\texttt {t}\) (which can be an expression, boolean expression, or statement), along with some state \(\sigma \).
  2. The evaluation results in some value \(\texttt {v}\) (which can be a number, boolean value, or new state).

A quick aside here to deconstruct the term big-step environmental evaluation:

  • We say that this evaluation is big-step as it assumes some arbitrary state of intermediate steps, meaning that within big step semantics we do not care about intermediate computation only about some input expression and the final output value. A simple analogue to make here is that big-step semantics are akin to a teacher asking you to only show ur final answer to a math problem rather than all the steps you took to get there.
  • We say that this evaluation is environmental (as opposed to being substitution based) as we explicitly keep track of a state \(\sigma \) which maps variables to their values. This is in contrast to substitution based semantics where variable occurrences are replaced directly with their values in expressions.

The state \(\sigma : \texttt {String} \to \mathbb {Z}\) represents a mapping from variables (commonly strings) to their corresponding values (numbers). We denote the updated state after assigning a value to a variable \(\texttt {x}\) as:

\[ \sigma [x \mapsto n] \]

This means that in the new state, the variable \(\texttt {x}\) now maps to the number \(\texttt {n}\), while all other variable mappings remain unchanged from the original state \(\sigma \).