Java Reference
In-Depth Information
Exercises
1. For each of the following grammars, determine whether or not the gram-
mar is LL(1):
1 S
ABc
2 A
a
(a)
3
| λ
4 B
b
5
| λ
1 S
Ab
2 A
a
3
|
B
(b)
4
| λ
5 B
b
6
| λ
1 S
ABBA
2 A
a
(c)
3
| λ
4 B
b
5
| λ
1 S
aSe
2
|
B
3 B
bBe
(d)
4
|
C
5 C
cCe
6
|
d
2. Consider the following grammar, which is already suitable for LL(1)
parsing:
1 Start
Value $
2 Value
num
3
|
lparen Expr rparen
4 Expr
plus Value Value
5
|
prod Values
6 Values
Value Values
7
| λ
 
Search WWH ::




Custom Search