際際滷

際際滷Share a Scribd company logo
NADAR SARASWATHI COLLEGE
OF ARTS AND SCIENCE THENI
SLR AND LR PARSER
M.shakthi
Msc( cs)
SLR PARSER:
The SLR parser is simple to LR.
Its the smaller class of grammer
having few number of states.
SLR is very easy to construct and is
similar to LR parser .
The only difference between SLR parser
and LR parser is that in LR parsering table .
There is a change of 'SHIFT REDUCED
conflict because we are entering reduced
corresponding to all terminal states.
TYPES OF LR PARSERING METHODS:
1.SLR
2.CLR
3.LALR
STEPS FOR CONSTRUCTING SLR PARSERING
TABLE:
1.writing arguments grammer.
2.LR(O) collection of items to be found.
3.Find FOLLOW of LHS of production.
4.Defining 2 function:
GOTO( list of terminal)
ACTION(list of non terminal)
EXAMPLE
STEP1:
S>AA
A-aA/b
S-S(0th production)
S-.AA(1st production)
A-.aA(2nd production)
A-.b(3rd production )
STEP2:
STEP3:
Find follow of LHS of production
FOLLOW (s)=
To find FOLLOW of non terminal.
STEP4:
Definiting 2 function
Goto, action.
LR PARSER:
Its an efficient bottom up syntax analysis
techniques that can be used to parser language
classes of context free grammar is called LR(O)
parsing.
L stands for left to right scanning R stands for
rightmost derivation in reverse.
O stands for no of input symbols of looahead.
THANK YOU

More Related Content

CD