Comments on the Tucker and Noonan book:
Pages 112-113: The "BNF" rules shown on these pages are actually EBNF, because they use the subscript "opt" to indicate optional elements.
Pages 113-114: The validity rules listed at the bottom of 113 and top of 114 are incomplete. Figuring out what should be added would be a good discussion topic.
Page 114: Figure 4.7 contains an x
that should be
an h
in the call to B
, in order to match the
code shown in Figure 4.5 on page 109.
Also, the definition given at the bottom of this page for a type map indicates that the only type information recorded for a method is its return type. That would not suffice in order to support the type checking rules at the top of the page, in particular the rules that each method call needs the correct number and types of arguments.
Page 115: The value shown on the first line for tmg has three potential shortcomings. Most importantly, no argument types are shown for the methods, as described on page 114. Also, if Jay is case sensitive (as Chapter 3 and Appendix B indicate, but contrary to Section 4.2), then the method names should be A and B, not a and b. Finally, a consistent notation should be used for the pairs, rather than having the first two surrounded by parentheses and the remaining three surrounded by angle brackets. Taking all these points into account, a better version might be tmg = {‹h, int›, ‹i, int›, ‹A, (int, int)→void›, ‹B, (int)→void›, ‹main, ()→void›}
The values shown for tmA, tmB, and (if naming is case sensitive) tmmain all fail to incorporate the entries from tmg that pertain to the methods.
The definition shown for typingm has some technical flaws, including the fact that Declarations has been defined in a way that cannot include methods.
The definition of V(Program p) has two occurances of tmg, each of which is problematic. For each of them, can you see why I think it is an error? The example given after this definition would need to be changed correspondingly.
The definition of V(Method m, TypeMap tm) given in symbols near the bottom of the page does not agree with the English version that immediately follows it. Can you see what the discrepancy is? Also, there is an argument missing from typeOf. (Which one?)