Lune

PLDI2023Top-tier venue

flap: A Deterministic Parser with Fused Lexing

Jeremy Yallop, Ningning Xie, Neel Krishnaswami

Abstract

Lexers and parsers are typically defined separately and connected by a token stream. This separate definition is important for modularity and reduces the potential for parsing ambiguity. However, materializing tokens as data structures and case-switching on tokens comes with a cost.

We show how to fuse separately-defined lexers and parsers, drastically improving performance without compromising modularity or increasing ambiguity. We propose a deterministic variant of Greibach Normal Form that ensures deterministic parsing with a single token of lookahead and makes fusion strikingly simple, and prove that normalizing context free expressions into the deterministic normal form is semantics-preserving. Our staged parser combinator library, flap, provides a standard interface, but generates specialized token-free code that runs two to six times faster than ocamlyacc on a range of benchmarks.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Handling Scope Checks: A Comparative Framework for Dynamic Scope Extrusion ChecksMichael Lee, Ningning Xie, Oleg Kiselyov, Jeremy YallopPOPL 2026 · 3 citations
  2. Fail Faster: Staging and Fast Randomness for High-Performance PBTCynthia Richey, Joseph W. Cutler, Harrison Goldstein, Benjamin C. PierceOOPSLA 2026 · 1 citation

Builds on1

  1. A practical mode system for recursive definitionsAlban Reynaud, Gabriel Scherer, Jeremy YallopPOPL 2021 · 2 citations

Related papers

  1. Statically Resolvable AmbiguityViktor Palmkvist, Elias Castegren, Philipp Haller, David BromanPOPL 2023 · 1 citation
  2. Zippy LL(1) parsing with derivativesRomain Edelmann, Jad Hamza, Viktor KuncakPLDI 2020 · 13 citations
  3. Faster general parsing through context-free memoizationGrzegorz HermanPLDI 2020 · 4 citations
  4. Intrinsic Verification of Parsers and Formal Grammar Theory in Dependent Lambek CalculusSteven Schaefer, Nathan Varner, Pedro Henrique Azevedo de Amorim, Max S. NewPLDI 2025
  5. MRL Parsing Without Tears: The Case of HebrewShaltiel Shmidman, Avi Shmidman, Moshe Koppel, Reut TsarfatyACL Findings 2024 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines