**'s indicates improvements that appear in the third printing. ***'s indicates improvements that will appear in the fifth printing ****'s indicates improvements that will appear in the sixth printing Pg. -14: Line 1: "6.2.5" ==> "6.2.2" In 4th printing: "6.2.3" ==> "6.2.2" (see new Chapter 6, ch6.ps) Pg. -17: Line 1: "482" ==> "481" Pg. 3: Para -3: Line: -2: after zero?", delete one blank space Pg. 5: Para 2: Line: 5: "order of evaluation of subexpressions." ==> "to say its own order of subexpression evaluation." **Pg. 11: Line -21: "," ==> "." **Pg. 19: Line 2: "x1" ==> "x3". **Pg. 21: Exercise 1.2.3: Line 5 of transcript: "v1" ==> "v2". Pg. 23: Line 2: below second display: "expression, if" ==> "expression. If" **Pg. 28: Line -4: Delete "like ML," Pg. 29: Line 6: "and string." ==> string, and +. Last line: "=>" should be "=" Pg. 35: Sec. 2.1.3: line 9: "BNF rules" ==> "set of BNF rules, also called a grammar.~ Line -6: "is a datum." ==> "is a list." Pg. 42: line -16: "list-of-numbers? is not a list" ==> "lst is not a list" Pg. 43: Line 7: below second display: ~receive" ==> "received" Pg. 56: Midpage: "Furthermore, since ... lists," ==> "Furthermore, since ... datums," Pg. 58: Exercise: 2.3.1: Line 2: ", a list ... ," ==> "(a list ...)" Pg. 63: Line -6 "parameter, however, there are two difficulties" ==> "parameter. There are two difficulties, however," **Pg. 64: Line -2: Insert "is" after second word pg. 66: Para 2: Line 2: "depth, the number ...," ~depth (the number ...) Pg. 68: Line 3: below first display: Insert: "outer if" before "expression" Next sentence: Replace: "has no significance outside of this by: "is used only in the outer if" ***Pg. 72: Line -2: "letrec," ==> "letrec" **Pg. 76: Line 1: "conjunctive" ==> "boolean" **Pg. 77: Exercise 3.3.1 (third example) "(if b c)" ==> "(if x b c)" twice Pg. 86: Exercise 3.4.5: delete phrase: "using parse" **Pg. 95: Line 15: "domain" ==> "range" **Pg. 96: Line -14: Insert "#" before "(6" **Pg. 112: Line 10: reduce-once-appl: delete it, it is redundant. Pg. 116: First line after Exercise 4.4.1 "applicative order" ==> "applicative-order" Line -6: "applicative order" ==> "applicative-order" Line -2: "applicative order" ==> "applicative-order" Pg. 118: Line 13: "applicative order" ==> "applicative-order" Pg. 119: Last Para: Line 6: "order)" ==> "order.)" **Pg. 125: Line 5 of cell-set!: replace "Illegal" ==> "Invalid" Pg. 127: Midpage: add "> (define empty? '*) above "> (define push! '*) Pg. 137: Line 1: "applicative order" ==> "applicative-order" Pg. 141: Line 2: "third or fourth" ==> "fourth or fifth" **Pg. 144: Line 5: Replace "." by "," after sixth word Pg. 148: Line -3: "a list of" ==> "a nonempty list of" Pg. 159: Exercise 5.5.5: ". Modify ..." ==> "using the following concrete and abstract syntax" Pg. 160 Line 6: "#3" ==> "#" Exercise 5.5.6: Line 4: "parser" ==> "language" Line -3: delete "parser and" **Pg. 165: Line 5 of extend-rec-env: Insert "(list->vector ...)" and Line 5 of apply-env: "(if ...)" ==> "(let ((p (ribassoc var vars vals '*fail*))) (if (eq? p '*fail*) (apply-env old-env var) (make-closure (proc->formals p) (proc->body p) env)))" **Pg. 171: "(assign (var exp)" ==> "(varassign (var exp)" Pg. 173: Line 5:"let. however" ==> "let, however" Pg. 180: Line 1 of grammar rule: "dim-exp" ==> "len-exp" Line 6 of grammar rules: ::= | Pg. 181: Replace 2 occurrences of "dimension" with "length" in make-array. Line -6: "make-cell" ==> "expressed->denoted". **Pg. 183: Line -3: Delete "and ML" **Pg. 193: Figure caption should read "Program for exercise 6.2.4" leading to a change in second page of List of Figures Pg. 196: Lines 2 and 3 of first set of grammar rules: ::= | () ::= | () Pg. 199: Line 6 of Paragraph 2: delete sentence. Line -6 of Paragraph 2: 2nd sent. becomes "Expressed values include cells." Pg. 200: Exercise 6.4.4: becomes "Modify this interpreter to use direct, rather than indirect representation of arrays." Exercise 6.4.6: Line 3: "any expression" ==> "any or ()" Pg. 201: Line -4: "indirect parameter passing" ==> "indirect representation of arrays" Pg. 206: Exercise 6.5.2: Line 1: "program" ==> "programs" First program has changed: local p = proc (x) local a = *(x, x) in begin x := 5; write(a) end in p(3) Second program has changed (the "let p =" has become "local p =" Pg. 207: Line 2: Add ";" at end of line Pg. 208: Exercise 6.5.5 (the program has changed) local a = 10; p = proc (x) +(x, x) in p(+(begin write(a); a end, a)) **Pg. 209: Line -7: "(list-ref opts k)" ==> "(list-ref opts k-1)" and ** Line -9: "(list-ref opts 1)" ==> "(list-ref opts 0)" Pg. 210: Exercise 6.6.1: Replace line 1 by "Consider concrete and abstract syntax of ." and "decl (var exp)" ==> "keydecl (var exp)" Pg. 211: Exercise 6.6.3: Replace sentence 1 by: "Modify the interpreter of exercise 6.6.1 to support keyword parameters by extending the concrete and abstract syntax of ." **Line 2 of grammar rule: "keydecls" ==> "keydecl" Pg. 217: Figure 7.1.2: Line -4 "(stackclass)" ==> " stackclass" **Pg. 219: Line 26 of eval-exp: "(instance->class new-inst)" ==> "inst-class" 219: in c-varassign clause: Add the let pair: "(c-vals (class->c-vals class))" Then in the next line: "(class->c-vals class)" ==> "c-vals" 219: Line -3: "(eval-exp init-exp env new-class inst)" ==> "(eval-exp init-exp env new-class (make-instance new-class '#()))" Pg. **220: Replace definition of init-meth-env by "(define init-meth-env (extend-env '(initialize) (list (lambda (args) "Not initialized")) the-empty-env))" In make-vals, "make-empty-cell" ==> "(lambda (x) (make-cell '*)) **Pg. 221: Para 4: Line 5: "new class" ==> "class" Pg 222: "Line 2: "The inst argument that is passed to eval-exp is useless, since there are no instances of the newly created class." ==> "A dummy instance is passed to eval-exp; its only purpose is to allow access to the new class." **Pg. 225: Line -9: Delete "." **Pg. 228: Line -4: Delete "arg" 228: Line: new-class clause: Line -2: "(eval-exp init-exp env new-class inst)" ==> "(eval-exp init-exp env new-class (make-instance new-class '#()))" 228 Line: just before the letrec, add the let pair: (new-c-vals (make-shared-c-vals (class->c-vals parent-class) c-vars)) 228 Line 12: (make-vals c-vars) ==> new-c-vals 228 Add definition: (define make-shared-c-vals (lambda (parent-c-vals c-vars) (list->vector (append (vector->list parent-c-vals) (map (lambda (x) (make-cell '*)) c-vars))))) 228 (not a correction) in definition of init-env, (parentof classof baseobject) ==> (baseobject parentof classof) and (list (make-prim-proc 'class->parent) (make-prim-proc 'instance->class) (make-class '* '() '#() '() init-meth-env)) ==> (list (make-class '* '() '#() '() init-meth-env) (make-prim-proc 'class->parent) (make-prim-proc 'instance->class)) 229 Line: 4: "parent." ==> "parent. The class variable values vector contains the cells from the parent's vector followed by uninitialized cells for the new class variables." 230 Figure 7.2.6: line 9: "inititialize" ==> "initialize" **Pg. 231: Line -13, Exercise 7.2.2: "Samlltalk" ==> "Smalltalk" ***Pg Line 12: starting at "For example" to end of paragraph is replaced by For example, by replacing the class by (instance->class inst) in the subexpression (class->c-vars class) in both the c-varref and c-varassign clauses of figure 7.2.4, we would support dynamic inheritance of class variables, but retain static inheritance of instance variables, as in the next section. Among some of the widely used object-oriented languages are C++ and Smalltalk. C++ supports both static and dynamic inheritance, while Smalltalk has dynamic inheritance. ***Pg 232: Exercise 7.2.6 is replaced by: Remove the letrec from the interpreter of this section by passing a class as an argument only when a method is accessed. (See figure 5.6.2.) **Pg. 234: Line 28 of eval-exp: "(instance->class new-inst)" ==> "inst-class" 234: (not a correction) Line 5: "instance->i-vars ==> "class->i-vars" 234: (not a correction) Line 9: "instance->i-vars ==> "class->i-vars" 234: (not a correction) in definition of init-env, (parentof classof baseobject) ==> (baseobject parentof classof) and (list (make-prim-proc 'class->parent) (make-prim-proc 'instance->class) (make-class '* '* '() init-meth-env '#())) ==> (list (make-class '* '* '() init-meth-env '#()) (make-prim-proc 'class->parent) (make-prim-proc 'instance->class)) Pg. 245: **Line 10: Include "(if (positive? x) 1 (f x))" 3 Lines below display: "to the nearest" ==>"to the body of the nearest"" "." ==> , or it is the body of a lambda expression." Pg. 246: Line 14: a "flowchart" ==> "an imperative" Pg. 247: Exercises: 8.1.1 and 8.1.3: "flowchart" ==> "imperative" **Pg. 252: Line -4: Insert vertical space **Pg. 254: Figure 8.3.1 "(variant-case ...)" ==> "(begin H E ... E T)" ****Pg. 255: Line 14: "tail-form" ==> "tail form" Pg. 257: Line 1: Exercise 8.3.2: "language" ==> "subset of Scheme" Line 5: Exercise 8.3.2: "(define below)" is deleted Line 6: From "Be careful ..." to end of sentence is deleted Line 2: "flowchart" ==> "imperative" Exercise 8.3.3: just before end of exercise include "You may check your results using simple? (see figure 8.3.2) and tail-form? below. (define tail-form? (lambda (exp) (variant-case exp (proc (formals body) (tail-form? body)) (else (and (andmap (lambda (x) (and (simple? x) (tail-form? x))) (head-exps exp)) (andmap tail-form? (tail-exps exp))))))) Exercise 8.3.5: is deleted from the book. **Pg. 267: Line -1 "+" ==> "f" **Pg. 268: Lines 5, 12, 14, 16, "+" ==> "f"; line 17: "=> (let ((g: 3)) (g (+ g: x) k))" ==> "..." Insert 2 new lines: "=> (let ((g: 3)) (f g: x (lambda (v) (g v k))))" **Pg. 269: Rules 1 and 2 slightly modified. 1. First let I' = I, 2. Then replace (k E) by I' with each tail position expression T_i of I' replaced by (k E{T_i/I}). That is, replace (k E) by I'{(k E{T_1/I})/T_1, ..., (k E{T_n/I})/T_n} We would like to treat variant-case expressions as if they had the form (variant-case H (x (b ... b) T) ... (x (b ... b) T)) It would be improper, however, to alpha-convert the binding variables b ... b, since they must also be record field names. Alpha-conversion must instead occur on the code surrounding the variant-case expression. and Line -4 is deleted; Line -1 becomes "(k (let ((x (f))) (x (variant-case e (a (x) (+ x 1))))))" ****Pg. 276: Line -6: (k (cons v v1)) should be underlined, not slanted. ****Pg. 279: Line 13: "procedure. since" ==> "procedure, since" **Pg. 280: Exericse 8.5.3 Part c: Requires some re-indenting Pg. 281: Exercise 8.5.4 Part d: Line 1: "a predicate" ==> "a predicate in continuation-passing style" Line 2: "returns true" ==> "holds" Pg. 282: Rewrite cps-simple to avoid explicit use of proc? (define cps-simple (lambda (exp) (variant-case exp (proc (formals body) (make-proc (append formals '(k)) (cps-exp body))) (else (positional-substitution exp (map (lambda (head-or-tail-exp) (cons head-or-tail-exp (cps-simple head-or-tail-exp))) (append (head-exps exp) (tail-exps exp)))))))) **Pg. 283: Replace definition of next-symbol-left with (define next-symbol-left (let ((c 0)) (lambda (rator) (set! c (+ c 1)) (string->symbol (string-append ":" (if (varref? rator) (symbol->string (varref->var rator)) "g") (number->string c)))))) Replace a "." and the last two sentences on the same page by: ; see figure 8.6.3. When we need a new variable in c-app, we use next-symbol-left; see exercise 4.6.3. **Pg. 284: Replace definition of c-special (see errata on pg. 269) by a. lines: 3-8 Delete the outer let, leaving only its body. b. line 9: (initial-exp new-exp) ==> (alpha-convert ...) of lines 5-8 c. line 17: new-exp ==> exp d. line 18: new-init-exp ==> init-exp Pg. 291: Lines 5 & 6 "flowchart" ==> "imperaitve" Pg. 296: in def. of apply-continuation: Line: 9: "(subst3 (new old slst)" ==> "(subst3 (new old slst k)" Pg. 303: in def. of make-first-valcont: Line 2: "(rands k)" ==> "(rands env k)" ****Pg. 313: Line 17: "string)" ==> "string.)" Pg. 319: in Fig. 9.4.4, Lines 7 and 14 "value" ==> "receivedvalue" This improvement is just for clarity, it is correct as it stands. pg. 325: Line 5: of definition of create-context: "(make-cell'()) ==> "(make-cell '())" **Pg. 327: Figure 9.5.6(a) and Figure 9.5.6(b) should have the same shape. **Pg. 350: 3rd change-bar in apply-proc is lowered one line. **Pg. 352: in make-rest-argcont: "first" ==> "val" & "first-env" ==> "env-or-dummy" **Pg. 355: in apply-env: change bar is extended one line **Pg. 358: On Figure: "Prt-2" ==> "Ptr-2" **Pg. 359: in make-rest-argcont!: "first" ==> "val" & "first-env" ==> "env-or-dummy" 359: Exercise 10.4.1: "1, 2, 3" ==> "0, 1, 2, 3" : "Rewrite extract" ==> "Rewrite it" Pg. 360: Figure 10.4.4: "((*final) (if ...))" ==> ((*final) (extract top-ptr 0 (lambda (vk) (pop-to-ptr vk) (if ...)))) **Pg. 364: in apply-proc/stack: Line 18 change bar is added **Pg. 365: in apply-valcont/stack: Lines 22-27 change bar is added and in make-return-valcont!: Lines 2-4 change bar is added Pg. 365: Figure 10.4.9: "((*final) (if ...))" ==> "((*final) (extract top-ptr 0 (lambda (vk) (pop-to-ptr vk) (if ...))))" **Pg. 366: Lines 4-5 change bar is added **Pg. 367: in apply-proc/stack: Lines 15-16 change bar is added and in apply-env/stack: Lines 3-8, and Line 22 change bars are added Pg. 369: E8 ==> E10, E18 ==> E20, E28 ==> E30, E38 ==> E40 throughout the page Pg. 370: Figure 10.4.12: boxes with E and 8 should "8" ==> "10" and boxes with E and 18 should "18" ==> "20" Pg. 388: Exercise 11.2.8: Add "local" after "letproc" in keywords-list **Pg. 410: Line -15 "lexical" ==> "syntactic" **Pg. 416: Line -1 "lexical" ==> "syntactic" **Pg. 433: Line 12: "> (eval ...)" ==> "> (varref-action 'five init-env (lambda (r2) ...))" **Pg. 437: in compile: Line 4: in eval-exp Lines 8 and 18: in eval-rands Lines 6 and 9: change bars added Pg. 443: Para: 2, Line: 2 "chapter 10" ==> "of chapter 10" Pg. 452: "(close-action "(close-action (lambda (env-reg) ==> (lambda (env-reg args-reg k-reg) (lambda (args-reg k-reg) ...)" ...))" Pg. 454: Line 3: def. of reg-file: "reg-names" ==> "(append '(args-reg k-reg save-regs) reg-names)" Pg. 459: In if-action: "(if acc" ==> "(if (true-value? acc)" Pg. 461: Exercise 12.4.12: Line 8: "next-code" should be italic Line 9: "next-code) acc '()" ==> "restore-code) acc '()" Line 14: "next-code" should be italic Line 21: "and next-code is ignored" ==> "and next-code will always be restore-code" Line 21: Sentence starting out "This accounts ..." is deleted. Pg. 464: Fig. A2: line n-1 should read: (error (string-append (symbol->string 'name) "->" (symbol->string 'field) ": bad record") obj)))) Pg. 466: Line 1 of figure B2: "dim-exp" ==> "len-exp" Line 6 of figure B2: "(decls)" ==> "(decls body)" **Line 8 of Figure B3: "newsimpleinstance" ==> "newsimpleinst" Pg. 468: Line 2 of table: "dim-exp" ==> "len-exp" Pg. 469: Line -15 ::= | () **Line -9: "keydecls" ==> "keydecl" Line -12: "decl (var exp)" ==> "keydecl (var exp)" **Pg. 473: Line 11 of parse-loop*: add "(error" to the right of "else" and add ")" to the right of "token". Pg. 474: **Line 11 of parse-loop+: add "(error" to the right of "else" and add ")" to the right of "token". Line 5 of parse-form should be ((definearray) seen-definearray) Pg. 480: **Line -5: "parse-form" ==> "parse-exp" Small change having to do with moving parse-decls from 481 to 480. Pg. 481: Add the procedure: parse-proc as is on page 480, but include (just before the else clause) ((lbracket) (check/drop 'lbracket (process-nt parse-exp (check/drop 'rbracket (goto-parser-state parse-assign-or-dynassign))))) This becomes the first figure of D5, which is why Pg -17 has an entry : Last line of parse-decl "parse-letdecl" ==> parse-decl" Pg. 482: the top bar disappears becasue of change to Pg. 481. Pg. 492: Line -3: Add "local" after "letproc" in keywords-list **Pg. 496: Line 8 of parse-terminated-by: add "(else" to the left of "(error" and add ")" to the right of "token", and shift right to align where "(error" used to be. Pg. 497: Line 2 of table: "dim-exp" ==> "len-exp". Pg. 499: Line 1: "decl (var exp)" ==> "keydecl (var exp)" **Pg. 511: Line 9: "Smith [82]" ==> "Smith [84]" **Pg. 512: Line -5: "Hudak and Kelsey" ==> "Kelsey and Hudak" 512: Line -7: "Fisher" ==> "Fischer" **Pg. 513: Line 1 of Reference: Insert: Abelson, H., and Sussman, G.J. {\it Structure and Interpretation of Computer Programs}, MIT Press, Cambridge, MA, 1985. **Pg. 514: After Fischer reference: Insert: Floyd, R.W. ``Assigning Meanings to Programs,'' in {\it Proc. Symp. in Appl. Math., Vol. 19, Mathematical Aspects of Computer Science} (J.T. Schwartz, ed.), pp. 19--32. Amer. Math. Soc., Providence, RI, 1967. **Pg. 515: No errors, but needs to have some items shifted because of 513, and 514. **Pg. 516: Led to just referencing Brian Smith's 1984 POPL paper. **The Index has been redone.