*4/11/96 ERRATA FOR THE 2ND PRINTING (June, 1993) Programming Languages Principles and Practice by Kenneth C. Louden Page 17, paragraph 2: "International Standards Organization" should appear as "International Organization for Standardization" Page 36, paragraph 2: "general-type system" should appear as "general type system" Page 56, paragraph 2: "International Standards Organization" should appear as "International Organization for Standardization" Page 68, paragraph 2: ""sees," "calls," "the," "a," and ".")" should appear as ""sees," "pets," "the," "a," and ".")" Page 82, Figure 4-6b: In the syntax diagram for a program-module, there should be a path around module-priority, from the rectangle labeled "identifier" to the circle labeled with a semicolon. Page 94, Exercise 10: "Draw parse trees and abstract syntax trees..." should appear as "Using the grammar of Figure 4.3, draw parse trees and abstract syntax trees..." Page 97, Exercise 38: " ::= ( ) | a ::= [ ]" should appear as " ::= ( ) | a ::= [ ]" Page 97, Exercise 40: "let S be the set of all strings. Then S satisfies the recursive equation" should appear as "This corresponds to the set equation" Page 146, Exercise 10, line 3: "blocks of function p, procedure q, and the main program" should appear as "blocks of function p, procedure print, and procedure q" Page 149, Exercise 23: "the variables after the assignment to x^^. Which ..." should appear as "the variables after each assignment to x^^. Which ..." Page 168, line 4: "POINTER to charlistrec;" should appear as "POINTER TO charlistrec;" Page 185, Exercise 6: "type rc = record data: integer; next: ^rc; end; var x: ^rc;" should appear as: "type rcptr = ^rc; rc = record data: integer; next: rcptr; end; var x: ^rc;" Page 187, Exercise 15: "The C language has an if-the-else expression..." should appear as "The C language has an if-then-else expression..." Page 192, paragraph 4: "describe the type conversion that occur..." should appear as "describe the type conversions that occur..." Page 224, 2nd figure: "activation record of q" should be moved down, opposite to "control link" (as in figure on next page). Also, the ep should point to the top of the activation record of q. Page 231, paragraph 2: "This can also happen in C, but it cannot happen in Pascal, since..." should appear as "This situation cannot happen in (standard) Pascal, however, since..." Page 238, Ada example in 2nd paragraph: The two occurrences of "BadChar" in the 1st and 8th line of code should appear as "Bad_Char." Also the last four lines of code: "exception when End_Of_File | Bad_Char raise; when others raise Fatal_Error; end GetNumber;" should appear as "exception when End_Of_File | Bad_Char => raise; when others => raise Fatal_Error; end GetNumber;" Page 239, Exercise 1, lines 7 and 12: " ::= ';' | epsilon" should appear as " ::= ';' | " Line 8 should also be deleted. Page 244, Exercise 22(a) and (b): "following procedure" should appear as "following Pascal procedure" Page 262, paragraph 2: "This violates criterion 2 for abstract data type mechanisms, since the specification is still dependent on actual implementation details, even though clients are prevented from using those details." should appear as "This violates both criteria for abstract data type mechanisms: criterion 1, since the specification is still dependent on actual implementation details, even though clients are prevented from using those details; criterion 2, since the implementation details of the type and its operations are divided between the specification and the implementation." Page 270, paragraph 1: "w := z + z" should appear as "w := z + z;" Page 270, paragraph 2: "with ComplexNumbers; use ComplexNumbers; procedure ComplexUser is z,w: COMPLEX; ... begin z := MakeComplex(1.0,0.0); ... w := "+"(z,z); w := z + z -- the same as the previous operation ... end ComplexUser;" should appear as "with ComplexNumbers; procedure ComplexUser is z,w: COMPLEX; ... begin z := MakeComplex(1.0,0.0); ... w := ComplexNumbers."+"(z,z); -- w := z + z now illegal ... end ComplexUser;" Page 273, middle of page: "type IntOrderedList is" should appear as "package IntOrderedList is" Page 293, Exercise 11, last line: "8.8" should appear as "8.1" Page 294, Exercise 18: "(b) Rewrite your axioms of Exercise 7 ..." should appear as "(b) Rewrite your axioms of Exercise 10 ..." Page 316, top of page: "begin real procedure area; begin area := (width+2.0*border)*(height+ 2.0*border); end area; ... end square" should appear as "begin real procedure area; begin area := (width+2.0*border)*(height+ 2.0*border); end area; ... end borderedRectangle" Page 316, 2nd paragraph: "... closedFigure, the redefinition of area in square would not apply in the call to r.area." should appear as "... closedFigure, the redefinition of area in borderedRectangle would not apply in the call to r.area." Page 320, 4th line from the bottom: "queue::queue(void)" should appear as "queue::~queue(void)" Page 323, code after 1st paragraph: "class rectangle { private: ..." should appear as "class rectangle { protected: ..." Page 371, Paragraph 1: "A special position in Scheme is occupied by the empty list (), which cannot be evaluated as a list, since there is no first item. The empty list is considered to be both a list and an atom, which evaluates to itself. A synonym for () is nil." should appear as "A special position in Scheme is occupied by the empty list (), which cannot be evaluated as a list, since there is no first item. Instead, we must write '() to prevent evaluation (see the discussion of the quote function below)." Page 372, Paragraph 3: "(define emptylist ())" should appear as "(define emptylist '())" Page 376, middle of page: "(if (null? L) ()" should appear as "(if (null? L) '()" Page 376, bottom of page: "(cond ((null? B) ())" should appear as "(cond ((null? B) '())" Page 377, paragraph 1: "(if (null? L) ()" should appear as "(if (null? L) '()" Page 377, paragraph 2: "(cond ((> low high) ())" should appear as "(cond ((> low high) '())" Page 378, paragraph 1: "(define (sqr-lis L) (sqr-lis1 L ()))" should appear as "(define (sqr-lis L) (sqr-lis1 L '()))" Page 378, paragraph 1: "(define (reverse1 L listsofar) (if (null? L) listsofar (reverse1 (cdr L) (append listsofar (list (car L)))))) (define (reverse L) (reverse1 L ()))" should appear as "(define (reverse1 L listsofar) (if (null? L) listsofar (reverse1 (cdr L) (cons (car L) listsofar)))) (define (reverse L) (reverse1 L '()))" Page 378, middle of page: "(if (null? L) ()" should appear as "(if (null? L) '()" Page 381, paragraph 2: "the example of Section 7.6.4" should appear as "the example of Section 7.5.3" Page 387, paragraph 5: "> fun traverse empty = {} |" should appear as "> fun traverse empty = () |" Page 387, paragraph 6: "Here we have used a couple of new symbols. "{}" refers to a unit" should appear as "Here we have used a couple of new symbols. "()" refers to a unit" Page 396, paragraph 3: "The scenario we just described is called fully lazy evaluation, or just lazy evaluation for short." should appear as "The scenario we have just described, together with memoization (page 394), is called lazy evaluation." Page 396, last paragraph: "An example of a functional language with fully lazy evaluation is" should appear as "An example of a functional language with lazy evaluation is" Page 400, middle of page: "{(1,1*1), (2,2*2)} = {(1,1), (2,2)}" should appear as "{(1,1*1), (2,2*2)} = {(1,1), (2,4)}" and "represented by the set {(0,1) U {(1,1), (2,2)} = {(0,1), (1,1), (2,2)}." should appear as "represented by the set {(0,1)} U {(1,1), (2,4)} = {(0,1), (1,1), (2,4)}." Page 417, Exercises 25, 27, and 28: References to Exercise 6 should be to Exercise 8 instead. Page 419, Exercise 41: "and inc-n. (See Exercise 6.)" should appear as "and inc-n. (See Exercise 8.)" Page 419, Exercise 42: "Assume sqr = (\x. . x x) in lambda calculus." should appear as "Assume sqr = (\x. * x x) in lambda calculus." This exercise should also refer to Exercise 8, as in the previous exercises. Page 419, Exercise 45(d): "Write out an implementation of your lambda expressions in (b) as" should appear as "Write out an implementation of your lambda expressions in (c) as" Page 433, 5th line from the bottom: "resolution fails using the first clause (15 does not match 0) ..." should appear as "resolution fails using the first clause (10 does not match 0) ..." Page 445, last paragraph: "Erastosthenes" should appear as "Eratosthenes" Page 455, Exercise 26: "Erastosthenes" should appear as "Eratosthenes" Page 458, exercise 38: "and can improve A only be improving L" should appear as "and can improve A only by improving L" Page 470, rule (7): " => E1 | Env>" should appear as " => " Page 470, rule (15) to bottom of page: All occurrences of italicized n should be replaced by V. Also the assignment symbol := in rule (16) should be inside single quotes. Page 471, rule (17): The two occurrences of the assignment symbol := should be inside quotes. Page 471, paragraph 1: Rule (18) should appear as: => Env1 ------------------------- => Page 471, paragraph 1: Rule (19) should appear as: L => Page 480, Figure 12-4 (continued): "P[[P]] = L[[L]](Env0)" should appear as "P[[L]] = L[[L]](Env0)" Also, in the definition of the E semantic function, the following line was omitted and should be inserted above the last equation: "E[[I]](Env) = Env(I)" Page 484, 2nd paragraph from the bottom: "In other words, for x to be greater than or equal to 0 ..." should appear as "In other words, for x to be greater than 0 ..." Page 485, paragraph 5: "Distributivity of Disjunction wp(S,P or Q) -> wp(S,P) or wp(S,Q)" should appear as "Distributivity of Disjunction wp(S,P) or wp(S,Q) -> wp(S,P or Q)" Page 486, paragraph 3: "wp(S1;S2;Q) = wp(S1,wp(S2,Q))" should appear as "wp(L1;L2,Q) = wp(L1,wp(L2,Q))" Also, the reference to S1 and S2 later in the paragraph should be changed to L1 and L2. Page 488, 1st paragraph: "H1(while B do L od, Q) = E>0 and wp(L,Q and E<=0) = E>0 and wp(S, H0(while E do L od, Q))" should appear as "H1(while E do L od, Q) = E>0 and wp(L,Q and E<=0) = E>0 and wp(L, H0(while E do L od, Q))" Page 495, Exercise 29: "(Hint: Use the equivalence of (P->Q) and (Q or not P).)" should appear as "(Hint: Use the fact that P->Q is equivalent to (P and Q) = P.)" Page 501, middle of page: "Regardless of organization of the underlying machine..." should appear as "Regardless of the organization of the underlying machine..." Page 506, 2nd to last line of Section 13.2.1: "calculates c[0][i], c[11][i], ..., c[91][i] for all i" should appear as "calculates c[0][i], c[10][i], ..., c[90][i] for all i" Page 512, 2nd to last paragraph: "How workspace is allocated ..." should appear as "How the workspace is allocated ..." Page 565, top of page: "(Some relaxation of the "same-length" requirement of Pascal are provided.)" should appear as "(Some relaxation of the "same-length" requirement of Pascal is provided.)" Page 576, Answer to Exercise 10(c): The following introductory comment was omitted: "The parse tree is:" Page 577: The third line of the code for the "factor" procedure: "{GetToken'(');" should appear as "{GetToken();" Page 606: The answer marked 5 (bottom of page) is actually the answer to Exercise 7 of Chapter 10. Pages 608-612: All the answer numbers are one less than they should be, so that, for example, the answer to 7(c) on page 608 is actually the answer to 8(c). Page 611, answer to 34: This is actually an answer to both Exercise 35 and Exercise 36. Page 611, answer to 41: (actually the answer to 42, as indicated above) "A lambda expression for the twice functions is ..." should appear as "A lambda expression for the twice function is ..." Also, the second and third lines of the normal order reduction should have the first "(" removed, and there should be the following line in between the two lines (\ means lambda): "\x.(\x.sqr (sqr x))([(\f.\x.f(f x)) sqr] x) =" Page 617, first line: "P[[P]](a) = ..." should appear as "P[[L]](a) = ..." Page 634, column 1: "ISO (International Standards Organization) 17, 56" should appear as "ISO (International Organization for Standardization) 17, 56" Page 639, column 1: "semantic functions, 476-477" should appear as "semantic functions, 104-105, 476-477"