English

Synthesizing Conjunctive Queries for Code Search

Programming Languages 2023-05-12 v2 Software Engineering

Abstract

This paper presents Squid, a new conjunctive query synthesis algorithm for searching code with target patterns. Given positive and negative examples along with a natural language description, Squid analyzes the relations derived from the examples by a Datalog-based program analyzer and synthesizes a conjunctive query expressing the search intent. The synthesized query can be further used to search for desired grammatical constructs in the editor. To achieve high efficiency, we prune the huge search space by removing unnecessary relations and enumerating query candidates via refinement. We also introduce two quantitative metrics for query prioritization to select the queries from multiple candidates, yielding desired queries for code search. We have evaluated Squid on over thirty code search tasks. It is shown that Squid successfully synthesizes the conjunctive queries for all the tasks, taking only 2.56 seconds on average.

Keywords

Cite

@article{arxiv.2305.04316,
  title  = {Synthesizing Conjunctive Queries for Code Search},
  author = {Chengpeng Wang and Peisen Yao and Wensheng Tang and Gang Fan and Charles Zhang},
  journal= {arXiv preprint arXiv:2305.04316},
  year   = {2023}
}

Comments

32 pages, 7 figures, and 1 table. Accepted by ECOOP 2023

R2 v1 2026-06-28T10:28:05.440Z