SAR: Learning cross-language API mappings with little knowledge

To save 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 progra...

Full description

Saved in:
Bibliographic Details
Main Authors: BUI, Duy Quoc Nghi, YU, Yijun, JIANG, Lingxiao
Format: text
Language:English
Published: Institutional Knowledge at Singapore Management University 2019
Subjects:
Online Access:https://ink.library.smu.edu.sg/sis_research/4815
https://ink.library.smu.edu.sg/context/sis_research/article/5818/viewcontent/fse19main_id65_20190715.pdf
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Singapore Management University
Language: English
id sg-smu-ink.sis_research-5818
record_format dspace
spelling sg-smu-ink.sis_research-58182020-03-31T02:18:12Z SAR: Learning cross-language API mappings with little knowledge BUI, Duy Quoc Nghi YU, Yijun JIANG, Lingxiao To save 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, these approaches still require large amount of parallel corpora, ranging from pairs of APIs or code fragments that are functionally equivalent, to similar code comments. To minimize the need of parallel corpora, this paper aims at an automated approach that can map APIs across languages with much less a priori knowledge than other approaches. The approach is based on an realization of the notion of domain adaption, combined with code embedding, to better align two vector spaces. Taking as input large sets of programs, our approach first generates numeric vector representations of the programs (including the APIs used in each language), and it adapts generative adversarial networks (GAN) to align the vectors in different spaces of two languages. For a better alignment, we initialize the GAN with parameters derived from API mapping seeds that can be identified accurately with a simple automatic signature-based matching heuristic. Then the crosslanguage API mappings can be identified via nearest-neighbors queries in the aligned vector spaces. We have implemented the approach (SAR, named after three main technical components in the approach) in a prototype for mapping APIs across Java and C# programs. Our evaluation on about 2 million Java files and 1 million C# files shows that the approach can achieve 54% and 82% mapping accuracy in its top-1 and top-10 API mapping results with only 257 automatically identified seeds, more accurate than other approaches using the same or much more mapping seeds. 2019-08-01T07:00:00Z text application/pdf https://ink.library.smu.edu.sg/sis_research/4815 info:doi/10.1145/3338906.3338924 https://ink.library.smu.edu.sg/context/sis_research/article/5818/viewcontent/fse19main_id65_20190715.pdf http://creativecommons.org/licenses/by-nc-nd/4.0/ Research Collection School Of Computing and Information Systems eng Institutional Knowledge at Singapore Management University software maintenance language mapping word2vec syntactic structure program translation Software Engineering
institution Singapore Management University
building SMU Libraries
continent Asia
country Singapore
Singapore
content_provider SMU Libraries
collection InK@SMU
language English
topic software maintenance
language mapping
word2vec
syntactic structure
program translation
Software Engineering
spellingShingle software maintenance
language mapping
word2vec
syntactic structure
program translation
Software Engineering
BUI, Duy Quoc Nghi
YU, Yijun
JIANG, Lingxiao
SAR: Learning cross-language API mappings with little knowledge
description To save 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, these approaches still require large amount of parallel corpora, ranging from pairs of APIs or code fragments that are functionally equivalent, to similar code comments. To minimize the need of parallel corpora, this paper aims at an automated approach that can map APIs across languages with much less a priori knowledge than other approaches. The approach is based on an realization of the notion of domain adaption, combined with code embedding, to better align two vector spaces. Taking as input large sets of programs, our approach first generates numeric vector representations of the programs (including the APIs used in each language), and it adapts generative adversarial networks (GAN) to align the vectors in different spaces of two languages. For a better alignment, we initialize the GAN with parameters derived from API mapping seeds that can be identified accurately with a simple automatic signature-based matching heuristic. Then the crosslanguage API mappings can be identified via nearest-neighbors queries in the aligned vector spaces. We have implemented the approach (SAR, named after three main technical components in the approach) in a prototype for mapping APIs across Java and C# programs. Our evaluation on about 2 million Java files and 1 million C# files shows that the approach can achieve 54% and 82% mapping accuracy in its top-1 and top-10 API mapping results with only 257 automatically identified seeds, more accurate than other approaches using the same or much more mapping seeds.
format text
author BUI, Duy Quoc Nghi
YU, Yijun
JIANG, Lingxiao
author_facet BUI, Duy Quoc Nghi
YU, Yijun
JIANG, Lingxiao
author_sort BUI, Duy Quoc Nghi
title SAR: Learning cross-language API mappings with little knowledge
title_short SAR: Learning cross-language API mappings with little knowledge
title_full SAR: Learning cross-language API mappings with little knowledge
title_fullStr SAR: Learning cross-language API mappings with little knowledge
title_full_unstemmed SAR: Learning cross-language API mappings with little knowledge
title_sort sar: learning cross-language api mappings with little knowledge
publisher Institutional Knowledge at Singapore Management University
publishDate 2019
url https://ink.library.smu.edu.sg/sis_research/4815
https://ink.library.smu.edu.sg/context/sis_research/article/5818/viewcontent/fse19main_id65_20190715.pdf
_version_ 1770575037759225856