Final Exam Example Questions 1. Show the symbol table, attributes and type descriptor structures that would exist in a Macro compiler after it had processed the following declarations. Label all objects to indicate their types. Include values for the Size attributes of all types and for the Offsets associated with all variables and record field names, with the first variable located at offset 4. type REC1 is record M : array (2..9) of Float; Z : Integer; end record; RECVAR : REC1; I : Integer; ARRAYVAR : array (1..20) of record A, B : REC1; P : Float; end record; 2. Show the ASTs that would correspond to each of the following expressions and explain what would happen (using a trace) during the semantics tree traversal pass for each, assuming the declarations in the question above. (a) RECVAR.Z (b) RECVAR.M(I) (c) ARRAYVAR(I).B.M(I-1) 3. Assume that the variables declared in question 1 are allocated in a procedure activation record at level 2 and that I is an integer variable with address level 1, offset 8. Give SPIM code sequences to do the following: (a) Load the value of RECVAR.Z into register t3 (b) Compute the address of RECVAR.M(I) (c) Load the value of ARRAYVAR(I).P.M(I) into register t5. 4. LR(1) parsers are more powerful (can parse the same languages using more grammars and can parse more languages) than LL(1) parsers even though both parsers using both techniques look ahead only one token in order to make parse decisions. Informally explain why, preferably using an example. .