# Rick van der Zwet # StudentID: 0433373 # $Id: lecture2.txt 248 2007-10-04 19:37:40Z rick $ All quotes are based on the 7th edition of Concepts of programming languages from Robert W. Sebesta, cause the 8th edition has not come in yet *** Chapter 3 Review Questions *** 2) Q: Who are language descriptions for? A: "One of the problems ... about a language" pg. 124 sect. 3.1 3) Q: Describe the operation of a general language generator A: "A language generator ... it is pushed" pg. 126 sect. 3.2.2 6) Q: Define a left recursive grammar rule. A: "In this derivation ... leftmost drivations" pg 130 Example: => , | => A | B | C 8) Q: Distinguish between static and dynamic semantics. A: "Static semantics is .. at compile time" pg. 142 sec. 3.4.1 9) Q: What purpose do predicates service in an attribute grammer? A: "Predicates functions, which .. with grammar rules." pg. 142. sec. 3.4.2 10) Q: What is the difference between a synthensized and an inherited attribute? A: "Synthesized attributes are ... across a tree" pg. 143 sect. 3.4.3 13) Q: What is the problem with using a software pure interpreter for operation semantics? A: "First, the copmlexities ... configured computer." pg. 149 *** Chapter 3 Problem Set *** 19) Compute the weakest precondition for each of the following assignment statements and postconditions: 19a) Q: a = 2 * (b - 1) - 1 {a > 0} A: 2 * (b - 1) - 1 > 0 A b > 1.5 19b) Q: b = (c + 10) / 3 {b > 6} A: (c + 10) / 3 > 6 c > 8 19c) Q: a = a + 2 * b - 1 {a > 1} A: a + 2 * b - 1 > 1 b > 0.5a + 1 19d) Q: x = 2 * y + x - 1 {x > 11} A: 2 * y + x - 1 > 11 y > 6 - 0.5x 20) Compute the weakest precondition for each of the following assignment statements and postconditions: 20a) Q: a = 2 * b + 1; b = a - 3 {b < 0} A: a - 3 < 0 {a < 3} 2 * b + 1 < 3 {b < 1} 20b) Q: a = 3 * (2 * b + a); b = 3 * a - 1 {b > 5} A: 3 * a - 1 > 5 {a > 2} 6 * 3b + 3a > 2 18b + 3a > 2 18b > 2 - 3a