Tree-to-tree Neural Networks for Program Translation

02/11/2018
by   Xinyun Chen, et al.
0

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 consider employing 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 as an encoder-decoder architecture 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.

READ FULL TEXT
research
07/04/2018

Program Language Translation Using a Grammar-Driven Tree-to-Tree Model

The task of translating between programming languages differs from the c...
research
10/21/2022

Is Encoder-Decoder Redundant for Neural Machine Translation?

Encoder-decoder architecture is widely adopted for sequence-to-sequence ...
research
11/12/2018

Input Combination Strategies for Multi-Source Transformer Decoder

In multi-source sequence-to-sequence tasks, the attention mechanism can ...
research
12/15/2022

Attention as a guide for Simultaneous Speech Translation

The study of the attention mechanism has sparked interest in many fields...
research
04/30/2022

An attention model for the formation of collectives in real-world domains

We consider the problem of forming collectives of agents for real-world ...
research
06/28/2019

A Neural-based Program Decompiler

Reverse engineering of binary executables is a critical problem in the c...
research
04/28/2015

Lexical Translation Model Using a Deep Neural Network Architecture

In this paper we combine the advantages of a model using global source s...

Please sign up or login with your details

Forgot password? Click here to reset