





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Discovering Handles, Shift Reduce, Stack, Left string, Parse tree, Uppr Frontier, New Tree Node are basic concepts discussed of course.
Typology: Slides
1 / 29
This page cannot be seen from the preview
Don't miss anything!






















2
Shift-Reduce: The Stack
Left string can implemented as a stack Top of the stack is the ► Shift pushes a terminal on the stack
4
Shift-Reduce: The Stack
Left string can implemented as a stack Top of the stack is the ► Shift pushes a terminal on the stack
5
►int + (int) + (int) $ shift int ► + (int) + (int) $ reduce E → int E ► + (int) + (int) $ shift 3 times E + (int ►) + (int) $ reduce E → int
int
► E stack
(
7
►int + (int) + (int) $ shift int ► + (int) + (int) $ reduce E → int E ► + (int) + (int) $ shift 3 times E + (int ►) + (int) $ reduce E → int
int
E
►
stack
(
E
8
A bottom-up parser builds the parse tree starting with its leaves and working toward its root
10
int + (int) + (int)
E + (int) + (int)
E + (E) + (int)
E + (int)
E + (E)
int + ( int ) + ( int )
E E^ E
E
11
At each step, the parser looks for a section of the upper frontier that matches right-hand side of some production.
13
The critical step is developing an efficient mechanism that finds matches along the tree’s current frontier.
14
Formally, the parser must find some substring β, of the upper frontier where
16
Formally, the parser must find some substring β, of the upper frontier where
17
We can represent each potential match as a pair 〈A→β, k 〉, where k is the position on the tree’s current frontier of the right- end of β.
19
A bottom-up parser operates by repeatedly locating handles on the frontier of the partial parse tree and performing reductions that they specify.
20
The bottom-up parser uses a stack to hold the frontier. The stack simplifies the parsing algorithm in two ways.