2018 · 19 citations · 18 references
ComputingComputer ScienceNatural Language ProcessingProgramming LanguagesSyntaxApplication Programming InterfacesMachine TranslationMobile Application DevelopmentSyntactic AnalysisSyntax ParsingSyntax-directed TranslationCode TranslationCorpus CreationDomain Knowledge ExtractionRule-based Machine TranslationSource-to-source TranslationSyntax-based Machine TranslationSyntax-directed Code GenerationTop-down Translation
A native cross-platform mobile app has multiple platform-specific implementations. Typically, an app is developed for one platform and then ported to the remaining ones. Translating an app from one language (e.g., Java) to another (e.g., Swift) by hand is tedious and error-prone, while automated translators either require manually defined translation rules or focus on translating APIs. To automate the translation of native cross-platform apps, we present J2SINFERER, a novel approach that iteratively infers syntactic transformation rules and API mappings from Java to Swift. Given a software corpus in both languages, J2SLNFERER first identifies the syntactically equivalent code based on braces and string similarity. For each pair of similar code segments, J2SLNFERER then creates syntax trees of both languages, leveraging the minimalist domain knowledge of language correspondence (e.g., operators and markers) to iteratively align syntax tree nodes, and to infer both syntax and API mapping rules. J2SLNFERER represents inferred rules as string templates, stored in a database, to translate code from Java to Swift. We evaluated J2SLNFERER with four applications, using one part of the data to infer translation rules, and the other part to apply the rules. With 76% in-project accuracy and 65% cross-project accuracy, J2SLNFERER outperforms in accuracy j2swift, a state-of-the-art Java-to-Swift conversion tool. As native cross-platform mobile apps grow in popularity, J2SLNFERER can shorten their time to market by automating the tedious and error prone task of source-to-source translation.
18
Graph-based mining of multiple object usage patterns
Tung Nguyen, Hoan Anh Nguyen, Nam H. Pham et al. · 2009 · 294 citations
Automatic inference of code transforms for patch generation
Fan Long, Peter Amidon, Martin Rinard · 2017 · 178 citations · Full text
Mining API mapping for language migration
Hao Zhong, Suresh Thummalapenta, Tao Xie et al. · 2010 · 147 citations
Na Meng, Miryung Kim, Kathryn S. McKinley · ACM SIGPLAN Notices · 2011 · 116 citations