Syntactic and Semantic Domains


Syntactic Domains
The sets being defined are listed first with capital letters denoting elements from the sets. Then the grammar rules are listed that recursively define the elements of the set. For example, the syntactic domains Number and Digit are specified as follows: A denotational definition views the syntactic domains as sets of syntax trees whose structure is given by the grammar rules. Semantic functions will be defined recursively on these sets, based on the structure of a syntax tree node.

Semantic Domains
Semantic domains are the sets in which semantic functions take their values. These are sets like syntactic domains, but they also may have additional mathematical structure, depending on their use. For example, the integers have the arithmetic operation ‘+,’ ‘–,’ and ‘*.’ A denotational definition of the semantic domains lists the sets and the operations but usually omits the properties of the operations. An example of a specification of a semantic domain is the following specification of the integers: The name v will be used for a general element from the domain, that is, an arbitrary integer.