Title
Error Reporting in Parsing Expression Grammars.
Abstract
We discuss strategies for error reporting in Parsing Expression Grammars.We show that we can use a popular strategy in any implementation with semantic actions.We show a novel error reporting strategy based on labeled failures.We compare the quality of error reporting of the two strategies.We show that labeled failures can encode other error reporting strategies. 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 deterministic parser combinators, and to encode predictive top-down parsing in a PEG.
Year
DOI
Venue
2014
10.1016/j.scico.2016.08.004
Sci. Comput. Program.
Keywords
Field
DocType
Parsing,Error reporting,Parsing expression grammars,Packrat parsing,Parser combinators
Top-down parsing language,Top-down parsing,Programming language,S-attributed grammar,L-attributed grammar,Computer science,Bottom-up parsing,Parsing expression grammar,Natural language processing,Artificial intelligence,Parsing,Parser combinator
Journal
Volume
Issue
ISSN
abs/1405.6646
P1
0167-6423
Citations 
PageRank 
References 
0
0.34
0
Authors
4
Name
Order
Citations
PageRank
André Murbach Maidl1173.10
Sérgio Medeiros2283.31
Fabio Mascarenhas3285.29
Roberto Ierusalimschy446354.25