Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
SP and MP_TM_Lec03-TopDown_Parser

SP and MP_TM_Lec03-TopDown_Parser

Ratings: (0)|Views: 47|Likes:
Published by MITMCA
%45
43!,783
W %05,78097008.70,90/94594-49942 W %45
/435,7807
#0.:78;0
08.039!,783
W ,.97,.38300/0/ 1,.4.041,574/:.9437:0/40834947 0-,.97,.94974907 ,9073,9;08 W 98,0307,5,78390.36:0 -:9349/0:80/ W 49011.039

!70/.9;0!,783
34-,.97,.3 011.039 300/8,850.,1472417,22,78 7,22,78 #0.:78;0!70/.9;0!,7838,850.,147241#0.:78;008.0395,78394:9 -,.97,.3 W 43
#0.
%45
43!,783
W %05,78097008.70,90/94594-49942 W %45
/435,7807
#0.:78;0
08.039!,783
W ,.97,.38300/0/ 1,.4.041,574/:.9437:0/40834947 0-,.97,.94974907 ,9073,9;08 W 98,0307,5,78390.36:0 -:9349/0:80/ W 49011.039

!70/.9;0!,783
34-,.97,.3 011.039 300/8,850.,1472417,22,78 7,22,78 #0.:78;0!70/.9;0!,7838,850.,147241#0.:78;008.0395,78394:9 -,.97,.3 W 43
#0.

More info:

Published by: MITMCA on Sep 09, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PPT, PDF, TXT or read online from Scribd
See more
See less

04/14/2012

pdf

text

original

 
CS416 Compiler Design 1
Top-Down Parsing
The parse tree is created top to bottom.
Top-down parser
 – 
Recursive-Descent Parsing
Backtracking is needed (If a choice of a production rule does not work, we backtrack to try otheralternatives.)
It is a general parsing technique, but not widely used.
Not efficient
 – 
Predictive Parsing
no backtracking
efficient
needs a special form of grammars (LL(1) grammars).
Recursive Predictive Parsing is a special form of Recursive Descent parsing withoutbacktracking.
Non-Recursive (Table Driven) Predictive Parser is also known as LL(1) parser.
 
CS416 Compiler Design 2
Recursive-Descent Parsing (uses Backtracking)
Backtracking is needed.
It tries to find the left-most derivation.S
aBcB
bc | bS Sinput: abcaBc a B cb cb fails, backtrack 
 
CS416 Compiler Design 3
Predictive Parser
a grammar
 
a grammar suitable for predictive
eliminate left
parsing (a LL(1) grammar)
left recursion
 
factor
no %100 guarantee.
When re-writing a non-terminal in a derivation step, a predictive parsercan uniquely choose a production rule by just looking the currentsymbol in the input string.A
 
1
| ... |
n
input: ... a .......current token

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->