5.1
(1)
First(
First(
First(
Follow(
Follow(
Follow(
(2)The parsing table:
- |
|
|
|
|
$ |
---|---|---|---|---|---|
|
|
|
|||
|
|
|
|||
|
|
|
(3)
Step | Stack | Input | Reference | Action | Output |
---|---|---|---|---|---|
0 |
|
|
|
derive |
|
1 |
|
|
match | ||
2 |
|
|
|
derive |
|
3 |
|
|
|
derive |
|
4 |
|
|
match | ||
5 |
|
|
|
derive |
|
6 |
|
|
match | ||
7 |
|
|
|
derive |
|
8 |
|
|
match | ||
9 |
|
|
|
derive |
|
10 |
|
|
|
derive |
|
11 |
|
|
match | ||
12 |
|
|
|
derive |
|
13 |
|
|
match | ||
14 |
|
|
|
derive |
|
15 |
|
|
match | ||
16 |
|
|
|
derive |
|
17 |
|
|
match | ||
18 |
|
|
|
derive |
|
19 |
|
|
match | ||
20 |
|
|
accept |
5.2
(1)
First(
First(
Follow(
Follow(
Follow(
Follow(
(2)The parsing table:
- |
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
Exist more than one element in
(3)When lookahead == 2:
First(
First(
First(
First(
Follow(
Follow(
Follow(
Follow(
The parsing table:
- |
|
|
|
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6.1
Step | Stack | Input | Reference | Action | Output |
---|---|---|---|---|---|
0 |
|
|
|
shift | |
1 |
|
|
|
shift | |
2 |
|
|
|
reduce |
|
3 |
|
|
|
shift | |
4 |
|
|
|
shift | |
5 |
|
|
|
shift | |
6 |
|
|
|
reduce |
|
7 |
|
|
|
shift | |
8 |
|
|
|
shift | |
9 |
|
|
|
reduce |
|
10 |
|
|
|
reduce |
|
11 |
|
|
|
reduce |
|
12 |
|
|
|
shift | |
13 |
|
|
|
reduce |
|
14 |
|
|
|
reduce |
|
15 |
|
|
|
reduce |
|
16 |
|
|
|
shift | |
17 |
|
|
|
reduce |
|
18 |
|
|
accept |