Can We Translate Code Better with LLMs and Call Graph Analysis?
Abstract
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.
Cite
Text
Luo. "Can We Translate Code Better with LLMs and Call Graph Analysis?." International Joint Conference on Artificial Intelligence, 2025. doi:10.24963/IJCAI.2025/848Markdown
[Luo. "Can We Translate Code Better with LLMs and Call Graph Analysis?." International Joint Conference on Artificial Intelligence, 2025.](https://mlanthology.org/ijcai/2025/luo2025ijcai-we/) doi:10.24963/IJCAI.2025/848BibTeX
@inproceedings{luo2025ijcai-we,
title = {{Can We Translate Code Better with LLMs and Call Graph Analysis?}},
author = {Luo, Yang},
booktitle = {International Joint Conference on Artificial Intelligence},
year = {2025},
pages = {7625-7633},
doi = {10.24963/IJCAI.2025/848},
url = {https://mlanthology.org/ijcai/2025/luo2025ijcai-we/}
}