Efficient parsing with parser combinators

Kurš, Jan; Ghafari, Mohammad; Lungu, Mircea; Nierstrasz, Oscar Marius (2018). Efficient parsing with parser combinators. Science of computer programming, 161, pp. 57-88. Elsevier 10.1016/j.scico.2017.12.001

[img] Text
1-s2.0-S0167642317302654-main.pdf - Published Version
Restricted to registered users only
Available under License Publisher holds Copyright.

Download (1MB) | Request a copy
[img] Text
Kurs17a.pdf - Accepted Version
Restricted to registered users only until 9 November 2019.
Available under License Publisher holds Copyright.

Download (1MB) | Request a copy

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.

Item Type:

Journal Article (Original Article)

Division/Institute:

08 Faculty of Science > Institute of Computer Science (INF)
08 Faculty of Science > Institute of Computer Science (INF) > Software Composition Group (SCG)

UniBE Contributor:

Kurs, Jan; Ghafari, Mohammad and Nierstrasz, Oscar Marius

Subjects:

000 Computer science, knowledge & systems
500 Science > 510 Mathematics

ISSN:

0167-6423

Publisher:

Elsevier

Language:

English

Submitter:

Oscar Marius Nierstrasz-Margiotta

Date Deposited:

11 Apr 2018 12:01

Last Modified:

25 May 2018 01:31

Publisher DOI:

10.1016/j.scico.2017.12.001

BORIS DOI:

10.7892/boris.113129

URI:

https://boris.unibe.ch/id/eprint/113129

Actions (login required)

Edit item Edit item
Provide Feedback