CS712/CS812
Homework 3
Spring 2008
Due Date: Wednesday May 7


ss -> i
i  -> f h l
i  -> f h
i  -> Q
f  -> X
h  -> Y i
l  -> Z i

Given the above grammar:

  1. Is the grammar LR(0)? Why or why not?

  2. Is the grammar SLR(1)? Why or why not?

  3. Is the grammar LALR(1)? Why or why not?

  4. Is the grammar LR(1)? Why or why not?

  5. Show the parse tables (ACTION and GOTO) that would be produced by an LR(1) parser generator. If there are shift-reduce errors, you should choose shift over reduce. If there are reduce-reduce errors, you should choose the reduction whose production appears first in the grammar. Support your answers to this question by computing and providing the LR(1) configuration sets with the associated context/lookahead information.

Please turn-in your homework in class on Wednesday May 7. If you cannot be in class that day, please make arrangements to give me your paper in advance. No late papers will be accepted.

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


Last modified on April 21, 2008.

Comments and questions should be directed to hatcher@unh.edu