Optimizing Parser Combinators

Jan Kurš, Jan Vraný, Mohammad Ghafari, Mircea Lungu, Oscar Nierstrasz
<span title="">2016</span> <i title="ACM Press"> Proceedings of the 11th edition of the International Workshop on Smalltalk Technologies - IWST&#39;16 </i> &nbsp;
Parser combinators are a popular approach to parsing. Parser combinators 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, their universality and flexibility introduces a noticeable performance overhead. Time-wise, parser combinators cannot compete with parsers generated by well-performing parser generators or optimized hand-written code. Techniques exist to
more &raquo; ... eve a linear asymptotic performance of parser combinators, yet there is still a significant constant multiplier. This can be further lowered using meta-programming techniques. In this work we present a more traditional approach to optimization -a compiler -applied to the domain of parser combinators. A parser combinator compiler (pc-compiler) analyzes a parser combinator, applies parser combinator-specific optimizations and, generates an equivalent high-performance top-down parser. Such a compiler preserves the advantages of parser combinators while complementing them with better performance. 1 https://github.com/sirthias/parboiled2 2
<span class="external-identifiers"> <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/10.1145/2991041.2991042">doi:10.1145/2991041.2991042</a> <a target="_blank" rel="external noopener" href="https://fatcat.wiki/release/tdgyvsvmpnd7tgv2mhwbkin74a">fatcat:tdgyvsvmpnd7tgv2mhwbkin74a</a> </span>
<a target="_blank" rel="noopener" href="https://web.archive.org/web/20160928225615/http://scg.unibe.ch:80/archive/papers/Kurs16a-Compiler.pdf" title="fulltext PDF download" data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"> <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> Web Archive [PDF] <div class="menu fulltext-thumbnail"> <img src="https://blobs.fatcat.wiki/thumbnail/pdf/0d/5f/0d5fbd3a705193cd147710ba91508afb2a6f00c1.180px.jpg" alt="fulltext thumbnail" loading="lazy"> </div> </button> </a> <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/10.1145/2991041.2991042"> <button class="ui left aligned compact blue labeled icon button serp-button"> <i class="external alternate icon"></i> acm.org </button> </a>