Systems and methods for generating segment-specific source code for mainframe-source artifact
Techniques for generating segment code for a legacy mainframe-source artifact that include generating an abstract-syntax-tree (CAA-AST) from a compiler-analysis artifact (CAA) that is generated by compiling a mainframe-source artifact (MSA), and identifying a plurality of logical segments of the MSA based on the CAA-AST. For each logical segment identified, determining a segment descriptor that includes a segment identifier and a segment label, generating a segment-code prompt based on the segment descriptor, and applying the segment-code prompt to a large-language model (LLM) to generate segment code, where the segment code of the plurality of logical segments is integrated to form integrated project code for the MSA.
1 . A computer-implemented method for generating segment code for a legacy mainframe-source artifact, the method comprising:
receiving, from a compiler, a compiler-analysis artifact (CAA) generated by compiling a mainframe-source artifact (MSA);
generating, from the CAA, an abstract-syntax-tree (CAA-AST);
identifying, based on the CAA-AST, a plurality of logical segments of the MSA;
for each logical segment:
determining a segment descriptor comprising a segment identifier and a segment label;
generating a segment-code prompt based on the segment descriptor; and
generating, by applying the segment-code prompt to a large-language model (LLM), segment code; and
integrating the segment code of the plurality of logical segments to form integrated project code for the MSA.
2 . The method of claim 1 , wherein the CAA comprises a SYSADATA file emitted by a mainframe COBOL compiler.
3 . The method of claim 1 , wherein the segment-code prompt is generated using a prompt template selected from a template library based on the segment label and a target programming language.
4 . The method of claim 1 , wherein the segment code comprises one or more Java classes that implement business logic extracted from the corresponding logical segment.
5 . The method of claim 1 , wherein integrating the segment code further comprises deduplicating overlapping artifacts based on segment identifiers and emitting a consolidated project structure.
6 . The method of claim 1 , further comprising generating segment documentation for the plurality of logical segments by:
generating a segment-documentation prompt for each logical segment;
applying the segment-documentation prompt to a second LLM to generate segment documentation; and
integrating the segment documentation into integrated project documentation for the MSA.
7 . The method of claim 1 , wherein the segment code is generated by a code-generation engine implemented as a software agent.
8 . A system comprising:
a processor; and
non-transitory computer-readable storage medium comprising program instructions stored thereon that are executable by the processor to cause the following operations for generating segment code for a legacy mainframe-source artifact:
receiving, from a compiler, a compiler-analysis artifact (CAA) generated by compiling a mainframe-source artifact (MSA);
generating, from the CAA, an abstract-syntax-tree (CAA-AST);
identifying, based on the CAA-AST, a plurality of logical segments of the MSA;
for each logical segment:
determining a segment descriptor comprising a segment identifier and a segment label;
generating a segment-code prompt based on the segment descriptor; and
generating, by applying the segment-code prompt to a large-language model (LLM), segment code; and
integrating the segment code of the plurality of logical segments to form integrated project code for the MSA.
9 . The system of claim 8 , wherein the CAA comprises a SYSADATA file emitted by a mainframe COBOL compiler.
10 . The system of claim 8 , wherein the segment-code prompt is generated using a prompt template selected from a template library based on the segment label and a target programming language.
11 . The system of claim 8 , wherein the segment code comprises one or more Java classes that implement business logic extracted from the corresponding logical segment.
12 . The system of claim 8 , wherein integrating the segment code further comprises deduplicating overlapping artifacts based on segment identifiers and emitting a consolidated project structure.
13 . The system of claim 8 , the operations further comprising generating segment documentation for the plurality of logical segments by:
generating a segment-documentation prompt for each logical segment;
applying the segment-documentation prompt to a second LLM to generate segment documentation; and
integrating the segment documentation into integrated project documentation for the MSA.
14 . The system of claim 8 , wherein the segment code is generated by a code-generation engine implemented as a software agent.
15 . Non-transitory computer-readable storage medium comprising program instructions stored thereon that are executable by a processor to cause the following operations for generating segment code for a legacy mainframe-source artifact:
receiving, from a compiler, a compiler-analysis artifact (CAA) generated by compiling a mainframe-source artifact (MSA);
generating, from the CAA, an abstract-syntax-tree (CAA-AST);
identifying, based on the CAA-AST, a plurality of logical segments of the MSA;
for each logical segment:
determining a segment descriptor comprising a segment identifier and a segment label;
generating a segment-code prompt based on the segment descriptor; and
generating, by applying the segment-code prompt to a large-language model (LLM), segment code; and
integrating the segment code of the plurality of logical segments to form integrated project code for the MSA.
16 . The medium of claim 15 , wherein the CAA comprises a SYSADATA file emitted by a mainframe COBOL compiler.
17 . The medium of claim 15 , wherein the segment-code prompt is generated using a prompt template selected from a template library based on the segment label and a target programming language.
18 . The medium of claim 15 , wherein the segment code comprises one or more Java classes that implement business logic extracted from the corresponding logical segment.
19 . The medium of claim 15 , wherein integrating the segment code further comprises deduplicating overlapping artifacts based on segment identifiers and emitting a consolidated project structure.
20 . The medium of claim 15 , the operations further comprising generating segment documentation for the plurality of logical segments by:
generating a segment-documentation prompt for each logical segment;
applying the segment-documentation prompt to a second LLM to generate segment documentation; and
integrating the segment documentation into integrated project documentation for the MSA.
21 . The medium of claim 15 , wherein the segment code is generated by a code-generation engine implemented as a software agent.