arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1901.05138cs.PLcs.AI
收藏

预测动态类型程序设计语言中的变量类型

Predicting Variable Types in Dynamically Typed Programming Languages

University of Massachusetts, Amherst(马萨诸塞大学阿默斯特分校);Department of Computer Science(计算机科学系);Amherst(阿默斯特);MA 01002(马萨诸塞州 01002)

Abhinav Jangda, Gaurav Anand

摘要:

动态规划语言非常流行,因为它们提高了程序员的工作效率。然而,在源代码中缺少类型使得用这些语言编写的程序难以理解,并且执行这些程序的虚拟机不能产生优化的代码。为了克服这一挑战,我们开发了一种技术来预测所有标识符的类型,包括变量和函数返回类型。我们提出了$2^{nd}$顺序内外递归神经网络的第一个实现,它有两个变体:(i)Child-Sum Tree-LSTM和(ii)可以处理大量树分支的N元RNN。我们预测的类型的所有标识符给定的抽象树,通过执行两次通过树,自底向上和自顶向下,保持内容和上下文表示的树的所有节点。这允许这些表示通过组合来自父、兄弟和子的不同路径进行交互,这对于预测类型至关重要。我们最好的模型在21个类中达到了44.33%,在我们从流行的Python基准测试中收集的Python数据集上,前三名的准确率为71.5%。

英文摘要:

Dynamic Programming Languages are quite popular because they increase the programmer's productivity. However, the absence of types in the source code makes the program written in these languages difficult to understand and virtual machines that execute these programs cannot produced optimized code. To overcome this challenge, we develop a technique to predict types of all identifiers including variables, and function return types. We propose the first implementation of $2^{nd}$ order Inside Outside Recursive Neural Networks with two variants (i) Child-Sum Tree-LSTMs and (ii) N-ary RNNs that can handle large number of tree branching. We predict the types of all the identifiers given the Abstract Syntax Tree by performing just two passes over the tree, bottom-up and top-down, keeping both the content and context representation for all the nodes of the tree. This allows these representations to interact by combining different paths from the parent, siblings and children which is crucial for predicting types. Our best model achieves 44.33\% across 21 classes and top-3 accuracy of 71.5\% on our gathered Python data set from popular Python benchmarks.

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

↑