Slide 6.1: Denotational semantics Slide 6.3: Syntactic and semantic domains Home |
P: Program → ( Input → Output )
The semantic domain to which P
maps programs is a set of functions, namely, the functions from Input
to Output
, which we represent by Input
→ Output
, and the semantic value of a program is a function.
For example, if p
represents the C program:
main( ) { int x; scanf ( "%d", &x ); printf( "%d\n", x ); return( 0 ); }that inputs an integer and outputs the same integer, then
p
denotes the identity function f
from integers to integers: P(p) = f
, where f: Integer
→ Integer
is given by f(x) = x
.
Very often semantic domains in denotational descriptions will be function domains, and values of semantic functions will be functions themselves.
To simplify the notation of these domains, we will often assume that the function symbol ‘→’ is right associative and leave off the parentheses from domain descriptions.
Thus,
P: Program
→ ( Input
→ Output
)
P: Program
→ Input
→ Output