A transcompiler, also known as source-to-source translator, is a system that converts source code from a high-level programming language (such as C++ or Python) to another. Transcompilers are primarily used for interoperability, and to port codebases written in an obsolete or deprecated language (e.g. COBOL, Python 2) to a modern one. They typically rely on handcrafted rewrite rules, applied to the source code abstract syntax tree. Unfortunately, the resulting translations often lack readability, fail to respect the target language conventions, and require manual modifications in order to work properly. The overall translation process is timeconsuming and requires expertise in both the source and target languages, making code-translation projects expensive. Although neural models significantly outperform their rule-based counterparts in the context of natural language translation, their applications to transcompilation have been limited due to the scarcity of parallel data in this domain. In this paper, we propose to leverage recent approaches in unsupervised machine translation to train a fully unsupervised neural transcompiler. We train our model on source code from open source GitHub projects, and show that it can translate functions between C++, Java, and Python with high accuracy. Our method relies exclusively on monolingual source code, requires no expertise in the source or target languages, and can easily be generalized to other programming languages. We also build and release a test set composed of 852 parallel functions, along with unit tests to check the correctness of translations. We show that our model outperforms rule-based commercial baselines by a significant margin.


翻译:转译器, 也称为源对源翻译器, 是一个将源代码从高级编程语言( 如 C++ 或 Python ) 转换为另一种系统。 转译器主要用于互操作性, 并用于用过时或破旧的语言( 例如 COBOL, Python 2) 写成的港口代码库。 它们通常依赖手写改写规则, 适用于源代码抽象语法树。 不幸的是, 由此产生的译文往往缺乏可读性, 不尊重目标语言公约, 需要手工修改才能正常工作。 整个翻译过程耗时, 需要源语言和目标语言的专门知识, 使得代码翻译项目变得昂贵。 虽然神经模型在自然语言编程中大大超越了基于规则的对应方程式( 例如 COBOL, Python 2), 它们用于翻译的应用程序有限, 因为这个域域中缺少平行的模型数据。 我们提议, 使用不加密的机器翻译方法, 来使用不加密的翻译方法, 来训练完全不受监控的神经翻译的版本的版本, 翻譯功能需要完全的 C. 我们的模型的测试的系统, 和C. breglxxx 。 我们的模型的模型的功能在打开的校正的校正的校正的测试的测试的功能中, 。

0
下载
关闭预览

相关内容

100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
165+阅读 · 2020年3月18日
【Google】无监督机器翻译,Unsupervised Machine Translation
专知会员服务
36+阅读 · 2020年3月3日
强化学习最新教程,17页pdf
专知会员服务
177+阅读 · 2019年10月11日
Transferring Knowledge across Learning Processes
CreateAMind
28+阅读 · 2019年5月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
无监督元学习表示学习
CreateAMind
27+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
42+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
17+阅读 · 2018年12月24日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
计算机视觉近一年进展综述
机器学习研究会
9+阅读 · 2017年11月25日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Arxiv
5+阅读 · 2018年10月23日
Arxiv
3+阅读 · 2018年8月27日
Phrase-Based & Neural Unsupervised Machine Translation
Arxiv
3+阅读 · 2018年3月28日
Arxiv
6+阅读 · 2018年2月26日
Arxiv
7+阅读 · 2018年1月30日
VIP会员
相关VIP内容
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
165+阅读 · 2020年3月18日
【Google】无监督机器翻译,Unsupervised Machine Translation
专知会员服务
36+阅读 · 2020年3月3日
强化学习最新教程,17页pdf
专知会员服务
177+阅读 · 2019年10月11日
相关资讯
Transferring Knowledge across Learning Processes
CreateAMind
28+阅读 · 2019年5月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
无监督元学习表示学习
CreateAMind
27+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
42+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
17+阅读 · 2018年12月24日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
计算机视觉近一年进展综述
机器学习研究会
9+阅读 · 2017年11月25日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
相关论文
Arxiv
5+阅读 · 2018年10月23日
Arxiv
3+阅读 · 2018年8月27日
Phrase-Based & Neural Unsupervised Machine Translation
Arxiv
3+阅读 · 2018年3月28日
Arxiv
6+阅读 · 2018年2月26日
Arxiv
7+阅读 · 2018年1月30日
Top
微信扫码咨询专知VIP会员