《编译原理》课程教学资源(PPT课件讲稿)语法分析 Syntax analysis(自底向上分析 Bottom-Up Parsing)

Syntax analysis PartⅡI Chapter 4

2 Bottom-Up Parsing . LR methods (Left-to-right, Rightmost derivation) - SLR, Canonical LR, LALR .Other special cases: - Shift-reduce parsing - Operator-precedence parsing

Operator-Precedence Parsin g Special case of shift-reduce parsing We will not further discuss(you can skip textbook section 4.6)

Shift-Reduce parsing Grammar Reducing a sentence: Shift-reduce corresponds S→ aBE abbcde to a rightmost derivation A→ Abel abcde S→aABe B→d d e a ad e a abe a abcde These match a bbcde roduction's p right-hand sides A A A B B a bbcd ea bbcd ea bbcd ea b bcd

andles a handle is a substring of gr rammar svmbols in a right-sentential form that matches a right-hand side of a production lamma abode S→aABe Abcde A→ Abclb aade H anale B→d a abe a bbcd e a abcde NOT a handle. because aaae further reductions will fail (result is not a sentential form)

Stack Implementation of Shift-Reduce parsing Stack Input Action d+idids shift + id"$ reduce E→id How to Grammar SE +id*ids shift SE+ id"ids shift resolve E→E+E SE+id sids| reduce E→id conflicts? E→E*E SE+E "ids shift(or reduce?) E→(E) SE+E d$ shift E→id SE+Eid s| reduce E→id SE+EE duce e E SE+E uceE→E Find handles E accept to reduce

Conflicts Shift-reduce and reduce-reduce conflicts are caused by The limitations of the LR parsing method(even when the grammar is unambiguous ambiguity of the grammar

Shift-Reduce parsing Shift-reduce conflicts Stack Input Action S. if E then S else. s shift or reduce? Ambiguous grammar S→ if e then s I if e then s else s I other R esolve in ravor of shift so else matches closest if

Shift-Reduce parsing Reduce-Reduce conflicts Stack Input Action $shift a$ reduce A→aorB→a? Grammar C→AB A B R esolve in favor of reduce A otherwise were stuck!

ROK Parsers: USe a dFa for Shift /reduce decisions start State l State l gotone C→AB lamma State goto(L,, B S→C l6: State l S→"goto(l4 C→AB C→AB C→·AB A B a oto(, a) B C an onlv goto(lo, a) State I State l reduce A→a B A→a B→a)
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《计算机网络安全》课程教学资源(PPT课件讲稿)第二章 密码学技术.ppt
- 《软件工程》课程教学资源(PPT课件讲稿)第7章 软件测试.ppt
- 上海交通厌:《通信网络》课程教学资源(PPT讲稿)DELAY MODELS IN DATA NETWORKS、LITTLE’S LAW、ARRIVAL MODEL、M/M/X QUEUING MODELS.pptx
- 《高级语言程序设计》课程教学资源(试卷习题)试题四(无答案).doc
- 《计算机网络和因特网》教学资源(PPT讲稿)网络互连(概念, IP 地址, IP 路由, IP 数据报, 地址解析).ppt
- 西安交通大学:《网络与信息安全》课程PPT教学课件(网络入侵与防范)身份认证.ppt
- 《计算机基础及C语言程序设计》课程PPT教学课件(讲稿)第1章 概论.ppt
- 《SQL基础教程》课程教学资源(PPT课件讲稿)第6章 数据操作与SQL语句.ppt
- 河南中医药大学:《网络技术实训》课程教学资源(PPT课件讲稿)第一阶段 组网(主讲:路景鑫).pptx
- 南京大学:《编译原理》课程教学资源(PPT课件讲稿)第五章 语法制导的翻译.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)第7章 多处理器及线程级并行.ppt
- 上海交通大学:《程序设计》课程教学资源(PPT课件讲稿)第14章 输入输出与文件.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)第5章 指令级并行.pptx
- 档案数字化基本程序与要求(PPT讲稿).ppt
- Computer Graphics(PPT讲稿)INFORMATION VISUALIZATION.pptx
- 北京大学:C++模板与STL库介绍(PPT讲稿).ppt
- 《数据库基础》课程教学资源(PPT课件讲稿)第四章 数据查询.ppt
- 《网络搜索和挖掘关键技术 Web Search and Mining》课程教学资源(PPT讲稿)Lecture 08 Scoring and results assembly.ppt
- 上海海事大学:《数字图像处理》课程教学资源(PPT课件讲稿)Unit 7 Introduction to Digital Image Processing.ppt
- Performance Evaluation of Long Range Dependent Queues(PPT讲稿).pptx
- 中国人民大学:《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第一章 绪论.ppt
- 《计算机组成原理》课程教学资源(PPT课件讲稿)第四章 存储器.ppt
- 随机图与复杂网络(PPT讲稿)随机演化博弈的算法研究及其在复杂网络中的应用.ppt
- 四川大学:《操作系统 Operating System》课程教学资源(PPT课件讲稿)Chapter 3 Process Description and Control.ppt
- 《软件工程》课程教学资源(PPT课件讲稿)第3章 软件需求分析.ppt
- 《PHP程序设计》教学资源(PPT课件讲稿)项目四 面向对象网站开发.ppt
- 数据挖掘实现的住院病人的实时预警(PPT讲稿)Real-Time Clinical Warning for Hospitalized Patients via Data Mining.pptx
- 《机器学习》课程教学资源(PPT课件讲稿)第六章 特征降维和选择.ppt
- 《C语言程序设计》课程教学资源(PPT课件讲稿)第4章 选择结构程序设计.ppt
- 苏州大学:《中文信息处理》课程教学资源(PPT课件讲稿)第二章 汉字代码体系.ppt
- 南京大学:模型检验(PPT课件讲稿)model checking.pptx
- 《单片机原理与其应用》课程教学资源(PPT课件讲稿)第8章 单片机的存储器的扩展.pptx
- 并发程序精化验证及其应用(PPT讲稿)Refinement Verification of Concurrent Programs and Its Applications.pptx
- 《计算机网络安全》课程电子教案(PPT教学课件)第一章 计算机网络安全概述.ppt
- 《Computer Networking:A Top Down Approach》英文教材教学资源(PPT课件讲稿,3rd edition)Chapter 5 Link Layer and LANs.pps
- 上海交通大学:操作系统安全(PPT课件讲稿)操作系统安全 OS Security(邹恒明).pps
- 某高校计算机专业课程教学大纲合集(汇编).pdf
- 电子科技大学:《网络安全与网络工程》课程教学资源(PPT课件讲稿)第六章 杂凑函数(主讲:聂旭云).ppt
- 中国科学技术大学:《嵌入式操作系统 Embedded Operating Systems》课程教学资源(PPT课件讲稿)第六讲 死锁及其处理.ppt
- 西华大学:《电子商务概论》课程教学资源(PPT课件讲稿)第7章 电子商务物流.ppt