Slide 6.5: Semantic functions (cont.)
Slide 6.7: Denotational semantics of integer arithmetic expressions (cont.)
Home

Denotational Semantics of Expressions


The denotational definition of integer arithmetic expressions is as follows.

Syntactic Domains
   E: Expression
   N: Number
   D: Digit

E ::= E1 '+' E2 | E1 '–' E2 | E1 '*' E2 | '(' E ')' | N
N ::= N D | D D ::= '0' | '1' | ... | '9'

Semantic Domains

Semantic Functions
   E: Expression  Integer
   E[[E1 '+' E2]] = E[[E1]] + E[[E2]]
   E[[E1 '–' E2]] = E[[E1]] – E[[E2]]
   E[[E1 '*' E2]] = E[[E1]] * E[[E2]]
   E[['(' E ')']] = E[[E]]
   E[[N]] = N[[N]]
   N: Number  Integer 
   N[[ND]] = 10 * N[[N]] + N[[D]]
   N[[D]]  = D[[D]]
   D: Digit  Integer
   D[['0']] = 0, D[['1']] = 1, ..., D[['9']] = 9