CSC365 Compiler Design and Construction

Compiler Design and ConstructionTU Board 2080

Given the following grammar with SLR parsing table, test whether the string "int (int + int)" will be accepted or rejected. E T + E……….(1) E T……….(2) T int T……….(3) T int……….(4) T (E)……….(5) STATE…

5

Given the following grammar with SLR parsing table, test whether the string "int * (int + int)" will be accepted or rejected.

E -> T + E……….(1)

E -> T……….(2)

T -> int*T……….(3)

T -> int……….(4)

T -> (E)……….(5)

STATE
ACTION
GOTO
int

(
)
$
E
T
1
S5
S4
2
3
2
ACC
3
S6
R2
R2
4
S5
S4
7
3
5
S8
R4
R4
R4
6
S5
S4
9
3
7
S10
8
S5
S4
11
9
R1
R1
10
R5
R5
R5
11
R3
R3
R3

A worked answer is on its wayMeanwhile, read the Compiler Design and Construction notes for this topic.

Discussion

Loading…

More Compiler Design and Construction questions

All Compiler Design and Construction old questions