A practical method for syntactic error diagnosis and recovery

M. Burke, Gerald A. Fisher
{"title":"A practical method for syntactic error diagnosis and recovery","authors":"M. Burke, Gerald A. Fisher","doi":"10.1145/800230.806981","DOIUrl":null,"url":null,"abstract":"Our goal is to develop a practical syntactic error recovery method applicable within the general framework of viable prefix parsing. Our method represents an attempt to accurately diagnose and report all syntax errors without reporting errors that are not actually present. Successful recovery depends upon accurate diagnosis of errors together with sensible “correction” or alteration of the text to put the parse back on track. The issuing of accurate and helpful diagnostics is achieved by indicating the nature of the recovery made for each error encountered. The error recovery is prior to and independent of any semantic analysis of the program. However, the method does not exclude the invocation of semantic actions while parsing or preclude the use of semantic information for error recovery.\n The method assumes a framework in which an LR or LL parser, driven by the tables produced by a parser generator, maintains an input symbol buffer, state or prediction stack, and parse stack. The input symbol buffer contains part or all of the sequence of remaining input tokens, including the current token. The LR state stack is analogous to the LL prediction stack; except when restricting our attention to the LL case, prediction stack shall serve as a generic term indicating the LR state or LL prediction stack. The parse stack contains the symbols of the right hand sides that have not yet been reduced.","PeriodicalId":414056,"journal":{"name":"SIGPLAN Conferences and Workshops","volume":"39 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2015-09-04","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"21","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"SIGPLAN Conferences and Workshops","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/800230.806981","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 21

Abstract

Our goal is to develop a practical syntactic error recovery method applicable within the general framework of viable prefix parsing. Our method represents an attempt to accurately diagnose and report all syntax errors without reporting errors that are not actually present. Successful recovery depends upon accurate diagnosis of errors together with sensible “correction” or alteration of the text to put the parse back on track. The issuing of accurate and helpful diagnostics is achieved by indicating the nature of the recovery made for each error encountered. The error recovery is prior to and independent of any semantic analysis of the program. However, the method does not exclude the invocation of semantic actions while parsing or preclude the use of semantic information for error recovery. The method assumes a framework in which an LR or LL parser, driven by the tables produced by a parser generator, maintains an input symbol buffer, state or prediction stack, and parse stack. The input symbol buffer contains part or all of the sequence of remaining input tokens, including the current token. The LR state stack is analogous to the LL prediction stack; except when restricting our attention to the LL case, prediction stack shall serve as a generic term indicating the LR state or LL prediction stack. The parse stack contains the symbols of the right hand sides that have not yet been reduced.
一种实用的语法错误诊断和恢复方法
我们的目标是开发一种实用的语法错误恢复方法,适用于可行的前缀解析的一般框架。我们的方法尝试准确地诊断和报告所有语法错误,而不报告实际不存在的错误。成功的恢复取决于对错误的准确诊断,以及合理的“纠正”或修改文本,以使解析回到正轨。通过指出针对遇到的每个错误所进行的恢复的性质,可以发布准确而有用的诊断。错误恢复先于程序的任何语义分析,并且独立于此。但是,该方法不排除在解析时调用语义操作,也不排除使用语义信息进行错误恢复。该方法假设一个框架,在该框架中,由解析器生成器生成的表驱动的LR或LL解析器维护输入符号缓冲区、状态或预测堆栈以及解析堆栈。输入符号缓冲区包含剩余输入符号序列的部分或全部,包括当前符号。LR状态堆栈类似于LL预测堆栈;除了将我们的注意力限制在LL情况外,预测堆栈应作为表示LR状态或LL预测堆栈的通称。解析堆栈包含右手边尚未简化的符号。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信