Computer Science > Programming Languages
[Submitted on 26 May 2014 (this version), latest version 13 Jul 2016 (v3)]
Title:Error Reporting in Parsing Expression Grammars
View PDFAbstract:Parsing Expression Grammars (PEGs) are a formalism to describe a top-down parser for a language. However, error handling techniques that are often applied to top-down parsers are not directly applicable to PEGs. This problem is usually solved in PEG implementations by using an heuristic that helps to simulate the error reporting technique from top-down parsers. We show how implementations that have semantic actions can have grammars that use this heuristic even if the implementation does not implement it direcly. We also add this heuristic to a formal semantics of PEGs.
We also propose a complementary error reporting strategy that can lead to better error messages: labeled failures. This approach is inspired by standard 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 not only give a way to annotate grammars for better error reporting, but also are expressive enough to express some of the error reporting strategies used by deterministic parser combinators, and give a way of encoding predictive top-down parsing in a PEG.
Submission history
From: Sérgio Medeiros [view email][v1] Mon, 26 May 2014 17:14:52 UTC (23 KB)
[v2] Tue, 23 Feb 2016 13:24:53 UTC (27 KB)
[v3] Wed, 13 Jul 2016 15:33:47 UTC (27 KB)
Bibliographic and Citation Tools
Bibliographic Explorer (What is the Explorer?)
Connected Papers (What is Connected Papers?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)
Code, Data and Media Associated with this Article
alphaXiv (What is alphaXiv?)
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Hugging Face (What is Huggingface?)
Papers with Code (What is Papers with Code?)
ScienceCast (What is ScienceCast?)
Demos
Recommenders and Search Tools
Influence Flower (What are Influence Flowers?)
CORE Recommender (What is CORE?)
arXivLabs: experimental projects with community collaborators
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.