Chapter 8 ________________________________________________________
The title of this chapter refers to three language design principles proposed by Tennent. We
also study a fourth principle, parameterization. Many important language constructs are
derived from the principles: subroutines, parameters, block-structuring constructs, and encap-
sulation mechanisms. Denotational semantics is a useful tool for analyzing the design princi-
ples and the constructs that they derive. The language in Figure 8.1 is used as a starting point.
We apply each of the principles to the language and study the results.
P ::= C.
D ::= D1;D2 | var I:T
T ::= nat | array [N1..N2] of T | record D end
C ::= C1;C2 | L:=E | begin D;C end | . . .
E ::= E1+E2 | I | IS | N | . . .
L ::= I | IS
S ::= [E] | .I | [E]S | .IS
8.1 Abstraction 161
8.1 ABSTRACTION _______________________________________________________
The first design principle is the principle of abstraction. Programmers sometimes use the term
abstraction for a specification that hides some irrelevant computational details. In Chapter 3
we used the term to describe a function expression of form (λx.M). The usage is appropriate,
for the expression specifies a function, hiding the details regarding the value x that is used in
M. We also gave abstractions names, e.g., square= (λn. n times n). The name enhances the
abstraction’s worth, for we can refer to the abstraction by mentioning its name, e.g.,
Most programming languages support the creation of named expressions; a Pascal pro-
cedure is an abstraction of a command. We execute the command by mentioning its name.
Both a definition mechanism and an invocation m