Slide 5.4: A example of translational semantics (cont.) Slide 6.2: An example Home |
Denotational semantics is an approach to formalizing the meanings of programming languages by constructing mathematical objects (called denotations) which describe the meanings of expressions from the languages.Denotational semantics use functions to describe the semantics of a programming language. A function describes semantics by associating semantic values to syntactically correct constructs.
Val
functions:
Val: Expression
→ Integer
Val(2+3*4) = 14
and Val((2+3)*4) = 20
.
A denotational definition of a programming language consists of three parts:
Val
, it is the set of all syntactically correct integer arithmetic expressions, Expression
.
Val
, the set of integers, Integer
, is the semantic domain.
Val
maps the syntactic construct 2 + 3 * 4 to the semantic value 14, 2 + 3 * 4 is said to denote the value 14.
This is the origin of the name denotational semantics.