Grammar Repair with Examples and Tree Automata: Extended Version
Yunjeong Lee, Gokul Rajiv, Ilya Sergey

TL;DR
This paper introduces a novel method for repairing ambiguous context-free grammars using tree automata learned from examples, ensuring unambiguous, user-preferred syntax suitable for parser generation.
Contribution
It presents a new tree automata learning algorithm and an efficient intersection method, enabling automated grammar repair based on user examples, improving parser correctness.
Findings
The approach effectively repairs ambiguous grammars in case studies.
The algorithms are proven sound and implemented in the Greta tool.
Automated grammar repair aligns with user preferences for syntax.
Abstract
Context-free grammars (CFGs) are the de-facto formalism for declaratively describing concrete syntax for programming languages and generating parsers. One of the major challenges in defining a desired syntax is ruling out all possible ambiguities in the CFG productions that determine scoping rules as well as operator precedence and associativity. Practical tools for parser generation typically apply ad-hoc approaches for resolving such ambiguities, which might result in a parser's behavior that contradicts the intents of the language designer. In this work, we present a user-friendly approach to soundly repair grammars with ambiguities, which is inspired by the programming by example line of research in automated program synthesis. At the heart of our approach is the interpretation of both the initial CFG and additional examples that define the desired restrictions in precedence and…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Formal Methods in Verification · Software Testing and Debugging Techniques
