




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
PrinciplesofCompiler6PrinciplesofCompiler6AnalysisLecturer:HaiNotethatmostoftheseslideswerecreatedProf.Wen-junLI(SchoolofDr.Zhong-meiSHU(DepartmentofComputerScience)Dr.HanLIN(DepartmentofComputerScience)CourseWebsite:問問Recursive-Recursive-ChooseanA-productionA X1X2Xkfor(i=1tok)if(Xiisanonterminal&&!Xi())returnfalse;elseif isaif(Xiequalsthecurrentinputtokent)getthenexttokent;elsereturn}}return}EliminationofLeftEliminationofLeftEliminationofLeftAEliminationofLeftAgrammarisleftrecursiveifithasanonterminalsuchthatthereisastringforGenerally,Generally,However,ThisHowever,Thisprocedureeliminatesimmediaterecursion,butdoesnoteliminateleftrecursioninvolvingderivationsoftwoormoresteps.TheAlgorithmTheAlgorithmforEliminationofDragon,Dragon,??Whyis??WhyisthealgorithmWhatwillhappeniftheinputgrammarhasacycle?Whatwillhappeniftheinputgrammarhasan?-productions???Giveanalgorithmtoconvertagrammarintoan?Giveanalgorithmtoconvertagrammarintoanequivalentgrammarthathasno?-GiveanalgorithmtoconvertagrammarintoanequivalentgrammarthathasnoSeeExercise4.4.6and4.4.7(DragonBook?Recursive-Recursive-對于字符串對于字符串cabdcad回MoreEfficientMoreEfficient??BacktrackingisWeneedmoreefficientRecursive-Recursive-SASAcAd|ab|LeftLeftleftleftIsleftIsleftfactoringenoughforpredictiveSAbc|BdaIfweonlylookaheadonlyonecharacter,wedonotknowwhichproductionshouldbechosen.FIRSTConsiderFIRSTConsidertwoA-productionsAα|β,whereFIRST(α)andaredisjoint.WecanthenchoosebetweentheseA-productionsbylookingatthenextinputsymbola,sinceacanbeinatmostoneofFIRST(α)andFIRST(β),notboth.ComputingComputingComputetheComputetheFIRST(X)foreachnonterminalSaA|?,SaA|?,ifthenextinputsymbolisnot‘a’,thenwillwillchooseS?;otherwisebothproductionscanbeifAcanbetherightmostsymbolinsomesententialform,then$isinFOLLOW(A).ComputingComputingComputetheComputetheFOLLOW(X)foreachnonterminalConstructionofConstructionofaParsingPredictiveParsingPredictiveParsingLL(1)LL(1)SinceM[S’,SinceM[S’,e]containsmorethanoneproduction,thegrammarisnotLL(1).作作ImplementingtheTwo?ImplementingtheTwo??Non-table-CodingforRecursivePredictiveCodingforRecursivePredictive?CodingforRecursiveCodingforRecursivePredictive?CodingforRecursiveCodingforRecursivePredictive?CodingforRecursiveCodingforRecursivePredictiveModelofModelofaTable-PredictiveTabl
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 中醫護理改善肢體麻木
- 研究生教育學匯報
- 2025年園長年度工作方案
- 2025年護士護理的下半年工作方案
- 商務日語函電課件
- 2025年上學期老師工作方案
- 2025年書香校園建設實施方案
- 急性腰疼中醫護理方案
- 2025年幼兒園衛生保健方案
- 幼兒園人力資源管理培訓課件
- 2025陜西核工業工程勘察院有限公司招聘21人筆試參考題庫附帶答案詳解
- 2024中國核工業集團公司招聘(300人)筆試參考題庫附帶答案詳解
- 常見惡性心律失常的護理
- 第15課《青春之光》課件-2024-2025學年統編版語文七年級下冊
- 初中網絡安全教育
- 浙江省杭州市金麗衢十二校2024-2025學年高三下學期(3月)第二次聯考數學試題 含解析
- 2024年上海楊浦區社區工作者筆試真題
- 2025年1月浙江省高考物理試卷(含答案)
- 【公開課】同一直線上二力的合成+課件+2024-2025學年+人教版(2024)初中物理八年級下冊+
- 【部編版道德與法治六年級下冊】全冊測試卷(含答案)
- DL∕T 5161.8-2018 電氣裝置安裝工程質量檢驗及評定規程 第8部分:盤、柜及二次回路接線施工質量檢驗
評論
0/150
提交評論