paperbot · PL 论文追踪

全部论文 待读 收藏

P2 iASTMapper: An Iterative Similarity-Based Abstract Syntax Tree Mapping Algorithm

iASTMapper:一种基于相似度的迭代式抽象语法树映射算法
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 3/10 · 该论文属于传统程序分析与软件工程中的AST映射/代码变更定位,虽与静态分析工具链有一定关联,但未涉及用户核心关注的LLM/Agent与静态分析交叉、浮点程序分析或贝叶斯程序分析,也未聚焦ML/Agentic程序或形式化验证。引用 3 inbox
Neng Zhang, Qinde Chen, Zibin Zheng, Ying Zou
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出迭代式基于相似度的 AST 映射算法 iASTMapper,通过三层节点迭代与相互影响机制提升代码变更定位准确率。

现有 AST 映射算法(如 GumTree、MTDiff、IJM)在大量文件修订中会产生不准确的节点映射,其关键原因之一是低层节点(如 token)与高层节点(如语句)的映射之间存在相互影响,而该问题较少被现有方法考虑。为此,本文提出 iASTMapper:从代码修订前后的 AST 中提取 token、statement、inner-statement 三类不同层次节点,先建立未变语句和内语句的映射,再基于启发式相似度迭代映射剩余节点;同时用迭代机制连接三个映射过程,以利用不同层次节点映射间的相互影响,最终从节点映射生成代码编辑动作以帮助理解和定位变更。作者在十个 Java 项目的 210,997 个文件修订上与 GumTree、MTDiff、IJM 自动对比,并邀请 12 名评估者对 200 个修订的编辑动作进行人工评估。结果表明 iASTMapper 优于基线,生成的代码编辑动作至少短 1.29%,准确率达到 96.23%。

问题
现有 AST 映射算法在不少文件修订中生成不准确映射,且通常未充分考虑低层与高层 AST 节点映射之间的相互影响。
方法
iASTMapper 提取 token、statement、inner-statement 三类节点,先映射未变语句/内语句,再按启发式相似度迭代映射剩余节点,并通过迭代机制在各层映射间传递相互影响,最终生成代码编辑动作。
评估
在十个 Java 项目的 210,997 个文件修订上与 GumTree、MTDiff、IJM 自动比较,并由 12 名评估者人工检查 200 个修订的编辑动作正确性。
原文摘要(Abstract)

Abstract syntax tree (AST) mapping algorithms are widely used to locate the code changes in a file revision by mapping the AST nodes of the source code before and after the code changes. A recent differential testing of three state-of- the-art AST mapping algorithms, i.e., GumTree, MTDiff, and IJM, reveals that the algorithms generate inaccurate mappings for a considerable number of file revisions. We find that the inaccurate mappings could be caused by the mutual influence: the mappings of lower-level AST nodes (e.g., tokens) have impacts on the mappings of higher-level AST nodes (e.g., statements) and vice versa. This mutual influence issue is rarely considered by existing algorithms. In this paper, we propose an algorithm, called iASTMapper, that iteratively map two ASTs based on the similarities between AST nodes. Given a file revision, we extract three types of AST nodes in different levels of program structures (i.e., tokens, statements, and inner-statements) from the ASTs of the two source code files. We first build mappings of the unchanged statements and inner-statements. Then, we use an iterative method to map the rest of the nodes without mapping. For each of the three types of nodes, we iteratively map the nodes based on their similarities measured using heuristic rules. We further use an iterative mechanism to connect the three iterative mapping processes by considering the mutual influence between the mappings of different types of nodes. Finally, a series of code edit actions are generated from the node mappings to help users understand and locate the code changes during revisions. We conduct experiments to compare iASTMapper with three baselines, i.e., GumTree, MTDiff, and IJM, by automatically evaluating 210,997 file revisions from ten Java projects. Furthermore, we manually evaluate the correctness of the code edit actions generated for 200 file revisions with 12 evaluators. The results demonstrate that iASTMapper outperforms the baselines. iASTMapper can generate shorter code edit actions by at least 1.29% than the baselines, with a high accuracy of 96.23%.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{ZhangCZZ23,
  title = {iASTMapper: An Iterative Similarity-Based Abstract Syntax Tree Mapping Algorithm},
  author = {Neng Zhang and Qinde Chen and Zibin Zheng and Ying Zou},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00178}
}