Error Reporting in Parsing Expression Grammars
Andr\'e Murbach Maidl, S\'ergio Medeiros, Fabio Mascarenhas, Roberto, Ierusalimschy

TL;DR
This paper explores methods for improving error reporting in Parsing Expression Grammars (PEGs), introducing semantic actions and labeled failures to enhance error messages and debugging capabilities.
Contribution
It proposes novel error reporting techniques for PEGs, including simulating heuristics with semantic actions and introducing labeled failures inspired by exception handling.
Findings
Semantic actions can simulate error-reporting heuristics in PEGs.
Labeled failures enable more expressive and informative error messages.
The approach improves debugging and error diagnosis in PEG-based parsers.
Abstract
Parsing Expression Grammars (PEGs) describe top-down parsers. Unfortunately, the error-reporting techniques used in conventional top-down parsers do not directly apply to parsers based on Parsing Expression Grammars (PEGs), so they have to be somehow simulated. While the PEG formalism has no account of semantic actions, actual PEG implementations add them, and we show how to simulate an error-reporting heuristic through these semantic actions. We also propose a complementary error reporting strategy that may lead to better error messages: labeled failures. This approach is inspired by exception handling of programming languages, and lets a PEG define different kinds of failure, with each ordered choice operator specifying which kinds it catches. Labeled failures give a way to annotate grammars for better error reporting, to express some of the error reporting strategies used by…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Logic, programming, and type systems · Security and Verification in Computing
