Academic Journal

Can Emulating Semantic Translation Help LLMs with Code Translation? A Study Based on Pseudocode

Λεπτομέρειες βιβλιογραφικής εγγραφής
Τίτλος: Can Emulating Semantic Translation Help LLMs with Code Translation? A Study Based on Pseudocode
Συγγραφείς: Songqiang Chen, Congying Xu, Jingyi Chen, Jialun Cao, Jiarong Wu, Shing-Chi Cheung
Πηγή: ACM Transactions on Software Engineering and Methodology.
Publication Status: Preprint
Στοιχεία εκδότη: Association for Computing Machinery (ACM), 2026.
Έτος έκδοσης: 2026
Θεματικοί όροι: Software Engineering (cs.SE), FOS: Computer and information sciences, Software Engineering
Περιγραφή: Although large language models (LLMs) show promising potential in code translation, they still struggle to generate accurate translations using the commonly adopted direct code-to-code translation approach, which converts an original program into the target programming language (PL) in a single step. Inspired by the success of incorporating intermediate steps to guide LLMs in resolving challenging tasks, in this study, we explore pseudocode-based code translation. This approach emulates human semantic translation by first interpreting the original program’s intent and logic into pseudocode and then implementing it in the target PL. To understand the effectiveness of this underexplored approach, we present a systematic empirical study on pseudocode-based code translation, aiming to investigate its helpfulness in enhancing the direct translation approach, illuminate its effective usage, and identify its limitations. By comparing direct and pseudocode-based translation on 9,690 translation tasks across six PLs with five popular LLMs, we found that pseudocode-based translation can effectively complement direct translation, particularly when translating from flexible to rigid PLs and handling a low-training-resource PL. Based on the findings, we suggest combining the translation results of both approaches for test-based selection to leverage their complementary strengths. We also reveal the advantages of pseudocode-based translation in decoupling the code understanding and generation burden on complicated programs and mitigating distractions from PL-specific implementations in original programs, as well as its limitations due to incorrect, incomplete, or ambiguous pseudocode. Our study sheds light on the effective use of pseudocode-based translation and provides evidence to help enhance LLMs in code translation.
Τύπος εγγράφου: Article
Γλώσσα: English
ISSN: 1557-7392
1049-331X
DOI: 10.1145/3790101
DOI: 10.48550/arxiv.2510.00920
Σύνδεσμος πρόσβασης: http://arxiv.org/abs/2510.00920
Rights: arXiv Non-Exclusive Distribution
Αριθμός Καταχώρησης: edsair.doi.dedup.....3bad4199c8d3e52d34d6af6f6d662fee
Βάση Δεδομένων: OpenAIRE
Περιγραφή
ISSN:15577392
1049331X
DOI:10.1145/3790101