Bottom-Up
Parsing:
Problems
1) Two or more rules have the same
handle
Note:
A
h
andle
is
the
right
-hand
side of
a
rule.
X
1
X
2
X
n
A
…
r
1
:
A
®
X
1
X
2
…
X
n
r
2
:
B
®
X
1
X
2
…
X
n
handle
tokens
X
1
X
2
X
n
B
…
tokens
Use rule
r
1
or
r
2
?
E
E
E
E
Which of
these tree
to
create?
2) Ambiguous grammars
G
expr
2
= (
N
,
T
,
P
,
E
), where
N
= {
E
},
T
= {
i
,
+
,
*
,
(
,
)
},
P
= {
1
:
E
®
E
+
E
,
2
:
E
®
E
*
E
,
3
:
E
®
(
E
)
,
4
:
E
®
i
}
E
E
E
+
*
i
i
i
E
E
E
+
*
i
i
i
2
/42