Explain in detail slr llr and clr in compiler design
Answers
Answered by
0
Construction of SLR parsing table –
Construct C = { I0, I1, ……. In}, the collection of sets of LR(0) items for G’.
State i is constructed from Ii. The parsing actions for state i are determined as follow :
If [ A -> ?.a? ] is in Ii and GOTO(Ii , a) = Ij , then set ACTION[i, a] to “shift j”. Here a must be terminal.
If [A -> ?.] is in Ii, then set ACTION[i, a] to “reduce A -> ?” for all a in FOLLOW(A); here A may not be S’.
Is [S -> S.] is in Ii, then set action[i, $] to “accept”. If any conflicting actions are generated by the above rules we say that the grammar is not SLR.
Similar questions
Math,
6 months ago
Math,
6 months ago
Science,
6 months ago
Biology,
11 months ago
Environmental Sciences,
1 year ago