Tree-to-tree Neural Networks for Program Translation
arXiv:1802.03691
Abstract
Program translation is an important tool to migrate legacy code in one language into an ecosystem built in a different language. In this work, we are the first to employ deep neural networks toward tackling this problem. We observe that program translation is a modular procedure, in which a sub-tree of the source tree is translated into the corresponding target sub-tree at each step. To capture this intuition, we design a tree-to-tree neural network to translate a source tree into a target one. Meanwhile, we develop an attention mechanism for the tree-to-tree model, so that when the decoder expands one non-terminal in the target tree, the attention mechanism locates the corresponding sub-tree in the source tree to guide the expansion of the decoder. We evaluate the program translation capability of our tree-to-tree model against several state-of-the-art approaches. Compared against other neural translation models, we observe that our approach is consistently better than the baselines with a margin of up to 15 points. Further, our approach can improve the previous state-of-the-art program translation approaches by a margin of 20 points on the translation of real-world projects.
arXiv commentPublished in NIPS 2018
References in corpus (11)
- Visualizing and Understanding Recurrent Networks
- Effective Approaches to Attention-based Neural Machine Translation
- Dual Learning for Machine Translation
- DeepCoder: Learning to Write Programs
- Language to Logical Form with Neural Attention
- Grammar Variational Autoencoder
- A Syntactic Neural Model for General-Purpose Code Generation
- Neuro-Symbolic Program Synthesis
- Latent Predictor Networks for Code Generation
- Tree-to-Sequence Attentional Neural Machine Translation
- Towards Synthesizing Complex Programs from Input-Output Examples
Cited by in corpus (17)
- CODIT: Code Editing with Tree-Based Neural Models
- Learning to Represent Edits
- Multimodal Representation for Neural Code Search
- Neural Attribute Machines for Program Generation
- Neural Guided Constraint Logic Programming for Program Synthesis
- Deep Tree Learning for Zero-shot Face Anti-Spoofing
- Towards Neural Decompilation
- Program Language Translation Using a Grammar-Driven Tree-to-Tree Model
- The Three Pillars of Machine Programming
- Learning C to x86 Translation: An Experiment in Neural Compilation
- Autoencoders as Tools for Program Synthesis
- Improving the Robustness to Data Inconsistency between Training and Testing for Code Completion by Hierarchical Language Model
- Dialogue Act Classification in Group Chats with DAG-LSTMs
- Improve Language Modelling for Code Completion through Statement Level Language Model based on Statement Embedding Generated by BiLSTM
- Amanuensis: The Programmer's Apprentice
- Svar: A Tiny C++ Header Brings Unified Interface for Multiple programming Languages
- Disambiguating Symbolic Expressions in Informal Documents