下载此文档

编译原理课件PPT 第4章.ppt


文档分类:IT计算机 | 页数:约196页 举报非法文档有奖
1/196
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/196 下载此文档
文档列表 文档介绍
编译原理课件PPT 第4章.pptCHAPTER4SyntaxANALYSIS Section0ApproachestoimplementaSyntaxanalyzer1、ThesyntaxdescriptionofprogramminglanguageconstructsContext-freegrammarsBNF(BackusNaurForm)notationNotes:pilerwritersCHAPTER4SyntaxANALYSIS Section0ApproachestoimplementaSyntaxanalyzer2、Whyagrammarisusuallyusedtodescribethesyntaxofaprogramminglanguage?Agrammargivesaprecise,yeteasy-to-understand,syntacticspecificationofaprogramminglanguageFromcertainclassesofgrammarwecanautomaticallyconstructanefficientparserthatdeterminesifasourceprogramissyntacticallywellformedCHAPTER4SyntaxANALYSIS Section0ApproachestoimplementaSyntaxanalyzer2、Whyagrammarisusuallyusedtodescribethesyntaxofaprogramminglanguage?AproperlydesignedgrammarimpartsastructuretoaprogramminglanguagethatisusefulforthetranslationofsourceprogramsintocorrectobjectcodeandforthedetectionoferrorsTheevolvedconstructscanbeaddedtoalanguagemoreeasilyCHAPTER4SyntaxANALYSIS Section0ApproachestoimplementaSyntaxanalyzer3、ApproachedtoimplementasyntaxanalyzerManualconstructionConstructionbytoolsCHAPTER4SyntaxANALYSIS Section1TheRoleoftheParser1、urringerrorssothatitcancontinueprocessingtheremainderofitsinputCHAPTER4SyntaxANALYSIS Section1TheRoleoftheParser2、pilermodelNotes:pilerLexicalanalyzerParserSymboltableSourceprogramtokenGetnexttokenParsetreeRestoffrontendIntermediaterepresentationCHAPTER4SyntaxANALYSIS Section1TheRoleoftheParser3、pilersTOP-DOWNmethodBuildparsetreesfromthetop(root)tothebottom(leaves)TheinputisscannedfromlefttorightLL(1)grammars(oftenimplementedbyhand)BOTTOM-UPmethodStartfromtheleavesandworkuptotherootTheinputisscannedfromlefttorightLRgrammars(oftenconstructedbyautomatedtools)CHAPTER4SyntaxANALYSIS Section1TheRoleoftheParser4、SyntaxErrorhandling1)ErrorlevelsLexical,suchasmisspellinganidentifier,keyword,oroperatorSyntactic,suchasanarithmeticexpressionwithunbalancedparenthesesSemantic,patibleoperandLogical,suchasaninfinitelyrecursivecallCHAPTER4SyntaxANALYSIS Section1TheRoleoftheParser4、SyntaxErrorhandling2)Simple-to-uratelyItshouldrecoverf

编译原理课件PPT 第4章 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数196
  • 收藏数0 收藏
  • 顶次数0
  • 上传人dyx110
  • 文件大小1.46 MB
  • 时间2020-09-23