arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1803.09544cs.PLcs.LG
收藏

一种通用的基于路径的程序属性预测表示

A General Path-Based Representation for Predicting Program Properties

Technion(以色列理工学院);University of Washington(华盛顿大学)

Uri Alon, Meital Zilberstein, Omer Levy, Eran Yahav

摘要:

预测程序属性(如名称或表达式类型)有着广泛的应用。它可以减轻编程任务并提高程序员的生产力。从程序中学习的一个主要挑战是$\textit{how to represent programs in a way that facilitates effective learning}$。我们提出了一个$\textit{general path-based representation}$从程序学习。我们的表示是纯粹的语法和自动提取。其主要思想是用抽象语法树(AST)中的路径来表示程序。这允许学习模型利用代码的结构化本质,而不是将其视为一个扁平的令牌序列。我们证明了这种表示是通用的,并且可以:(i)覆盖不同的预测任务,(ii)驱动不同的学习算法(用于生成和判别模型),以及(iii)跨不同的程序设计语言工作。我们评估我们的方法预测变量名,方法名和完整类型的任务。我们使用我们的表示来驱动基于CRF和基于word2vec的学习,用于四种语言的程序:JavaScript,Java,Python和C\#。我们的评估表明,我们的方法获得更好的结果比特定于任务的手工制作的表示在不同的任务和程序设计语言。

英文摘要:

Predicting program properties such as names or expression types has a wide range of applications. It can ease the task of programming and increase programmer productivity. A major challenge when learning from programs is $\textit{how to represent programs in a way that facilitates effective learning}$. We present a $\textit{general path-based representation}$ for learning from programs. Our representation is purely syntactic and extracted automatically. The main idea is to represent a program using paths in its abstract syntax tree (AST). This allows a learning model to leverage the structured nature of code rather than treating it as a flat sequence of tokens. We show that this representation is general and can: (i) cover different prediction tasks, (ii) drive different learning algorithms (for both generative and discriminative models), and (iii) work across different programming languages. We evaluate our approach on the tasks of predicting variable names, method names, and full types. We use our representation to drive both CRF-based and word2vec-based learning, for programs of four languages: JavaScript, Java, Python and C\#. Our evaluation shows that our approach obtains better results than task-specific handcrafted representations across different tasks and programming languages.

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

↑