A Differential Testing Approach for Evaluating Abstract Syntax Tree Mapping Algorithms
Yuanrui Fan, Xin Xia, David Lo, Ahmed E. Hassan, Yuan Wang, Shanping Li
Abstract
Abstract syntax tree (AST) mapping algorithms are widely used to analyze changes in source code. Despite the foundational role of AST mapping algorithms, little effort has been made to evaluate the accuracy of AST mapping algorithms, i.e., the extent to which an algorithm captures the evolution of code. We observe that a program element often has only one best-mapped program element. Based on this observation, we propose a hierarchical approach to automatically compare the similarity of mapped statements and tokens by different algorithms. By performing the comparison, we determine if each of the compared algorithms generates inaccurate mappings for a statement or its tokens. We invite 12 external experts to determine if three commonly used AST mapping algorithms generate accurate mappings for a statement and its tokens for 200 statements. Based on the experts' feedback, we observe that our approach achieves a precision of 0.98-1.00 and a recall of 0.65-0.75. Furthermore, we conduct a large-scale study with a dataset of ten Java projects containing a total of 263,165 file revisions. Our approach determines that GumTree, MTDiff and IJM generate inaccurate mappings for 20%-29%, 25%-36% and 21%-30% of the file revisions, respectively. Our experimental results show that state-of-the-art AST mapping algorithms still need improvements.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext b9a54ff4-ef58-4307-89b1-15f57fb3f865Cited by top-tier papers2
- V-SZZ: Automatic Identification of Version Ranges Affected by CVE VulnerabilitiesLingfeng Bao, Xin Xia, Ahmed E. Hassan, Xiaohu YangICSE 2022 · 45 citations
- Who is the Real Hero? Measuring Developer Contribution via Multi-Dimensional Data IntegrationYuqiang Sun, Zhengzi Xu, Chengwei Liu, Yiran Zhang et al.ASE 2023 · 4 citations
Related papers
- iASTMapper: An Iterative Similarity-Based Abstract Syntax Tree Mapping AlgorithmNeng Zhang, Qinde Chen, Zibin Zheng, Ying ZouASE 2023 · 2 citations
- Fine-grained, accurate and scalable source differencingJean-Rémy Falleri, Matias MartinezICSE 2024 · 9 citations
- HyperDiff: Computing Source Code Diffs at ScaleQuentin Le Dilavrec, Djamel Eddine Khelladi, Arnaud Blouin, Jean-Marc JézéquelFSE 2023 · 5 citations
- DiffFix: Incrementally Fixing AST Diffs via Context and Type InformationGuofeng Zeng, Chang-Ai Sun, Kai Gao, Huai LiuASE 2025
- CodeMapper: A Language-Agnostic Approach to Mapping Code Regions Across CommitsHuimin Hu, Michael PradelICSE 2026
