Home / Current Issue / Paper 1719036
Neural Machine Translation of Source Code Across Programming Languages Using Transformer Architecture
Subject area: Science,Engineering and Technology · Area of research: Neural network
DOI: 10.64388/IREV9I12-1719036
Abstract
The automatic translation of source code between programming languages is a critical challenge in modern software engineering, particularly for legacy system migration and cross-platform development. This paper proposes a Transformer-based Neural Machine Translation (NMT) framework specifically designed for source-to-source code translation, targeting language pairs including Python↔Java, Python↔C++, and Java↔C++. Unlike traditional rule-based transpilers, our approach leverages pre-trained code models (CodeT5+) fine-tuned on a curated multilingual parallel corpus, augmented with Abstract Syntax Tree (AST) structural embeddings to better capture code semantics. We introduce a novel post-processing semantic validation module using unit-test execution feedback and compiler signals to iteratively refine translations and maximize functional equivalence. Experimental evaluation on standard benchmarks (TransCoder-test, AVATAR, CodeNet) demonstrates state-of-the-art Computational Accuracy (CA@1) scores and significant reductions in compilation errors compared to baseline models. Our work addresses the key open challenge of semantic preservation in neural code translation, contributing both a novel architecture and a new evaluation protocol.
Keywords
Neural Machine Translation, Source Code Translation, Transformer Architecture, CodeT5, Abstract Syntax Tree, Semantic Preservation, Legacy Migration
References
[1] Roziere, B., et al. (2020). Unsupervised Translation of Programming Languages. NeurIPS 2020.
[2] Wang, Y., et al. (2021). CodeT5: Identifier- aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation. EMNLP 2021.
[3] Ahmad, W., et al. (2023). AVATAR: A Parallel Corpus for Java-Python Program Translation. ACL Findings 2023.
[4] Yin, X., et al. (2024). Rectifier: Code Translation with Corrector via LLMs. ACM Transactions on Software Engineering, July 2024.
[5] Jana, P., et al. (2024). CoTran: An LLM-based Code Translator for Whole -Program Translation. ECAI 2024.
[6] Yan, G., et al. (2023). On the Evaluation of Neural Code Translation: Taxonomy and Benchmark. ASE 2023.
[7] Chen, et al. (2025). A Systematic Literature Review on Neural Code Translation. arXiv:2505.07425, May 2025.
[8] Puri, R., et al. (2021). CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Tasks. NeurIPS Datasets 2021.
[9] Yan, M., et al. (2023). CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation. EMNLP 2023.
[10] Ni, A., et al. (2023). PPOCoder: Execution- based Code Generation using Deep Reinforcement Learning. TMLR 2023.
[11] Vaswani, A., et al. (2017). Attention Is All You Need. NeurIPS 2017.
[12] Cheung, A., et al. (2025). LLM-Based Code Translation Needs Formal Compositional Reasoning. EECS Technical Report, UC Berkeley, 2025.
[13] Dowdell, T. (2020). Language Modelling for Source Code with Transformer -XL. arXiv:2007.15813.
[14] Yang, G., et al. (2025). Robustness of Pre- Trained Models in Code Translation. Information and Software Technology, 181, 2025.
[15] Galapagos Authors (2024). Automated N- Version Programming with LLMs. arXiv:2408.09536.
How to cite this paper
@article{1719036,
author = {Pallavi Mahale},
title = {Neural Machine Translation of Source Code Across Programming Languages Using Transformer Architecture},
journal = {Iconic Research And Engineering Journals},
year = {2026},
volume = {9},
number = {12},
pages = {2039-2047},
issn = {2456-8880},
url = {https://www.irejournals.com/formatedpaper/1719036.pdf},
abstract = {The automatic translation of source code between programming languages is a critical challenge in modern software engineering, particularly for legacy system migration and cross-platform development. This paper proposes a Transformer-based Neural Machine Translation (NMT) framework specifically designed for source-to-source code translation, targeting language pairs including Python↔Java, Python↔C++, and Java↔C++. Unlike traditional rule-based transpilers, our approach leverages pre-trained code models (CodeT5+) fine-tuned on a curated multilingual parallel corpus, augmented with Abstract Syntax Tree (AST) structural embeddings to better capture code semantics. We introduce a novel post-processing semantic validation module using unit-test execution feedback and compiler signals to iteratively refine translations and maximize functional equivalence. Experimental evaluation on standard benchmarks (TransCoder-test, AVATAR, CodeNet) demonstrates state-of-the-art Computational Accuracy (CA@1) scores and significant reductions in compilation errors compared to baseline models. Our work addresses the key open challenge of semantic preservation in neural code translation, contributing both a novel architecture and a new evaluation protocol.},
keywords = {Neural Machine Translation, Source Code Translation, Transformer Architecture, CodeT5, Abstract Syntax Tree, Semantic Preservation, Legacy Migration},
month = {June},
doi = {https://doi.org/10.64388/IREV9I12-1719036}
}