DeepAI AI Chat
Log In Sign Up

SAR: Learning Cross-Language API Mappings with Little Knowledge

by   Nghi D. Q. Bui, et al.
Singapore Management University
The Open University

To save manual effort, developers often translate programs from one programming language to another, instead of implementing it from scratch. Translating application program interfaces (APIs) used in one language to functionally equivalent ones available in another language is an important aspect of program translation. Existing approaches facilitate the translation by automatically identifying the API mappings across programming languages. However, all these approaches still require large amount of manual effort in preparing parallel program corpora, ranging from pairs of APIs, to manually identified code in different languages that are considered as functionally equivalent. To minimize the manual effort in identifying parallel program corpora and API mappings, this paper aims at an automated approach to map APIs across languages with much less knowledge a priori needed than other existing approaches. The approach is based on an realization of the notion of domain adaption combined with code embedding, which can better align two vector spaces: taking as input large sets of programs, our approach first generates numeric vector representations of the programs, especially the APIs used in each language, and it adapts generative adversarial networks (GAN) to align the vectors from the spaces of two languages. For a better alignment, we initialize the GAN with parameters derived from optional API mapping seeds that can be identified accurately with a simple automatic signature-based matching heuristic. Then the cross-language API mappings can be identified via nearest-neighbors queries in the aligned vector spaces.


page 1

page 2

page 3

page 4


DeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning

Computer programs written in one language are often required to be porte...

Hierarchical Learning of Cross-Language Mappings through Distributed Vector Representations for Code

Translating a program written in one programming language to another can...

Concrat: An Automatic C-to-Rust Lock API Translator for Concurrent Programs

Concurrent programs suffer from data races. To prevent data races, progr...

GANCoder: An Automatic Natural Language-to-Programming Language Translation Approach based on GAN

We propose GANCoder, an automatic programming approach based on Generati...

Deep API Learning

Developers often wonder how to implement a certain functionality (e.g., ...

RPT: Effective and Efficient Retrieval of Program Translations from Big Code

Program translation is a growing demand in software engineering. Manual ...

Binding Language Models in Symbolic Languages

Though end-to-end neural approaches have recently been dominating NLP ta...