> 1) This question refers to Lecture 2/ Slide 8 > > Could you explain the following sentence, code fragment, and > answer to the question? > > Amenable to misuse, as control structure of a program can be > modified dynamically. > > 9.left) A :=
; > 9.right) Modify M[10].left from A; > 10.left) goto M[3].left > > Question: Where does the control transfer? > > \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ The problem with the above program fragment is that the control structure is impossible to decipher as the target of the "goto" statement depends on the run time value of the variable "A". This was used originally to do array indexing, but in most modern computers, one usually does array indexing by special "index" registers. See Sethi for more explanation. > 2) What is the difference between Pragmatics and Aesthetics?- lec > 2/slide 12 >-------------------------------------------------> Pragmatic refers to such issues as interfacing the language with the hardware and the operating systems. Examples: interface with a library and debugger, etc. Aesthetic refers to the beauty and readability provided by the language. Examples: begin---end or do---od structures to define blocks or the notations for variable names etc. > 3) What is the difference between Axiomatic and Denotational > Semantics? L2/S17 -------------------------------------------------> Axiomatic semantics give meaning to a language feature by a precondition (what must be true before the structure is invoked) and a postcondition (what is guaranteed to be3 true after the invocation---assuming termination. On the other hand, Denotational semantics give meaning to a structure by means of a series of semantic functions that map the program structures into corresponding mathematical objects. > > 4) Why is it important to note that "The complexity of a language > may increase without corresponding gain in facility", L2/S18 -------------------------------------------------> Addition of a new feature is to make it easier for you to express something more succinctly. But since a new feature interacts with existing features, it may make the language (semantics) more complex. There is a trade-off. Thus, before adding a new feature, one needs to determine how well you affect this trade-off. > > 5) > declare > type black is integer; > type white is integer; > b:black; W:white; I:integer; > begin w := 5; b := w; i := b; end > > Why are "all the above assignments illegal under name > equivalence"? L3/S24 >-----------------------------------> Under name equivalence integer, black and white are determined to be of different types. Thus all the assignments are type-incompatible. > 6) L3/Last Slide > What is the Structural equivalence relationship between the > records T1, T2, T3, and T4? Is it correct that T1 == T2 == T3 > != T4 ? -------------------------------------> No. The best interpretation is to assume that all the types are different. Different languages will however interpret this differently. The example only illustrates the fact there is no obvious way to interpret structural equivalence.