Syntactic Completions with Material Obligations

📅 2025-08-22
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing code editors often fail under syntactic errors, and conventional recovery techniques—such as panic-mode parsing or multi-option repair—are either overly aggressive or trigger combinatorial explosion in code completion. This paper introduces *tylr*, a parser-and-edit-generation framework enabling precise autocompletion for erroneous code. Its core innovation lies in formalizing “syntactic obligations”—e.g., missing operands, operators, or keywords—as a unified abstraction; identifying obligations via grammar traversal, resolving ambiguities with grammar zippers, and generating minimal-obligation-driven completions via tile-based operator-precedence parsing. We further design a visual obligation-aware interface that unifies textual and structural editing. The approach is formally specified and empirically validated through a user study, demonstrating significant improvements in edit usability and practicality. *tylr* establishes a new paradigm for human–computer collaborative syntactic repair.

Technology Category

Application Category

📝 Abstract
Code editors provide essential services that help developers understand, navigate, and modify programs. However, these services often fail in the presence of syntax errors. Existing syntax error recovery techniques, like panic mode and multi-option repairs, are either too coarse, e.g. in deleting large swathes of code, or lead to a proliferation of possible completions. This paper introduces $ exttt{tylr}$, a parser and editor generator that completes arbitrarily malformed code by inserting obligations, which generalize holes to cover missing operands, operators, mixfix keywords, and sort transitions. $ exttt{tylr}$ is backed by a novel theory of tile-based parsing, which extends operator-precedence parsing in two ways. First, traditional token precedence comparisons are replaced by a notion of grammar walks, which form the basis for generating obligations. Second, a distinct "molding" system based on grammar zippers expand grammar expressivity by allowing the system to disambiguate between possible parses and completions based on an obligation minimization criterion. In addition to serving as a novel approach to error correction, $ exttt{tylr}$'s design enables the development of an editor that visually materializes obligations to the human user, serving as a novel hybrid between a text editor and a structure editor. We introduce $ exttt{tylr}$ by example, then formalize its key ideas. Finally, we conduct a human subjects study to evaluate the extent to which an editor like $ exttt{tylr}$ that materializes syntactic obligations might be usable and useful, finding both points of positivity and interesting new avenues for future work.
Problem

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

Addressing syntax error recovery limitations in code editors
Completing malformed code by inserting generalized obligations
Enhancing parsing with grammar walks and obligation minimization
Innovation

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

Tile-based parsing with grammar walks
Molding system using grammar zippers
Materializing obligations as hybrid editor
🔎 Similar Papers
No similar papers found.