Affiliation:
1. New Mexico State University, Las Cruces, NM
Abstract
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.
Publisher
Association for Computing Machinery (ACM)
Reference16 articles.
1. Error messages
2. Design and implementation of a diagnostic compiler for PL/I
3. GNU-Project. 2001. GNU C Compiler Source Distribution Version 3.0. Available online at www.gnu.org. Source files c-parse.y and java/parse.y were used in this paper. GNU-Project. 2001. GNU C Compiler Source Distribution Version 3.0. Available online at www.gnu.org. Source files c-parse.y and java/parse.y were used in this paper.
4. Practical LR error recovery
5. Eli: a complete, flexible compiler construction system
Cited by
20 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Comparison of Leading Language Parsers – ANTLR, JavaCC, SableCC, Tree-sitter, Yacc, Bison;2023 13th International Conference on Software Technology and Engineering (ICSTE);2023-10-27
2. OrdinalFix: Fixing Compilation Errors via Shortest-Path CFL Reachability;2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE);2023-09-11
3. Techniques for Enhancing Compiler Error Messages;Proceedings of the 2022 ACM Conference on International Computing Education Research - Volume 2;2022-08-07
4. Faster reachability analysis for LR(1) parsers;Proceedings of the 14th ACM SIGPLAN International Conference on Software Language Engineering;2021-10-17
5. CoStar: a verified ALL(*) parser;Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation;2021-06-18