Java Reference
In-Depth Information
1 Start
→
S$
2 S
→
id assign A semi
3 A
→
Pre E
4 Pre
→
id assign Pre
(e)
5
| λ
6 E
→
EplusP
7
|
P
8 A
→
id
9
|
lp A rp
1 Start
→
S$
2 S
→
id assign A semi
3 A
→
id assign A
4
|
E
5 E
→
EplusP
6
|
P
7 P
→
id
(f)
8
|
lpAsemiArp
9
|
lp V comma V rp
10
|
lb A comma A rb
11
|
lbVsemiVrb
12 V
→
id
1 Start
→
S$
2 S
→
id assign A semi
3 A
→
id assign A
4
|
E
(g)
5 E
→
EplusP
6
|
P
7 P
→
id
8
|
lp id semi
id rp
9
|
lp A rp
11. Explain why the language defined by the grammar in Exercise 9 is
in-
herently nondeterministic
—there is no LALR(
k
) grammar for such lan-
guages.
12. Given the claim of Exercise 11, explain why the following statement is
true or false:
There is no LR(
k
) grammar for the language
0
n
1
n
a
0
n
1
2
n
b
{
}∪{
}.