arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1608.09000cs.SEcs.LGcs.PL
收藏

从实例中学习语法程序转换

Learning Syntactic Program Transformations from Examples

UFCG(坎皮纳联邦大学);UC Berkeley(加州大学伯克利分校);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);University of Washington(华盛顿大学);Microsoft(微软);University of Colorado Boulder(科罗拉多大学博尔德分校)

Reudismam Rolim, Gustavo Soares, Loris D'Antoni, Oleksandr Polozov, Sumit Gulwani, Rohit Gheyi, Ryo Suzuki, Bjoern Hartmann

摘要:

IDE,如Visual Studio,自动化常见的转换,如转换和提取方法重构。然而,扩展这些转换目录是复杂且耗时的。类似的现象出现在智能辅导系统中,其中教师必须编写描述“常见错误”的繁琐代码转换,以修复类似的学生提交的编程作业。我们提出REFAZER,自动生成程序转换的技术。REFAZER建立在这样的观察基础上,即开发人员执行的代码编辑可以用作学习转换的示例。示例编辑可能共享相同的结构,但涉及不同的变量和子表达式,这些变量和子表达式必须在正确的抽象级别的转换中进行泛化。为了学习转换,REFAZER利用最先进的编程方法,使用以下关键组件:(a)用于描述程序转换的新型域特定语言(DSL),(b)用于在DSL中合成转换的域特定演绎算法,以及(c)用于对合成转换进行排名的函数。我们在两个域中实例化和评估REFAZER。首先,给出了学生用来修复不正确的编程作业提交的编辑的例子,我们学习了可以修复其他学生提交的类似错误的转换。在我们对720名学生执行的4个编程任务进行的评估中,我们的技术帮助87%的学生修复了不正确的提交。在第二个域中,我们使用开发人员对同一项目应用的重复编辑来合成程序转换,该程序转换将这些编辑应用到代码中的其他位置。在我们对来自3个C#开源项目的59个重复编辑场景进行的评估中,REFAZER在83%的情况下学习了预期的程序转换。

英文摘要:

IDEs, such as Visual Studio, automate common transformations, such as Rename and Extract Method refactorings. However, extending these catalogs of transformations is complex and time-consuming. A similar phenomenon appears in intelligent tutoring systems where instructors have to write cumbersome code transformations that describe "common faults" to fix similar student submissions to programming assignments. We present REFAZER, a technique for automatically generating program transformations. REFAZER builds on the observation that code edits performed by developers can be used as examples for learning transformations. Example edits may share the same structure but involve different variables and subexpressions, which must be generalized in a transformation at the right level of abstraction. To learn transformations, REFAZER leverages state-of-the-art programming-by-example methodology using the following key components: (a) a novel domain-specific language (DSL) for describing program transformations, (b) domain-specific deductive algorithms for synthesizing transformations in the DSL, and (c) functions for ranking the synthesized transformations. We instantiate and evaluate REFAZER in two domains. First, given examples of edits used by students to fix incorrect programming assignment submissions, we learn transformations that can fix other students' submissions with similar faults. In our evaluation conducted on 4 programming tasks performed by 720 students, our technique helped to fix incorrect submissions for 87% of the students. In the second domain, we use repetitive edits applied by developers to the same project to synthesize a program transformation that applies these edits to other locations in the code. In our evaluation conducted on 59 scenarios of repetitive edits taken from 3 C# open-source projects, REFAZER learns the intended program transformation in 83% of the cases.

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

↑