arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.06448cs.SE
收藏

用自动模板化和大语言模型将PL/I宏过程翻译成Java

Translating PL/I Macro Procedures into Java Using Automatic Templatization and Large Language Models

IBM Research(IBM 研究院)

Takaaki Tateishi, Yasuharu Katsuno

AI总结:

本文提出了一种基于模板化和大语言模型的方法,用于将PL/I宏过程翻译成Java,以生成能复现原始行为的代码。

摘要:

现代izing遗留企业系统往往涉及将PL/I程序翻译成现代语言如Java。当涉及PL/I宏过程时,这项任务变得显著复杂。PL/I宏过程被视为字符串操作程序,生成PL/I代码,并使自动化翻译更加复杂。最近,大语言模型(LLMs)已被探索用于自动化代码翻译。然而,基于LLM的代码翻译在将PL/I宏过程翻译成Java程序以重现原始PL/I宏过程生成的纯PL/I代码行为方面存在困难。本文提出了一种名为模板化的新方法,该方法使用符号执行生成代码模板(带有命名占位符的代码)作为中间表示。在该方法中,符号值被视为宏生成代码的一部分。通过符号执行宏过程并生成代码模板,我们的方法使LLMs能够生成可读且可维护的Java代码。我们对十个PL/I宏过程的初步实验表明,通过模板化进行的LLM翻译成功生成了能够重现宏生成PL/I程序行为的Java程序。

英文摘要:

Modernizing legacy enterprise systems often involves translating PL/I programs into modern languages such as Java. This task becomes significantly more complex when PL/I macro procedures are involved. The PL/I macro procedures are considered string-manipulating programs that generate PL/I code, and they make automated translation more complex. Recently, large language models (LLMs) have been explored for automated code translation. However, LLM-based code translation struggles to translate the PL/I macro procedures to Java programs that reproduce the behavior of the plain PL/I code generated by the original PL/I macro procedures. This paper proposes a novel method called templatization, which uses symbolic execution to generate code templates (code with named placeholders) as an intermediate representation. In this approach, symbolic values are treated as parts of macro-generated code. By symbolically executing macro procedures and generating code templates, our approach facilitates LLMs to generate readable and maintainable Java code. Our preliminary experiment on ten PL/I macro procedures shows that the LLM-based translation through templatization successfully generates Java programs that reproduce the behavior of the macro-generated PL/I programs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑