- 2
- 0
- 约1.65千字
- 约 5页
- 2017-04-11 发布于上海
- 举报
Errorrecoveryinpredictiveparsing
Error recovery in predictive parsing An error is detected during the predictive parsing when the terminal on top of the stack does not match the next input symbol, or when nonterminal A on top of the stack, a is the next input symbol, and parsing table entry M[A,a] is empty. Panic-mode error recovery is based on the idea of skipping symbols on the input until a token in a selected set of synchronizing tokens. How to select synchronizing set? Place all symbols in FOLLOW(A) into the synchronizing set for nonterminal A. If we skip tokens until an element of FOLLOW(A) is seen and pop A from the stack, it likely that parsing can continue. We might add keywords that begins statements to the synchronizing sets for the nonterminals generating expressions. How to select synchronizing set? (II) If a nonterminal can generate the empty string, then the production deriving ? can be used as a default. This may postpone some error detection, but cannot cause an error to be missed. This approach reduces the number of nonterminals that have to be considered during error recovery. If a terminal on top of stack cannot be matched, a simple idea is to pop the terminal, issue a message saying that the terminal was inserted. Example: error recovery Example: error recovery (II) * “synch” indicating synchronizing tokens obtained from FOLLOW set of the nonterminal in question. If the parser looks up entry M[A,a] and finds that it is blank, the input symbol a is skipped. If the entry is synch, the the nonterminal on top of the stack is popped. If a token on top of the stack does not match the input symbol, then we pop the token from the stack. *
您可能关注的文档
- DalianNovemberth.ppt
- D7对坐标曲线积分.ppt
- D5对弧长和曲线积分.ppt
- DatabaseSystems数据库管理系统.ppt
- DataandComputerCommunications.ppt
- DataCommunicationsandNetworking.ppt
- DataCommunicationsandNetworksOverview.ppt
- DataSmoothing.ppt
- DataRepresentation.ppt
- DATASTRUCTURE.ppt
- 【高清可复制】3-中南标11ZJ111-11ZJ203-11ZJ311_1-50.pdf
- CN119911029A 一种生漆朱砂工艺品及其制作方法 (中华全国供销合作总社西安生漆涂料研究所).docx
- (正式版)DB50∕T 801-2017 《渝小吃 麻辣豆鱼烹饪技术规范》.docx
- (正式版)DB50∕T 812-2017 《渝小吃 油茶烹饪技术规范》.docx
- (正式版)DB50∕T 816-2017 《渝小吃 山城小汤圆烹饪技术规范》.docx
- (正式版)DB50∕T 867.4-2019 《安全生产技术规范 第4部分 油气开采企业》.docx
- (正式版)DB50∕T 733-2016 《农村复垦宅基地价值转换测评技术规范》.docx
- CN119834053A 一种电注入锗锡激光器芯片及其制作方法 (广东省大湾区集成电路与系统应用研究院).docx
- CN119785661A 一种页岩油物理模型制作方法 (中国石油化工股份有限公司).docx
- (正式版)DB50∕T 907-2019 《丰产桑园栽培技术规程》.docx
原创力文档

文档评论(0)