

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


September 27, 2007
The exam will cover everything we have discussed from Chapters 1-4 in the text and all presented materials, but emphasizing the material covered in class (e.g. very little of Chapter 2 was explicitly mentioned, from Chapter 3, we covered syntax and attribute grammars, and introduced dynamic semantics and the 3 techniques for specifying them, while topics of Chapter 4 were covered in greater detail - note that we did not cover LR parsing at the level of detail given in the text). The style of the exam will be very flexible, possibly consisting of fill in the blank, true or false (possibly with justification), multiple choice, matching, short answer (e.g. definitions or listing), and discussion questions. You will not be asked to work detailed problems such as writing any actual code (i.e. code in a specific language like Java - you should be able to write pseudo-code for a JLex token specification or recursive descent parser). You should have some ideas about the theory behind implementation of programming languages (e.g. what really does happen in lexical analysis). Some smaller problems such as drawing a parse/syntax tree are likely. In general, you should know how to solve the problems given in assignments even though you may not have to actually solve such problems on the exam.
A brief outline of the topics we have covered is described below. (This list is intended to be as complete as possible but may not be all inclusive.)
class-specifier ::= class identifier [ : identifier ] { member-declaration {member-declaration} } member-declaration ::= identifier identifier function-definition | int identifier function-definition
Note that this syntax contains terminal symbols { and } which are different from the extended BNF meta-symbols { and }, and distinguished by underlining. Write an equivalent syntax graph and a recursive descent parser for this construction. Assume the existence of production rules for function-definition and corresponding parsing procedure FUNCTION DEFINITION, and a scanning procedure GET TOKEN to set a global string variable TOKEN to the token type of the next token. Furthermore, assume that TOKEN is already set to the first token when parsing begins.
(a) Indicate which attributes are inherited, which are synthesized, and which are intrinsic. (b) Draw the attributed parse tree for the string “aaabbbccc”, showing clearly the order of evaluation of all attributes.