首页> 外文期刊>ACM Transactions on Programming Languages and Systems >Generating LR Syntax Error Messages from Examples
【24h】

Generating LR Syntax Error Messages from Examples

机译:从示例生成LR语法错误消息

获取原文
获取原文并翻译 | 示例

摘要

LR parser generators are powerful and well-understood, but the parsers they generate are not suited to provide good error messages. Many compilers incur extensive modifications to the source grammar to produce useful syntax error messages. Interpreting the parse state (and input token) at the time of error is a nonintrusive alternative that does not entangle the error recovery mechanism in error message production. Unfortunately, every change to the grammar may significantly alter the mapping from parse states to diagnostic messages, creating a maintenance problem. Merr is a tool that allows a compiler writer to associate diagnostic messages with syntax errors by example, avoiding the need to add error productions to the grammar or interpret integer parse states. From a specification of errors and messages, Merr runs the compiler on each example error to obtain the relevant parse state and input token, and generates a yyerror ( ) function that maps parse states and input tokens to diagnostic messages. Merr enables useful syntax error messages in LR-based compilers in a manner that is robust in the presence of grammar changes.
机译:LR解析器生成器功能强大且易于理解,但是它们生成的解析器不适合提供良好的错误消息。许多编译器都会对源语法进行大量修改,以产生有用的语法错误消息。解释发生错误时的解析状态(和输入令牌)是一种非侵入性的选择,它不会纠缠错误消息生成中的错误恢复机制。不幸的是,对语法的每次更改都可能会大大改变从解析状态到诊断消息的映射,从而造成维护问题。 Merr是一个工具,它使编译器编写器可以通过示例将诊断消息与语法错误相关联,而无需在语法中添加错误产生或解释整数解析状态。根据错误和消息的规范,Merr对每个示例错误运行编译器以获得相关的解析状态和输入令牌,并生成yyerror()函数,将解析状态和输入令牌映射到诊断消息。 Merr以一种在存在语法更改的情况下很健壮的方式在基于LR的编译器中启用有用的语法错误消息。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号