Syntax
We define our own imperative language and its syntax and semantics.
e::=x∣n∣e1+e2
c::=x:=eskipif e then c1 else c2while e do cc1;c2
Explanation:
eexpression - numbern, variable (identifier)x, addition of other expressions
ccommand - value assignment to variable, conditionals, sequential executionc1;c2
Semantics
= operational syntax
cprogram
μmemory
- under which
c
maps references to values
μ(e)returns value ofein memory
(c,μ)configuration
, provided by program after finishing (or just
μ
if finished) → see below
Update
Precondition:
x
is in memory
μ
.
No-Op
Branch True / False
Loop True / False
Sequence
Different based on whether
c1
calls other instructions or not.