arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.18888cs.SE
收藏

使用特定语言语法分隔符的半结构化合并

Semistructured Merge with Language-Specific Syntactic Separators

Guilherme Cavalcanti, Paulo Borba, Leonardo dos Anjos, Jonatas Clementino

AI总结:

针对半结构化合并准确性下降的问题,提出一种利用特定语言语法分隔符在不解析的情况下推断结构的合并工具,在保留半结构化合并优势的同时显著减少了虚假冲突,表现出优于非结构化工具的性能。

摘要:

结构化合并工具利用编程语言的语法结构来提高合并准确性,减少非结构化工具报告的虚假冲突。通过创建和处理完整的 AST,结构化工具是特定于语言的,且更难实现。在合并大文件时,它们还可能计算成本高昂。为了减少这些缺点,半结构化合并工具使用部分 AST,其中用字符串表示方法体等较低层级的语法结构,并依赖非结构化工具来合并它们。然而,这会导致合并准确性下降。为了在不损害半结构化合并优势的情况下提高准确性,我们提出了一种工具,它利用特定语言的语法分隔符在不进行解析的情况下推断结构。我们仍然求助于非结构化工具来合并较低层级的结构,但前提是对代码进行预处理,使得大括号等分隔符之间的文本出现在单独的行中。这样,我们在避免结构化工具缺点的同时,模拟了其功能。通过将我们的工具与半结构化合并的稳健实现进行比较,我们发现我们的工具显著减少了虚假冲突的数量。我们还观察到,在报告的冲突总数和有冲突的文件数量上,也有显著但幅度较小的减少。然而,与结构化工具类似,我们的工具也会让更多的合并冲突未被检测到。我们的工具显示出对实践中广泛使用的非结构化工具的显著改进。最后,我们观察到利用特定语言的语法分隔符引入了独特的文本对齐挑战。

英文摘要:

Structured merge tools exploit programming language syntactic structure to enhance merge accuracy by reducing spurious conflicts reported by unstructured tools. By creating and handling full ASTs, structured tools are language-specific and harder to implement. They can also be computationally expensive when merging large files.To reduce these drawbacks, semistructured merge tools work with partial ASTs that use strings to represent lower level syntactic structures such as method bodies, and rely on unstructured tools to merge them. This, however, results in merge accuracy loss. To improve accuracy without compromising semistructured merge benefits, we propose a tool that leverages language-specific syntactic separators to infer structure without parsing. We still resort to an unstructured tool to merge lower level structures, but only after preprocessing the code so that text in between separators such as curly braces appear in separate lines. This way we emulate the capabilities of structured merge tools while avoiding their drawbacks. By comparing our tool with a robust implementation of semistructured merge, we find that our tool substantially reduces the number of spurious conflicts. We also observe significant but less substantial reductions on the overall number of reported conflicts, and of files with conflicts. However, similar to structured tools, our tool lets more merge conflicts go undetected. Our tool shows significant improvements over unstructured tools widely used in practice. Finally we observe that exploiting language-specific syntactic separators introduces unique textual alignment challenges.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑