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

lec8

Ratings: (0)|Views: 94|Likes:
Published by perera.randika

More info:

Published by: perera.randika on Dec 02, 2010
Copyright:Attribution Non-commercial

Availability:

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

12/02/2010

pdf

text

original

 
Parsingreview 
Top-downparser
 
startattherootofderivationtreeandlli
 
choosingproductionfornonterminalisthekeproblem 
 
LL(predictive)parsersuselookaheadtochoosproduction 
Bottom-upparser
 
startatleavesandlli
 
choosingright-handside
rh
)ofproductionithekeyproble
 
LRparsersusecurrentstackandlookaheadtchooseproduction LR(k)parsersaremorepowerfulthanLL(k) parsersbecausetheycanseetheentir
rh
beforchoosingaproduction
CPSC43
Lecture8,Page
 
Somedenitions 
Foragramma
,withstartsymbo
,anystrin
 
suchthat 
 
 
iscalled
sententialfor
 
I
 
containsonl
terminalsymbol
 
issentencei
)
 
I
 
containsoneormorenon-terminals,iti justasententialform(notasentencei
))
left-sententialform 
isasententialformthat occursintheleftmostderivationofsomesentence
right-sententialform 
isasententialformthat occursintherightmostderivationofsomesentence
CPSC43
Lecture8,Page
 
Bottom-upparsin
Goal
Givenaninputstring 
andagramma
constructaparsetreebystartingattheleaveandworkingtotheroot
Theparserrepeatedlymatchestheright-handsid
rh
ofaproductionagainstasubstringinthe currentright-sententialformAteachmatch,itapplies
reductio
tobuildthe parsetree
 
eachreductionreplacesthematchedsubstrinwiththenonterminalontheleft-handsid
lh
otheproduction 
 
eachreductionaddsaninternalnodetothe currentparsetre
 
theresultisanotherright-sententialforThenalresultisarightmostderivation,inreverse
CPSC43
Lecture8,Page

You're Reading a Free Preview

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