Using Generative AI to Translate Uncommon Programming Languages

Presentation
This presentation describes SEI research to enable translation of software from an older language (Ada) to a newer language (C++).
Publisher

Software Engineering Institute

Abstract

Long-lived systems often become increasingly challenging to change over time, leading to a need for modernization that returns them to a state in which new changes can be made efficiently.  One element of some modernization efforts is moving from an older, poorly supported programming language to a new language.  However, manual efforts to translate software are too slow and labor intensive.  Generative AI has been trained on large open-source corpuses (e.g., GitHub) and shows promise for quick translation among popular programming languages, but what about uncommon languages like Ada?  This presentation shows results from applying Generative AI to translate Ada code to C++.

The presentation includes analysis of translation of tens of thousands of lines of Ada code, careful review and categorization of the types of errors introduced in translation, successful efforts to reduce the rate of error generation, and reflections on the potential of this kind of automation.  Results are shown regarding the correctness of translations, insights into the maintainability of generated code, and the essential role of developers in the modernization process.

“Out-of-the-box” understanding of Ada is better than expected, but baseline translation introduces roughly 140 defects per KLOC translated.  Initial experiments demonstrate that methodical prompting to provide missing context can bring this down to less than 40 defects per KLOC, with room for further improvement. These results demonstrate an approach in which AI-native software engineering can significantly accelerate one aspect of modernization, code translation, even for uncommon programming languages.  This kind of automated assistance is necessary to scale modernization efforts to large software systems.