Skip to content
scrambled
Programming Language Theory Flashcard

What is the operational semantics of arithmetic expressions?

Question

What is the operational semantics of arithmetic expressions?

Answer

Combining arithmetic and boolean expressions.

Syntax:

t:=tru |fls |if t then t else t |succ t |pred t |iszero t

Value:

v:=tru |fls |nvnv:=0 |succ nv

Evaluation relation:

t1→t1′if t1 then t2 else t3→if t1′ then t2 else t3if tru then t1 else t2→t1if fls then t1 else t2→t2t→t′succ t→succ t′t→t′pred t→pred t′pred 0→0pred (succ t)→tt→t′iszero t→iszero t′iszero 0→truiszero (succ nv)→fls