SLR(1) Table Construction
In this class, We discuss SLR(1) Table Construction.
For Complete YouTube Video: Click Here
The reader should have prior knowledge of LR(0) table construction. Click Here.
We discuss the conditions to follow to construct SLR(1) table.
Which one is better, LR(0) or SLR(1)? We discuss this in later classes.
Here SLR(1), symbol 1 shows lookahead one input symbol.
The next classes will discuss how we considered looking ahead to one input symbol.
In LR(0), we considered GOTO and ACTION parts.
In SLR(1), we have the same parts.
Whenever the dot symbol is present at the end of the production, we take reduced action.
If the dot symbol is present in the middle of the production, we take shift action.
We write the reduced action at all the terminal symbols in LR(0).
In SLR(1), we write reduced action only in FOLLOW symbols of the production.
On State I2, the production E – T’s reduced action is written at the Follow(E).
The only difference between LR(0) and SLR(1) is writing reduced action.
The reduced action is written only at the FOLLOW symbols.
The above table shows the SLR(1) parsing table.