Learning Syntactic Program Transformations from Examples
UFCG(坎皮纳联邦大学);UC Berkeley(加州大学伯克利分校);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);University of Washington(华盛顿大学);Microsoft(微软);University of Colorado Boulder(科罗拉多大学博尔德分校)
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.
Beyond Basic Specifications? A Systematic Study of Logical Constructs in LLM-based Specification Generation
School of Computer Science and Technology, Xidian University(西安电子科技大学计算机科学与技术学院);National Key Laboratory of Science and Technology on Information System Security, AMS(信息系统安全国家重点实验室,AMS);Unit 32092 of PLA(中国人民解放军第32092部队);School of Cyber Engineering, Xidian University(西安电子科技大学网络空间安全学院);Systems Engineering Institute, AMS(系统工程研究院,AMS)