Faster general parsing through context-free memoization
Grzegorz Herman
Abstract
We present a novel parsing algorithm for all context-free languages. The algorithm features a clean mathematical formulation: parsing is expressed as a series of standard operations on regular languages and relations. Parsing complexity w.r.t. input length matches the state of the art: it is worst-case cubic, quadratic for unambiguous grammars, and linear for LR-regular grammars. What distinguishes our approach is that parsing can be implemented using only immutable, acyclic data structures. We also propose a parsing optimization technique called context-free memoization. It allows handling an overwhelming majority of input symbols using a simple stack and a lookup table, similarly to the operation of a deterministic LR(1) parser. This allows our proof-of-concept implementation to outperform the best current implementations of common generalized parsing algorithms (Earley, GLR, and GLL). Tested on a large Java source corpus, parsing is 3–5 times faster, while recognition—35 times faster.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get cda1c716-33a4-40ab-ab20-17712f44947aCited by top-tier papers1
Ask how each one uses itRelated papers
- Efficient Semiring-Weighted Earley ParsingAndreas Opedal, Ran Zmigrod, Tim Vieira, Ryan Cotterell et al.ACL 2023 · 6 citations
- Zippy LL(1) parsing with derivativesRomain Edelmann, Jad Hamza, Viktor KuncakPLDI 2020 · 13 citations
- Algorithms for Weighted Pushdown AutomataAlexandra Butoi, Brian DuSell, Tim Vieira, Ryan Cotterell et al.EMNLP 2022 · 2 citations
- CoStar: a verified ALL(*) parserSam Lasser, Chris Casinghino, Kathleen Fisher, Cody RouxPLDI 2021 · 10 citations
- Learning Highly Recursive Input GrammarsNeil Kulkarni, Caroline Lemieux, Koushik SenASE 2021 · 24 citations
