Syntax Repair as Language Intersection

๐Ÿ“… 2025-07-15
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF

career value

152K/year
๐Ÿค– AI Summary
This work addresses automatic grammar error repair for arbitrary context-free languages (CFLs). We propose a novel formal-language-theoretic approach that models repair as computing the intersection of the language of syntactically correct strings with a finite language constrained by bounded edit distance. We establish, for the first time, a theoretical connection between the Bar-Hillel construction and CFL reachability, proving that syntactic repairability under finite typing edits is decidable in NCยนโ€”i.e., in logarithmic parallel time. Building on this insight, we design an efficient repair enumeration algorithm based on Brzozowski derivatives. Evaluated on a Python syntax repair benchmark, our method achieves state-of-the-art performance, demonstrating both theoretical depth and practical efficacy.

Technology Category

Application Category

๐Ÿ“ 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.
Problem

Research questions and friction points this paper is trying to address.

Repairing syntax errors in context-free languages
Modeling syntax repair via language intersection
Deciding repairability in polylogarithmic parallel time
Innovation

Methods, ideas, or system contributions that make the work stand out.

Models syntax repair as language intersection
Uses Bar-Hillel construction and CFL reachability
Employs Brzozowski derivative for enumeration
๐Ÿ”Ž Similar Papers