Syntactic Code Search with Sequence-to-Tree Matching: Supporting Syntactic Search with Incomplete Code Fragments
Gabriel Matute, Wode Ni, Titus Barik, Alvin Cheung, Sarah E. Chasins
摘要
Lightweight syntactic analysis tools like Semgrep and Comby leverage the tree structure of code, making them more expressive than string and regex search. Unlike traditional language frameworks (e.g., ESLint) that analyze codebases via explicit syntax tree manipulations, these tools use query languages that closely resemble the source language. However, state-of-the-art matching techniques for these tools require queries to be complete and parsable snippets, which makes in-progress query specifications useless. We propose a new search architecture that relies only on tokenizing (not parsing) a query. We introduce a novel language and matching algorithm to support tree-aware wildcards on this architecture by building on tree automata. We also present stsearch , a syntactic search tool leveraging our approach. In contrast to past work, our approach supports syntactic search even for previously unparsable queries. We show empirically that stsea rch can support all tokenizable queries, while still providing results comparable to Semgrep for existing queries. Our work offers evidence that lightweight syntactic code search can accept in-progress specifications, potentially improving support for interactive settings. CCS Concepts: • Software and its engineering → Formal language definitions ; Software maintenance tools; • Information systems → Query representation; • Theory of computation → Tree languages.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
相关 Paper
- Better Call Grep: Evaluating and Improving Grep-Like Lexical Retrieval for Repository-Level Code CompletionBaoyi Wang, Xingliang Wang, Guochang Li, Chen Zhi 等ISSTA 2026
- Semistructured Merge with Language-Specific Syntactic SeparatorsGuilherme Cavalcanti, Paulo Borba, Leonardo dos Anjos, Jônatas ClementinoASE 2024 · 被引用 1 次
- ShapeSearch: A Flexible and Efficient System for Shape-based Exploration of TrendlinesTarique Siddiqui, Paul Luh, Zesheng Wang, Karrie Karahalios 等SIGMOD 2020 · 被引用 35 次
- NBSearch: Semantic Search and Visual Exploration of Computational NotebooksXingjun Li, Yuanxin Wang, Hong Wang, Yang Wang 等CHI 2021 · 被引用 22 次
- Absynthe: Abstract Interpretation-Guided SynthesisSankha Narayan Guria, Jeffrey S. Foster, David Van HornPLDI 2023 · 被引用 6 次
