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
- Determine the nullable productions in the above grammar.
- Determine the First sets (with epsilon) for the above grammar.
- 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 )
- Convert the grammar into an LL(1) grammar.
- Diagram the states in an LR(0) parser for the above parser.
- 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