Can We Translate Code Better with LLMs and Call Graph Analysis?
Can We Translate Code Better with LLMs and Call Graph Analysis?
Yang Luo
Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence
Main Track. Pages 7625-7633.
https://doi.org/10.24963/ijcai.2025/848
This paper proposes an innovative code translation method aimed at addressing the accuracy issues encountered by large language models (LLMs) in translating code of complex large-scale software projects. The method utilizes the Language Server Protocol to obtain the call graph of the entire codebase, and optimizes the input prompt of the LLM accordingly, significantly improving the correctness of translation at the compilation stage. Moreover, this method introduces the bridged debuggers technique based on the Debug Adapter Protocol and dynamic test case generation, effectively fixing runtime errors. Experiments on multiple mainstream datasets demonstrate that, compared to existing code translation methods and LLMs, this method achieves a significant improvement in translation accuracy.
Keywords:
Multidisciplinary Topics and Applications: MTA: Software engineering
Data Mining: DM: Mining codebase and software repositories
Natural Language Processing: NLP: Applications
Natural Language Processing: NLP: Language models
