Data and Documentation
Open Data Policy
FAQ
EN
DE
FR
Suchbegriff
Advanced search
Publication
Back to overview
Efficient parsing with parser combinators
Type of publication
Peer-reviewed
Publikationsform
Original article (peer-reviewed)
Author
Kurš Jan, Vraný Jan, Ghafari Mohammad, Lungu Mircea, Nierstrasz Oscar,
Project
Agile Software Analysis
Show all
Original article (peer-reviewed)
Journal
Science of Computer Programming
Publisher
Elsevier
Volume (Issue)
161
Page(s)
57 - 88
Title of proceedings
Science of Computer Programming
DOI
10.1016/j.scico.2017.12.001
Open Access
URL
http://scg.unibe.ch/archive/papers/Kurs17a.pdf
Type of Open Access
Website
Abstract
Abstract Parser combinators offer a universal and flexible approach to parsing. They follow the structure of an underlying grammar, are modular, well-structured, easy to maintain, and can recognize a large variety of languages including context-sensitive ones. However, these advantages introduce a noticeable performance overhead mainly because the same powerful parsing algorithm is used to recognize even simple languages. Time-wise, parser combinators cannot compete with parsers generated by well-performing parser generators or optimized hand-written code. Techniques exist to achieve a linear asymptotic performance of parser combinators, yet there is a significant constant multiplier. The multiplier can be lowered to some degree, but this requires advanced meta-programming techniques, such as staging or macros, that depend heavily on the underlying language technology. In this work we present a language-agnostic solution. We optimize the performance of parsing combinators with specializations of parsing strategies. For each combinator, we analyze the language parsed by the combinator and choose the most efficient parsing strategy. By adapting a parsing strategy for different parser combinators we achieve performance comparable to that of hand-written or optimized parsers while preserving the advantages of parsers combinators.
-