CPSC 425 Spring 2006
HW 4: Top Down Parsing

For each grammar below,
  1. List the terminals.
  2. List the nonterminals.
  3. Compute the First set for each right hand side. That is, for each production <A> -> alpha, compute First(alpha).
  4. Compute the Follow set for each nonterminal.
  5. Use the First and Follow sets to compute the Predict set for each production. It's often easiest to use the production numbers here, e.g., Predict(1) = ...

  1. 1) <S> ::= <A> <B> c
    2) <A> ::= a
    3) <A> ::= empty
    4) <B> ::= b
    5) <B> ::= empty
    

  2. 1) <E> -> -<E>
    2) <E> -> (<E>)
    3) <E> -> <V> <T>
    4) <T> -> -<E>
    5) <T> -> empty
    6) <V> -> x <U>
    7) <U> -> (<E>)
    8) <U> -> empty