English

Syntax Repair as Language Intersection

Formal Languages and Automata Theory 2025-07-18 v2 Programming Languages

Abstract

We introduce a new technique for repairing syntax errors in arbitrary context-free languages. This technique models syntax repair as a language intersection problem by defining a finite language that provably generates every syntactically valid repair within a given edit distance. Leveraging a theoretical connection between the Bar-Hillel construction from formal language theory and CFL reachability from program analysis, we show that repairability in a finite number of typographic edits is polylogarithmic parallel time decidable and provide an enumeration algorithm based on the Brzozowski derivative. Finally, we evaluate this algorithm and its implementation, demonstrating state-of-the-art results on a Python syntax repair benchmark.

Cite

@article{arxiv.2507.11873,
  title  = {Syntax Repair as Language Intersection},
  author = {Breandan Considine},
  journal= {arXiv preprint arXiv:2507.11873},
  year   = {2025}
}
R2 v1 2026-07-01T04:03:32.107Z