版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Chapter3Context-FreegrammarsandParsingInstructorJianhuiYueSoftwareCollegeSCUcompilerscu2lcnChapter31IntroductionParsingisthetaskofdeterminingthesyntax,orstructure,ofaprogramItisalsocalledsyntaxanalysisThesyntaxofaprogramminglanguageisusuallyivenbythegrammarrulesofacontext-freegrammaITherulesofcontext-freegrammararerecursiveDatastructuresrepresentingthesyntacticstructurearealsorecursive-aparsetreeorsyntaxtreeIntroduction2TheParsingProcessparserScqucnceoftokenSyntaxtreeUsually,thesequenceoftokensisnotanexplicitinputparameter,buttheparsercallsascannerproceduresuchasgetTokentofetchthenexttokenfromtheinputasitisneededduringtheparserprocessTheParsingProcess3Context-FreeGrammarsAcontext-freegrammarisaspecificationforthesyntacticstructureofaprogramminglanguageContext-freegrammarinvolvesrecursiverules·Exampleintegerarithmeticexpressionswithadditions,subtraction,andmultiplicationoperationsexp>expopexpI(exp)inumberOp->+|-1非Context-FreeGrammars4BNFNamesarewritteninitalicexp->expopexpI(exp)InumbermetasymbolforchoiceConcatenationisusedasastandardoperation°Norepetitions-isusedtoexpressthedefinitionsofnamesRegularexpressionsareusedascomponentsThenotationwasdevelopedbyJohnBackusandadaptedbyPeterNaurThegrammarrulesinthisformaresaidtobeinBackus-NaurformorbneBNF5编译原理上下无关文法与文法分析课件6编译原理上下无关文法与文法分析课件7编译原理上下无关文法与文法分析课件8编译原理上下无关文法与文法分析课件9编译原理上下无关文法与文法分析课件10编译原理上下无关文法与文法分析课件11编译原理上下无关文法与文法分析课件12编译原理上下无关文法与文法分析课件13编译原理上下无关文法与文法分析课件14编译原理上下无关文法与文法分析课件15编译原理上下无关文法与文法分析课件16编译原理上下无关文法与文法分析课件17编译原理上下无关文法与文法分析课件18编译原理上下无关文法与文法分析课件19编译原理上下无关文法与文法分析课件20编译原理上下无关文法与文法分析课件21编译原理上下无关文法与文法分析课件22编译原理上下无关文法与文法分析课件23编译原理上下无关文法与文法分析课件24编译原理上下无关文法与文法分析课件25编译原理上下无关文法与文法分析课件26编译原理上下无关文法与文法分析课件27编译原理上下无关文法与文法分析课件28编译原理上下无关文法与文法分析课件29编译原理上下无关文法与文法分析课件30编译原理上下无关文法与文法分析课件31编译原理上下无关文法与文法分析课件32编译原理上下无关文法与文法分析课件33编译原理上下无关文法与文法分析课件34编译原理上下无关文法与文法分析课件35编译原理上下无关文法与文法分析课件36编译原理上下无关文法与文法分析课件37编译原理上下无关文法与文法分析课件38编译原理上下无关文法与文法分析课件39编译原理上下无关文法与文法分析课件40编译原理上下无关文法与文法分析课件41编译原理上下无关文法与文法分析课件42Chapter3Context-FreegrammarsandParsingInstructorJianhuiYueSoftwareCollegeSCUcompilerscu2lcnChapter343IntroductionParsingisthetaskofdeterminingthesyntax,orstructure,ofaprogramItisalsocalledsyntaxanalysisThesyntaxofaprogramminglanguageisusuallyivenbythegrammarrulesofacontext-freegrammaITherulesofcontext-freegrammararerecursiveDatastructuresrepresentingthesyntacticstructurearealsorecursive-aparsetreeorsyntaxtreeIntroduction44TheParsingProcessparserScqucnceoftokenSyntaxtreeUsually,thesequenceoftokensisnotanexplicitinputparameter,buttheparsercallsascannerproceduresuchasgetTokentofetchthenexttokenfromtheinputasitisneededduringtheparserprocessTheParsingProcess45Context-FreeGrammarsAcontext-freegrammarisaspecificationforthesyntacticstructureofaprogramminglanguageContext-freegrammarinvolvesrecursiverules·Exampleintegerarithmeticexpressionswithadditions,subtraction,andmultiplicationoperationsexp>expopexpI(exp)inumberOp->+|-1非Context-FreeGrammars46BNFNamesarewritteninitalicexp->expopexpI(exp)InumbermetasymbolforchoiceConcatenationisusedasastandardoperation°Norepetitions-isusedtoexpressthedefinitionsofnamesRegularexpressionsareusedascomponentsThenotationwasdevelopedbyJohnBackusandadaptedbyPeterNaurThegrammarrulesinthisformaresaidtobeinBackus-NaurformorbneBNF47编译原理上下无关文法与文法分析课件48编译原理上下无关文法与文法分析课件49编译原理上下无关文法与文法分析课件50编译原理上下无关文法与文法分析课件51编译原理上下无关文法与文法分析课件52编译原理上下无关文法与文法分析课件53编译原理上下无关文法与文法分析课件54编译原理上下无关文法与文法分析课件55编译原理上下无关文法与文法分析课件56编译原理上下无关文法与文法分析课件57编译原理上下无关文法与文法分析课件58编译原理上下无关文法与文法分析课件59编译原理上下无关文法与文法分析课件60编译原理上下无关文法与文法分析课件61编译原理上下无关文法与文法分析课件62编译原理上下无关文法与文法分析课件63编译原理上下无关文法与文法分析课件64编译原理上下无关文法与文法分析课件65编译原理上下无关文法与文法分析课件66编译原理上下无关文法与文法分析课件67编译原理上下无关文法与文法分析课件68编译原理上下无关文法与文法分析课件69编译原理上下无关文法与文法分析课件70编译原理上下无关文法与文法分析课件71编译原理上下无关文法与文法分析课件72编译原理上下无关文法与文法分析课件73编译原理
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 骨科患者压疮风险管理与预防
- 江苏省南通市崇川区达标名校2025-2026学年初三(下)4月联考数学试题试卷含解析
- 颈椎损伤患者康复护理经验总结
- 江苏省苏州市张家港市梁丰初级中学2026年初三第二次调研(3月二模)数学试题试卷含解析
- 吉林省长春市吉大尚德校2026年初三二模突破冲刺数学试题(一)含解析
- 2026年四川省绵阳富乐国际初三第二学期期末质量调研数学试题(文理合卷)试题含解析
- 山东省滨州市阳信县重点名校2025-2026学年初三下学期3月调研考试物理试题试卷含解析
- 北京六十六中学2025-2026学年初三5月第二次联考数学试题含解析
- 四川省师大一中学2026届初三下学期周考数学试题(重点)试题含解析
- 广东省深圳市龙华新区达标名校2026届初三物理试题下学期3月教学质量监测考试试卷含解析
- 三级 模块二 项目六 功能促进 任务三 指导或协助老年人使用安全防护性辅助器具
- (2024)国家电网招聘考试题库(含答案)
- 20220726SAP EWM高级仓库管理解决方案(官方材料)
- 自动化设备可行性方案
- 网络安全与信息素养课件
- 国画竹子课件
- 不一样的卡梅拉2-我想有颗星星
- 1999年制干部履历表8k
- 中国普通食物营养成分表一览
- 潜水医学PPT完整全套教学课件
- 水稻病虫害综合防治课件
评论
0/150
提交评论