CS712/CS812
Homework 2
Spring 2001


s     -> label s1
s1    -> ID EQ e
s1    -> GOTO ID IF e
s1    -> e
label -> ID COLON label
label ->
e     -> NUMBER
e     -> ID etail
etail ->
etail -> LPAREN plist RPAREN
plist ->
plist -> e ptail
ptail -> 
ptail -> COMMA e ptail

Given the above grammar:

  1. Compute the First sets for the nonterminals of the grammar.

  2. Compute the Follow sets for the nonterminals of the grammar.

  3. Compute the LL(1) Predict Sets for this grammar.

  4. Explain why the Predict Sets demonstrate that the grammar is not LL(1).

Please hand in your solution prior to 11am on Monday April 16. No late papers will be accepted.

You are expected to do your own work on this assignment.


Last modified on April 5, 2001.

Comments and questions should be directed to pjh@cs.unh.edu