CSCI 310 Spring 2005 Homework 2

Use the following grammar for problems 1-3.
S ->  A $
A ->  B C D
B ->  B x  
B -> 
C ->  z C
C ->  
D ->  C B
  1. Determine the nullable productions in the above grammar.
  2. Determine the First sets (with epsilon) for the above grammar.
  3. Determine the Follow Sets for each production in the above grammar.

    For problems 4-6 use the following grammar:

    E -> E . id ( )
    E -> E . [ E ]
    E -> B
    B -> num
    B -> id
    B -> this
    B -> ( E )
    
  4. Convert the grammar into an LL(1) grammar.
  5. Diagram the states in an LR(0) parser for the above parser.
  6. Generate an LR(0) table for the above grammar (probably using your answer just above). Is this an LR(0) parseable grammar?

Gary Lewandowski
Last modified: Mon Feb 14 12:17:05 EST 2005