Module 3 Chapter4 4.5 Bottom Up Parsing
Module 3 Chapter4 4.5 Bottom Up Parsing
Chapter 4
Syntax Analysis
Prof. Maya B S
Assistant Professor
Department of CS&E
BIT, Bangalore
Syllabus- Chapter 4
• EX: The above strings shows sequences of reduction, then reduction can be
expressed in terms of sequence of strings like
• If the substring is chosen correctly at each step, the reduction steps could be an
exact reverse of RMD.
• ETT*FT*idF*idid*id
• E’E
• EE+n |n
a A B e
A b d
b c
It uses a wide class of context-free grammar which makes it the most efficient
syntax analysis technique.
LR parsers are also known as LR(k) parsers, where L stands for left-to-right
scanning of the input stream, R stands for the construction of right-most derivation
in reverse, and k denotes the number of lookahead symbols to make decisions.
• LR(1) – LR Parser:
• Works on complete set of LR(1) Grammar
• Generates large table and large number of states
• Slow construction
Starts with the root nonterminal on the stack. Ends with the root nonterminal on the stack.
Continuously pops a nonterminal off the stack, and Tries to recognize a right hand side on the stack,
pushes the corresponding right hand side. pops it, and pushes the corresponding nonterminal.
7. SAaAb | BbBa
A Є
B Є input=ab [hint:state=10]
8.SL=R |R
L*R |id