Assignment 3: Introduction to LR(0) Parsing
Due: 11/10/03
S
L $
L
L ; E
L
E
E
x
S
L $
L
E ; L
L
E
E
x
S
L $
L
L ; L
L
E
E
x
S
L $
L
x T
T
T
; L
(Note: The
in grammar (d) is meant to represent the empty string. )
Taking into account the fact that we are only interested in right-most derivations, an apparently obvious alternate definition intended to capture what we have in mind might be:

(Vn U Vt)* is a
feasible prefix
for G if
is different from S and
there exists a rightmost derivation
Sfor some string![]()

Vt*.
The definition used in class, by contrast is:

(Vn U Vt)* is a viable prefix for G
if there exists a rightmost derivation
Sfor some N![]()
N
![]()
![]()
1
2
Vn,
1,
2
(Vn U Vt)*
and 
Vt* such that
= 
1.
In your answer, you should assume that the grammars involved contain no useless non-terminals. That is, assume that every non-terminal derives some string of terminal symbols.