Homework 3


  1. For each essay question, please give no more than a 2-3 sentence answer
  2. Please print out your answer and bring it to class--use a word processor of some sort, except for the parse tree, which you may draw by hand

  1. This question concerns the differences between LL and LR parsing.
    1. Which one of them uses bottom up parsing?
    2. Which one of them uses top down parsing?
    3. Which one of them is also called "predictive"?
    4. Which one of them is also called "shift-reduce"?
    5. What do "LL" and "LR" stand for?

  2. What is the significance of the "1" in LR(1)?

  3. What is an epsilon production (i.e., what does it derive)?

  4. What is a shift-reduce conflict? Give an example of a shift-reduce conflict?

  5. What types of languages/constructs are recursive descent parsers well adapted for parsing?

  6. Describe two common idioms in context-free grammars that cannot be parsed top-down

  7. What is the name of the machine generated by a bottom-up parser to recognize a grammar? What does it have that augments the machine generated by a scanner that recognizes only regular expressions?

  8. Scott: Exercise 2.13

  9. Scott: Exercise 2.18 a-c. For those of you unfamiliar with Lisp, the symbols cdr, a, b, and c are atoms. $$ means the EOF character.

  10. Suppose I have the following expression grammar for simple arithmetic:
    exp -> exp + exp
        |  exp * exp
        |  number
    
    One of the states constructed by a bottom-up parser will look as follows:
    ---------------------
    | exp -> exp .+ exp |
    | exp -> exp .* exp |
    ---------------------
    
    What is the meaning of this state (i.e., what information is denoted by the two productions and what information is denoted by the '.')?