CS4307 TEST-2 11/10/1999. Name:__________________________________ PART-A. Multiple Choices (75 points) Check all correct answers in each of 15 questions in this PART. First 13 questions are about the following grammar, if applicable: G -> E :The augmented rule, to be used when necessary. 1: E -> T + E 2: E -> T 3: T -> T - F 4: T -> F 5: T -> ( E ) 6: F -> id 1. FOLLOW(T) is the same as: a. FOLLOW(E) b. FOLLOW(F) c. Neither 2. PREDICT(Rule#3) is the same as: a. FIRST(T) b. FIRST(F) c. FIRST(T-F) d. None of above. 3. PREDICT(Rule#4) is disjoint (different) from: a. PREDICT(Rule#3) b. PREDICT(Rule#5) c. FIRST(T) d. None of above. 4. The Operator precedence relation '>' applies to: a. - + b. id + c. ) + d. None of above. 5. The Operator precedence relation '<' applies to: a. + - b. + + c. - - d. None of above. 6. The Simple precedence relation '>' applies to: a. + T b. + + c. - id d. None of above. 7. The Simple precedence relation '=' applies to: a. + E b. - F c. ( E d. None of above. 8. Following nonterminal has disjoint PREDICT set or sets: a. E b. T c. F d. None of above. 9. The initial state of the SRL(1) parser has: a. G -> .E b. E -> .T+E c. E -> T.+E d. T -> .F e. None of above. 10. Following is a rightmost sentential form: a. T+T+E b. F-F c. T-(E) d. None of above. 11. Following is a leftmost sentential form: a. T+E b. T+T c. T-F+E d. None of above. 12. The grammar is a. an Operator Grammar. b. LL(1). c. Neither. 13. T+T+T-F For the above rightmost sentential form, a handle candidate is: a. T-F b. T+T c. Neither. **********END-OF-GRAMMAR-REFERENCE********** 14. An advantage of recursive descent parsers is: a. No explicit use of syntax stack. b. No parse table. c. Relatively easy implenmentation. d. Frequent function/subprogram calls/returns. e. None of above. 15. An advantage of LR parsers is: a. Broadest (most general) deterministic parsers. b. Suitable to automation. c. Easy manual implementation. d. None of above. PART-B. True/false questions. (15 points) 16. An Operator Precedence parser may parse ambiguous sentences. 17. An Operator Precedence parser does not make a reduction for Unit production rules like: N -> M :(where both symbols are a nonterminal) 18. An LL(1) Parser table contains exactly the same information as all the Predict sets and all the production rules of the grammar. 19. LR parsera are based upon, among others: a. States, and b. Viable prefixes. 20. FOLLOW sets are used in, among others: a. LL(1) parse table construction for grammars with Empty-rule(s), and b. SLR(1) parse table construction for determining shift actions. PART-C. Other problems: (10 points) Do just one problem in this PART. A. Give a formula for calculating each of the 3 Oprator Precedence relations. B. t1 t2 t3 t4 ------------------------------ t1| < = > t2| = t3| > < < t4| < = < For above Operator Precedence Matrix, find values of two defining functions, if possible. If not possible, give the precise reasons.