Revitalizing Legacy Code: AI-Powered Translation of Fortran Codes to Modern Languages

Friday 23 May 2025

In a significant breakthrough, researchers have made substantial progress in translating legacy computer codes written in Fortran to modern programming languages like C++. This achievement has far-reaching implications for scientific computing, as it enables the reuse of valuable codebases and accelerates the development of new applications.

Fortran, developed in the 1950s, was a popular choice for scientific simulations due to its efficiency and ease of use. However, as computing technology advanced, Fortran’s limitations became apparent, leading many researchers to switch to more modern languages like C++ or Python. Unfortunately, this meant that decades of accumulated knowledge and code were left behind.

The challenge in translating Fortran codes lies in their unique syntax, which can be notoriously difficult to decipher. Additionally, the original authors may no longer be available to provide clarification or support. To address these issues, researchers turned to Large Language Models (LLMs), artificial intelligence algorithms capable of learning patterns and relationships within vast amounts of text.

In a recent study, scientists employed LLMs to translate Fortran codes into C++. They developed an innovative workflow that evaluated the accuracy of the translated code, including its compilation success rate and output similarity. The results were impressive: the LLM-based translation method achieved higher accuracy rates than existing solutions, with some models showing significant improvements over others.

The study’s findings have important implications for scientific computing. By leveraging LLMs to translate Fortran codes, researchers can breathe new life into legacy codebases, allowing them to be reused and updated for modern applications. This not only saves time and effort but also enables the preservation of valuable knowledge and expertise.

Moreover, this achievement paves the way for the development of more sophisticated AI-powered tools that can assist in the coding process. Imagine being able to automatically generate code snippets or even entire programs based on a given problem or algorithm. The possibilities are endless, and this breakthrough marks an important step towards realizing them.

The success of this project also highlights the potential benefits of interdisciplinary collaboration between computer scientists, linguists, and domain experts. By combining their expertise, researchers can develop more effective solutions that cater to the unique needs of different fields and communities.

As computing technology continues to evolve at a rapid pace, it is essential to find ways to bridge the gap between legacy codebases and modern programming languages. The translation of Fortran codes into C++ using LLMs offers a promising approach to achieving this goal.

Cite this article: “Revitalizing Legacy Code: AI-Powered Translation of Fortran Codes to Modern Languages”, The Science Archive, 2025.

Fortran, C++, Large Language Models, Ai-Powered Tools, Scientific Computing, Legacy Codebases, Programming Languages, Translation, Accuracy, Compilation, Output Similarity

Reference: Nishath Rajiv Ranasinghe, Shawn M. Jones, Michal Kucer, Ayan Biswas, Daniel O’Malley, Alexander Buschmann Most, Selma Liliane Wanna, Ajay Sreekumar, “LLM-Assisted Translation of Legacy FORTRAN Codes to C++: A Cross-Platform Study” (2025).

Leave a Reply