Programming language conversion system, programming language conversion method, and program
The programming language conversion system addresses the challenge of incomplete conversion by generating intermediate programs with register and address area descriptions, enabling seamless translation from assembly language to COBOL.
Patent Information
- Application Number
- JP2024147149
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-01-06
- Estimated Expiration
- 2044-08-29
AI Technical Summary
Existing systems struggle to convert assembler programs containing instructions that cannot be properly converted to another programming language, leading to incomplete conversion.
A programming language conversion system that generates an intermediate program by replacing assembly language descriptions with register items, linkage items, and address area descriptions, allowing conversion to a different programming language.
Enables the conversion of assembly language programs into other programming languages like COBOL without issues, ensuring complete and accurate translation.
Smart Images

Figure 0007608667000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a programming language conversion system, a programming language conversion method, and a program. [Background technology]
[0002] A system capable of converting an assembly language into COBOL is known (see, for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2017-62746 A Summary of the Invention [Problem to be solved by the invention]
[0004] The document generation device described in Patent Document 1 is a device that converts an assembler program written in assembly language into another programming language. The document generation device converts a part of a program description constituting an original source stored in a storage unit into a program description in another language based on conversion information corresponding to the description.
[0005] However, in the document generation device described in Patent Document 1, if an assembler program written in assembly language contains instructions that cannot be properly converted into other programming languages, the assembler program cannot be converted into other programming languages.
[0006] In view of the above, an object of the present invention is to provide a system capable of appropriately converting an assembly language into another programming language. [Means for solving the problem]
[0007] A programming language conversion system according to one embodiment of the present invention is a programming language conversion system that converts an original program written in assembly language into a converted program written in a programming language other than assembly language, and includes a generation unit that generates an intermediate program including original description items corresponding to a description of the original program, register items which are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item which is a description for reserving address space for a first instruction with a displacement specification using a first register among the predetermined number of registers, and a conversion unit that converts the intermediate program into the converted program.
[0008] A programming language conversion method according to one embodiment of the present invention includes a computer generating an intermediate program including original description items corresponding to a description of an original program written in assembly language, register items which are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item which is a description for reserving address space for a first instruction specifying a displacement using a first register among the predetermined number of registers, and converting the intermediate program into a conversion program written in a programming language other than assembly language.
[0009] A program according to one embodiment of the present invention causes a computer to generate an intermediate program including original description items corresponding to a description of an original program written in assembly language, register items which are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item which is a description for reserving address space for a first instruction specifying a displacement using a first register among the predetermined number of registers, and converting the intermediate program into a converted program written in a programming language other than assembly language. Effect of the Invention
[0010] According to the present invention, it is possible to provide a system capable of appropriately converting an assembly language into another programming language. [Brief description of the drawings]
[0011] [Figure 1] FIG. 1 illustrates an example of an outline of the configuration of a programming language conversion system. [Diagram 2] FIG. 2 is a diagram showing an example of a correspondence relationship between an original program, an intermediate program, and a conversion program regarding a first generation process and a second generation process. [Diagram 3] FIG. 13 is a diagram showing an example of the correspondence relationship between an original program, an intermediate program, and a conversion program regarding a third generation process. [Figure 4] FIG. 13 is a diagram showing an example of the correspondence relationship between an original program, an intermediate program, and a conversion program regarding a fourth generation process. [Diagram 5] FIG. 13 is a diagram showing an example of the correspondence relationship between an original program, an intermediate program, and a conversion program regarding a fifth generation process. [Figure 6] 13 is a diagram showing an example of a correspondence relationship between an original program, an intermediate program, and a conversion program regarding processing in a conversion unit according to a modified example. FIG. [Figure 7] FIG. 2 is a flow chart illustrating an example of a processing procedure of the programming language conversion system. [Figure 8] FIG. 2 illustrates an example of a hardware configuration of a computer. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] A preferred embodiment of the present invention (hereinafter, referred to as "the present embodiment") will be described with reference to the attached drawings. In each drawing, the same reference numerals are used to denote the same or similar configurations. In this embodiment, "part", "means", "apparatus", and "system" do not simply mean physical means, but also include cases where the functions of the "part", "means", "apparatus", and "system" are realized by software. In addition, the functions of one "part", "means", "apparatus", or "system" may be realized by two or more physical means or devices, and the functions of two or more "parts", "means", "apparatus", or "system" may be realized by one physical means or device.
[0013] ===Programming Language Conversion System 100=== <<Overview>> The programming language conversion system 100 is a system that converts assembly language into another programming language. When converting a program written in assembly language (hereinafter referred to as "original program") into a program written in another programming language (e.g., programming languages such as COBOL, C language, Java, etc.) (hereinafter referred to as "converted program"), the programming language conversion system 100 generates a program written in assembly language by converting a part of the original program (hereinafter referred to as "intermediate program"). For convenience, the following description will be given assuming that the converted program is COBOL.
[0014] The intermediate program is a program in which the instruction descriptions contained in the original program are converted into instruction descriptions that can be converted into the converted program so that the original program can be appropriately converted into the converted program.
[0015] In other words, the programming language conversion system 100 does not convert an original program into a converted program by only referring to a database that has a one-to-one correspondence between the description of the original program and the description of the converted program.The programming language conversion system 100 has a feature not found in the prior art, that is, it can convert an original program into a converted program appropriately and without problems by using an intermediate program in which descriptions that hinder the conversion of the original program into the converted program are appropriately converted.
[0016] <<Configuration>> An outline of the configuration of a programming language conversion system 100 will be described with reference to Fig. 1. Fig. 1 is a diagram showing an example of an outline of the configuration of a programming language conversion system 100.
[0017] The programming language conversion system 100 is a system that generates an intermediate program by replacing a portion of an original program and converts the intermediate program into a converted program.
[0018] The programming language conversion system 100 may be, for example, a cloud computer, a server computer, a personal computer (e.g., a desktop, a laptop, a tablet, etc.), a media computer platform (e.g., a cable or satellite set-top box, a digital video recorder), a handheld computer device (e.g., a PDA, an email client, etc.), or any other type of computer or communication platform. Note that at least a portion of the processing in the programming language conversion system 100 may be implemented by one or more computers (for example, and not by way of limitation, cloud computing configured by one or more computers).
[0019] As shown in FIG. 1, the programming language conversion system 100 includes, for example, a storage unit 110, an acquisition unit 120, a generation unit 130, a conversion unit 140, an identification code assignment unit 150, a comment unit 160, and a display processing unit 170.
[0020] The storage unit 110 stores the original program, the converted program, and the intermediate program in association with each other.
[0021] The acquisition unit 120 acquires an original program (first program) at least a part of which is written in an assembly language. The original program may include, for example, a description including an instruction not written in an assembly language, and an assembly language instruction that cannot be converted into a conversion program.
[0022] The generation unit 130 generates an intermediate program based on the original program. The generation unit 130 executes the first to fifth generation processes to generate an intermediate program. The first to fifth generation processes will be described below with reference to Figs. 2 to 5. Note that in Figs. 2 to 5, the "original program", "intermediate program", and "converted program" (COBOL as an example) are shown from the left frame on the page, and the same line numbers are assigned to corresponding descriptions.
[0023] First, the first generation process and the second generation process will be described with reference to Fig. 2. Fig. 2 is a diagram showing an example of the correspondence relationship between the original program, the intermediate program, and the conversion program regarding the first generation process and the second generation process.
[0024] The first generation process generates an intermediate program that includes items (hereinafter, referred to as "register items Cre") that correspond to a predetermined number of registers in the assembly language.
[0025] For example, an original program written in assembly language has 16 general-purpose registers, which are used for fixed-point arithmetic, address calculations, and logical operations.
[0026] Through the first generation process, the programming language conversion system 100 can solve the problem that assembly language descriptions that refer to or rewrite register values cannot be properly converted into a conversion program because COBOL does not have instructions to directly specify registers.
[0027] Specifically, in the first generation process, register items Cre corresponding to 16 registers in the assembly language in the original program are generated in the work area of the intermediate program, as shown in Fig. 2. Furthermore, in the first generation process, the address calculation area R11 is redefined in the same area as the fixed-point arithmetic area R10.
[0028] The second generation process generates an intermediate program including an item (hereinafter referred to as the "first linkage item Cl1") for reserving an address area for a displacement instruction using a specific register among the 16 registers in the original program. In the second generation process, for example, a first linkage item C11 is generated for each register.
[0029] The programming language conversion system 100 can solve the problem that an operand indicating a register specification in an assembly language cannot be appropriately converted into a conversion program by the second generation process.
[0030] Specifically, in the second generation process, for the displacement specification, an intermediate program is generated in which the move instruction "MVC 0(12,R6),TRNHINBN" (the instruction on line number "6"), which includes the register specification "0(12,R6)" in the original program shown in Fig. 2, is converted to "MVC R6L_X0000012,TRNHINBN", which includes the register number, the description of the register item attribute, and the description indicating the address length. The register item attribute is, for example, character, packed number, binary number, etc.
[0031] The move instruction "MVC 0(12,R6),TRNHINBN" in the original program is an instruction to transfer TRNHINBN to an area 12 digits away by +0 from the address indicated by register R6. Note that before the execution of the register-specifying instruction, the DS-defined item address is set in register R6. That is, in the "MVC 0(12,R6)" instruction in the original program, "MVC" indicates the character type, "0" indicates the start position of register R6, and "12" indicates 12 digits.
[0032] In the intermediate program "R6L_X0000012," "R6L_" indicates register R6, "X" indicates the character type, "0000" indicates the start position of register R6, and "012" indicates 12 digits. In other words, the intermediate program "MVC R6L_X0000012,TRNHINBN" means that the first 12 digits of register R6L_DS are transferred to TRNHINBN.
[0033] More specifically, in the second generation process, when allocating address areas, an area for each register in the original program is generated in the first linkage item C11. That is, the first linkage item C11 is an item in which the area definition when an address is passed is specified.
[0034] For example, as shown in Figure 2, in the second generation process, for the instruction to obtain the address of MSTREC indicated by "LA R6,MSTREC" (the instruction at line number "5") in the original program, in order to set the address in a register item in COBOL, an intermediate program is generated so that the area address of "LINKAGE SECTION." can be set in the caller's address item ("WK-R6P" in address calculation area R11) via "ATOCADR", which is the first linkage item C11.
[0035] Next, the third generation process will be described with reference to Fig. 3. Fig. 3 is a diagram showing an example of the correspondence relationship between the original program, the intermediate program, and the conversion program in the third generation process.
[0036] The third generation process generates an intermediate program including an item (hereinafter, referred to as a "second linkage item C12") for reserving an address area for an instruction including a definition item of a dummy section.
[0037] A dummy section is an instruction that does not reserve an actual area but defines the format of the area. To use a dummy section, declare which register to use (for example, "USING DSCTRN,R9" on line number "9") and set the address of the actual area to that register (for example, "LA R9,TRNDAT" on line number "10").
[0038] The programming language conversion system 100 can solve the problem that the dummy sections in the original program cannot be appropriately converted into the converted program by the third generation process.
[0039] In the third generation process, the "USING" instruction in the original program is used to read which register the dummy section is used in. Then, in the third generation process, a second linkage item C12 is generated for each register used, an item name is defined with the register, and the dummy section item name is replaced with the item name with the register.
[0040] Specifically, the third generation process defines the items of the dummy section using, for example, register R9. In FIG. 3, the original program contains the instruction "USING DSCTRN,R9" (instruction on line number "9") indicating that DSCTRN indicating the dummy section is used in register R9, and the instruction "LA R9,TRNDAT" (instruction on line number "10") indicating that the actual area is the DS definition area of TRNDAT. The third generation process defines the instruction in register R9 with "R9L_DS" (line number "9"), and defines the item by adding "R9L_" to the DSCTRN item with "R9L_" in "R9L_DSCDAT" (line number "33"). In this way, the third generation process replaces the items of the dummy section of the original program with a definition with "R9L_".
[0041] Then, as shown in Figure 3, in the third generation process, for the instruction to obtain the address of "TRNDAT" indicated by "LA R9,TRNDAT" (line number "10") in the original program, in order to set the address in a register item in the converted program (e.g. COBOL), an intermediate program is generated that includes an instruction (line number "10") that can set the area address of "LINKAGE SECTION.", which is the second linkage item C12, to the caller's address item (e.g. "WK_R9P", which is the register item Cre of the intermediate program in Figure 2) via "ATOCADR."
[0042] Next, the fourth generation process will be described with reference to Fig. 4. Fig. 4 is a diagram showing an example of the correspondence relationship between the original program, the intermediate program, and the conversion program regarding the fourth generation process.
[0043] The fourth generation process generates an intermediate program including items that can be converted into a conversion program, in which a specified string is added to an item in the original program in which an absolute address corresponding to a specified process is set (hereinafter referred to as an "address constant item Ca").
[0044] For example, the address constant item Ca is the specification of "DC A(TRNDAT)" ("TRNDAT" is a DS definition item) shown in Figure 4, which is called an address constant, and is an item whose initial value is set at compile time. The address constant item Ca is set to the location of the DS definition item at compile time, and is set by calculating the absolute address where the program is loaded at run time.
[0045] In the fourth generation process, for example, in a conversion program (such as COBOL) in which an initial value for an address cannot be set, it is not possible to define an initial value such as an absolute address calculated at run time. Therefore, an intermediate program is generated that includes an item equivalent to a COBOL POINTER item, such as "ADTRNDAT_P" (line number "16") shown in Figure 4, in which "_P" is added to the address constant item in the original program.
[0046] The programming language conversion system 100 can solve the problem that the address constant item Ca in the original program cannot be appropriately converted into the converted program by the fourth generation process.
[0047] Next, the fifth generation process will be described with reference to Fig. 5. Fig. 5 is a diagram showing an example of the correspondence relationship between the original program, the intermediate program, and the conversion program in relation to the fifth generation process.
[0048] The fifth generation process generates an intermediate program in which the address addition instruction (third instruction) in the original assembly language program is converted into an instruction to add to a register item using the "LINKAGE SECTION" (first linkage item), which is a description for reserving address space.
[0049] Specifically, as shown in Figure 5, in the fifth generation process, when the TBL02 address is set in the "LINKAGE SECTION" that contains the register item for "LA R2,TBL02" (line number "2") in the original program, an intermediate program is generated so that the area definition item in the "LINKAGE SECTION" (line number "2") can be used. This makes it possible to refer to the top address of "TBL02".
[0050] Next, the fifth generation process generates an intermediate program including "LA 2,10(2)" which corresponds to the converted program "COMPUTE WK-R2=10+WK-R2.", an instruction to add 10 to a register item for arithmetic operations, for "LA R2,10(R2)" (line number "3") in the original program, which is an instruction to advance the address of register R2 by 10 bytes (add 10), i.e., an instruction to advance the entry of "TBL02" by one.
[0051] As a result, since the "05 WK-R2" area and the "WK-R2P" area in the conversion program are the same area, this is the same as moving WK-W2P forward by 10 bytes.
[0052] In this way, in the fifth generation process, an intermediate program is generated in which the items in the "LINKAGE SECTION" can be advanced by one entry by using the "SET ADDRESS OF R2L-DS TO WK-R2P" instruction (line number "3"), which resets the address advanced by one entry in the area of register R2 in the "LINKAGE SECTION" of the intermediate program generated by the generation unit 130.
[0053] The programming language conversion system 100 can solve the problem that an address addition instruction in an original program cannot be appropriately converted into a converted program by the fifth generation process.
[0054] The conversion unit 140 converts the intermediate program into a conversion program. The process of converting an intermediate program into a conversion program will be described below with reference to Figs.
[0055] The conversion unit 140 converts the register item Cre of the intermediate program generated based on the first generation process into an item definition of a register in the converted program. Specifically, as shown in Fig. 2, the conversion unit 140 converts into an item definition by a PIC clause or a POINTER clause in COBOL, for example.
[0056] The conversion unit 140 converts the first linkage item C11 of the intermediate program generated based on the second generation process into an item definition of a register in the converted program. Specifically, as shown in Fig. 2, the conversion unit 140 converts the instruction "LA 6,MSTREC" and the instruction of the linkage item C11 in the intermediate program into an instruction to set the MSTREC address to "WK-R6P POINTER" in the register definition of the converted program, an instruction "(line number "5" of the converted program in Fig. 2) that allows a special register for each register to refer to the LINKAGE area, and a data item definition instruction for each register below "LINKAGE SECTION".
[0057] At this time, the conversion unit 140 converts "R6L_X0000012", which indicates the displacement "0", the length "12", and the specification of the register "R6" in the intermediate program, into "R6L-X0000012" in the converted program.
[0058] The conversion unit 140 converts the items of the dummy section of the intermediate program generated based on the third generation process into item definitions of registers in the converted program. Specifically, as shown in Fig. 3, the conversion unit 140 converts the instruction "LA 9,TRNDAT" and the linkage item C12 in the intermediate program into an instruction to set the TRNDAT address to "WK-R9P POINTER" in the register definition of the converted program, an instruction to allow the LINKAGE area to be referenced in the special register for each register (line number "10" of the converted program in Fig. 3), and a data item definition instruction for each register below "LINKAGE SECTION".
[0059] At this time, the conversion unit 140 converts "R9L_DSCHINBN" in "MVC HINBAN, R9L_DSCHINBN" in the intermediate program to "R9L-DSCHINBN."
[0060] Based on the first to third generation processes, the programming language conversion system 100 generates an intermediate program to set a "LINKAGE SECTION" in the converted program, and converts the intermediate program into a converted program. That is, the programming language conversion system 100 generates an intermediate program in which assembly language instructions for register and displacement specification are replaced with item names generated in the "LINKAGE SECTION" for each register, thereby enabling the original program to be appropriately converted into a converted program.
[0061] The conversion unit 140 converts the address constant item Ca of the intermediate program generated based on the fourth generation process into an item definition of a register in the converted program. Specifically, as shown in Fig. 4, the conversion unit 140 converts "ADTRNDAT_P DSR" in the intermediate program into the instructions "01 WK-DS001." and "03 ADTRNDAT-P POINTER." in the converted program (line 16 of the converted program in Fig. 4).
[0062] Then, the conversion unit 140 generates a PERFORM command for initial processing and an ASMTOCBL-INIT routine command in the converted program (line number "16" in the converted program in FIG. 4). In this way, the converted program can transfer control to the ASMTOCBL-INIT routine when the program starts to be executed, and set an address in the generated POINTER item. This makes it possible to set the absolute address where the program was loaded in the converted program.
[0063] The conversion unit 140 converts the instruction relating to address addition in the intermediate program shown in FIG. 5, which is generated based on the fifth generation process, into an instruction relating to address addition in the converted program.
[0064] The identification code assigning unit 150 assigns an identification code for identifying each line of the original program, the intermediate program, and the converted program. The identification code may be any code that can identify each line, and may be, for example, consecutive numbers (line numbers). The programming language conversion system 100 assigns an identification code to each line of the original program, and assigns the same identification code to each line of the intermediate program and the converted program that corresponds to each line. This enables the programming language conversion system 100 to clarify the correspondence between each line of the original program and each line of the intermediate program and the converted program.
[0065] The comment section 160 specifies a comment for each line of instructions in the original program (for example, "ADTRNDAT-P is the address of TRNDAT" in line number "16" of the intermediate program in FIG. 4).
[0066] The display processing unit 170 outputs various information to the display unit 1007. The display processing unit 170 may, for example, display the original program, the intermediate program, and the converted program side by side on the display unit 1007. This allows the programming language conversion system 100 to provide the user with a screen that allows the user to easily grasp the correspondence between the original program, the intermediate program, and the converted program, thereby improving user convenience.
[0067] The display processing unit 170 displays the comments for each line of the original program identified by the comment unit 160 on the display unit 1007 by associating the comments with the instructions in the converted program corresponding to each line. This allows the programming language conversion system 100 to reflect the comments on the instructions of the creator of the original program in the converted program, thereby improving user convenience.
[0068] Furthermore, the display processing unit 170 associates each instruction in each line of the converted program with an instruction in the intermediate program corresponding to that instruction, and displays the associated instruction on the display unit 1007. Specifically, the display processing unit 170 displays, for example, an instruction in the intermediate program corresponding to a predetermined instruction in the converted program, on a line above that instruction. This allows the programming language conversion system 100 to display the intermediate program (or the original program) corresponding to each line of the converted program together with the converted program, thereby improving user convenience.
[0069] Furthermore, the display processing unit 170 displays on the display unit an identification code that can uniquely identify each of the instructions in each line included in the intermediate program (and the original program) in association with each of the instructions in each line. Then, the display processing unit 170 displays on the display unit 1007 the identification code associated with each of the instructions in each line included in the intermediate program in association with each of the instructions in each line included in the converted program that corresponds to each of the instructions in each line included in the intermediate program. This allows the programming language conversion system 100 to easily recognize the correspondence between the original program, intermediate program, and converted program, thereby improving user convenience.
[0070] <<Modifications>> The processing contents of the conversion unit 140 according to the modified example will be described with reference to Fig. 6. Fig. 6 is a diagram showing an example of the correspondence between the original program, intermediate program, and converted program regarding the processing in the conversion unit 140 according to the modified example. Note that in Fig. 6, "original program", "intermediate program", and "converted program" (COBOL as an example) are shown from the left frame on the page, and the same line numbers are assigned to the descriptions that correspond to each other.
[0071] The conversion unit 140 may appropriately convert each item located at consecutive addresses in the original program in assembly language into the conversion program. In this case, the conversion unit 140 sets a level number to each of the group items and the basic items. For example, basic items and group items with level numbers greater than 01 are subordinate to a group item to which level number 01 is set. As a result, areas subordinate to level number 01 are consecutively arranged under level number 01. In this way, the conversion unit 140 can convert the original program in assembly language into a conversion program by arranging each item at consecutive addresses by setting a level number using a group item based on the DS definition in assembly language.
[0072] 6, for "MSTREC DS OCL24" (line number "17") in the original program and the intermediate program, which is determined to be a 24-digit group item, the conversion unit 140 defines it as a 01-level group item with level number "01" and "01 MSTREC.", and defines a 03-level item for redefinition, "03 MSTREC-R.". "03 MSTREC-R" has 24 digits, the same as a 01-level group item, for example.
[0073] In the original program and intermediate program, "HINBAN DS OCL12" (line number "18"), which is determined to be a 12-digit group item, is converted to "05 HINBAN." at the 05 level because it is a level 03 item with 24 digits or less. Furthermore, "HINGS1 DS CL7" (line number "19") in the original program and intermediate program is converted to "07 HINGS1 PIC X(7)." at the 07 level as an elementary item. Similarly, "HINGS1 DS CL5" (line number "20") is converted to "07 HINGS1 PIC X(5)." at the 07 level as an elementary item. At this time, because 12 digits were allocated at the 05 level, it is converted back from the 07 level to the 05 level.
[0074] Then, in the original program and intermediate program, "H" in "URISU DS H" (line number "21") is defined as a level 05 basic item, and is converted as "05 URISU PIC S9(4) COMP.". Similarly, in the original program and intermediate program, "PL4" in "URITANKA DS PL4" (line number "22") is defined as a level 05 basic item, and is converted as "05 URITANKA PIC S9(7) COMP-3.". Similarly, in the original program and intermediate program, "PL6" in "URIKINGK DS PL6" (line number "23") is defined as a level 05 basic item, and is converted as "05 URIKINGK PIC S9(11) COMP-3.". At this time, since 24 digits for level 03 have been secured, the level number is initialized. After this, lines from 24 onwards in the original program and intermediate program are converted in the same way.
[0075] In this way, the conversion unit 140 can generate pointers one after another from the 01 level in the conversion program, COBOL, and set consecutive numbers.
[0076] <<Processing Procedure>> The processing procedure of the programming language conversion system 100 will be described with reference to Fig. 7. Fig. 7 is a flow chart showing an example of the processing procedure of the programming language conversion system 100.
[0077] In step S100, the programming language conversion system 100 assigns, for example, consecutive line numbers that allow each line to be identified, to each line of the original program. This allows the programming language conversion system 100 to provide the user with a display that allows visual confirmation of the correspondence between the original program and the intermediate program and the converted program.
[0078] In step S101, the programming language conversion system 100 copies an original program to generate a program for creating an intermediate program. For convenience, the copied original program will be described below as an intermediate program.
[0079] In step S102, the programming language conversion system 100 executes the first to fifth generation processes on the intermediate program. The first to fifth generation processes are as described above.
[0080] In step S103, the programming language conversion system 100 converts the intermediate program into a converted program, and displays the converted program on the display unit.
[0081] As described above, when converting an original program into a converted program, the programming language conversion system 100 generates an intermediate program in which each instruction in the original program is converted into a description that can be converted into the converted program. This allows the programming language conversion system 100 to appropriately convert a program written in assembly language into a program written in another programming language.
[0082] ===Hardware Configuration=== An example of a hardware configuration for implementing the programming language conversion system 100 on a computer will be described with reference to Fig. 8. Fig. 8 is a diagram showing an example of a hardware configuration of a computer.
[0083] As shown in FIG. 8, a computer 1000 includes a processor 1001, a memory 1002, a storage device 1003, an input I / F unit 1004, a data I / F unit 1005, a communication I / F unit 1006, and a display unit 1007.
[0084] The processor 1001 is a control unit that controls various processes in the computer 1000 by executing programs stored in the memory 1002 .
[0085] The memory 1002 is a storage medium such as a RAM (Random Access Memory), etc. The memory 1002 temporarily stores the program code of the program executed by the processor 1001 and data required when the program is executed.
[0086] The storage device 1003 is a non-volatile storage medium such as a hard disk drive (HDD), a flash memory, etc. The storage device 1003 stores an operating system and various programs for implementing the above-mentioned components.
[0087] The input I / F unit 1004 is a device for receiving input from a user. Specific examples of the input I / F unit 1004 include a keyboard, a mouse, a touch panel, various sensors, a wearable device, etc. The input I / F unit 1004 may be connected to the computer 1000 via an interface such as a USB (Universal Serial Bus).
[0088] The data I / F unit 1005 is a device for inputting data from outside the computer 1000. A specific example of the data I / F unit 1005 is a drive device for reading data stored in various storage media. The data I / F unit 1005 may be provided outside the computer 1000. In that case, the data I / F unit 1005 is connected to the computer 1000 via an interface such as a USB.
[0089] The communication I / F unit 1006 is a device for performing data communication via the Internet N, either wired or wirelessly, with an external device of the computer 1000. The communication I / F unit 1006 may be provided outside the computer 1000. In that case, the communication I / F unit 1006 is connected to the computer 1000 via an interface such as a USB.
[0090] The display unit 1007 is a device for displaying various types of information. Specific examples of the display unit 1007 include a liquid crystal display, an organic EL (Electro-Luminescence) display, a display of a wearable device, and the like. The display unit 1007 may be provided outside the computer 1000. In that case, the display unit 1007 is connected to the computer 1000 via, for example, a display cable. In addition, when a touch panel is adopted as the input I / F unit 1004, the display unit 1007 can be configured integrally with the input I / F unit 1004.
[0091] ===Summary=== <1> The programming language conversion system 100 in this embodiment converts an original program written in assembly language into a converted program written in a programming language different from the assembly language, and includes a generating unit 130 that generates an intermediate program including an original description item corresponding to the description of the original program, a register item Cre which is a description corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item C11 which is a description for reserving an address area for a first instruction of displacement specification using a first register among the predetermined number of registers, and a converting unit 140 that converts the intermediate program into a converted program. As a result, the programming language conversion system 100 can convert a converted program (e.g., COBOL) that does not have an instruction that directly specifies a register so that the values of the registers can be referenced and rewritten.
[0092] <2> In addition, the generation unit 130 in the programming language conversion system 100 in this embodiment generates an intermediate program by converting a first instruction written in assembly language into an instruction including register numbers corresponding to a predetermined number of registers, a description of the attributes of the register items, and a description indicating the length of an address. This enables the programming language conversion system 100 to appropriately convert operands indicating register designation in the original program into the conversion program.
[0093] <3> The generating unit 130 in the programming language conversion system 100 in this embodiment generates an intermediate program that further includes a second linkage item C12, which is a description for reserving an address area for a second instruction that uses a second register among a predetermined number of registers and includes a definition item of a dummy section written in assembly language. This enables the programming language conversion system 100 to appropriately convert the dummy section in the original program into a conversion program.
[0094] <4> In addition, the generating unit 130 in the programming language conversion system 100 in this embodiment generates an intermediate program by converting address constant items Ca, which are written in assembly language and have absolute addresses corresponding to predetermined processes, into items that can be converted into a conversion program and have predetermined character strings added to them. This allows the programming language conversion system 100 to appropriately convert the address constant items Ca in the original program into a conversion program.
[0095] <5> Furthermore, the generating unit 130 in the programming language conversion system 100 in this embodiment generates an intermediate program by converting the third instruction for adding an address written in assembly language into an instruction for adding to the register item Cre using the first linkage item. This allows the programming language conversion system 100 to appropriately convert the address addition instruction in the original program into the converted program.
[0096] It should be noted that the present embodiment is an example for explaining the present invention, and the present invention is not limited to the embodiment. The present invention can be modified in various ways without departing from the gist of the present invention. The components of the programming language conversion system 100 described in the above embodiment are realized in cooperation with other hardware by the processor 1001 executing a program stored in the storage device 1003. [Explanation of symbols]
[0097] 100: programming language conversion system, 110: storage unit, 120: acquisition unit, 130: generation unit, 140: conversion unit, 150: identification code assignment unit, 160: comment unit, 170: display processing unit.
Claims
1. A programming language conversion system that converts an original program written in an assembly language into a converted program written in a programming language other than the assembly language, a generating unit that generates an intermediate program including: an original description item corresponding to a description of the original program; a register item which is a description corresponding to each of a predetermined number of registers in an assembly language; and a first linkage item which is a description for reserving an address area for a first instruction of displacement specification using a first register among the predetermined number of registers; a conversion unit that converts the intermediate program into the conversion program; A programming language conversion system comprising:
2. the generation unit converts the first instruction written in an assembly language into an instruction including register numbers corresponding to the predetermined number of registers, a description of an attribute of a register item, and a description indicating an address length, to generate the intermediate program; 2. The programming language conversion system of claim 1.
3. the generation unit generates the intermediate program, the intermediate program further including a second linkage item which is a description for reserving an address area for a second instruction, the second instruction using a second register among the predetermined number of registers, the second instruction including a definition item of a dummy section written in an assembly language; 2. The programming language conversion system of claim 1.
4. the generating unit converts address constant items, which are written in assembly language and in which absolute addresses corresponding to predetermined processing are set, into items to which a predetermined character string is added and which can be converted into the converted program, to generate the intermediate program; 2. The programming language conversion system of claim 1.
5. the generating unit converts a third instruction for adding an address written in an assembly language into an instruction for adding to the register item by using the first linkage item, thereby generating the intermediate program.
2. The programming language conversion system of claim 1.
6. The computer generating an intermediate program including an original description item corresponding to a description of an original program written in an assembly language, register items which are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item which is a description for reserving an address area for a first instruction of a displacement specification using a first register among the predetermined number of registers; converting the intermediate program into a conversion program written in a programming language other than assembly language; A programming language transformation method for performing
7. On the computer, generating an intermediate program including an original description item corresponding to a description of an original program written in an assembly language, register items which are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item which is a description for reserving an address area for a first instruction of a displacement specification using a first register among the predetermined number of registers; converting the intermediate program into a conversion program written in a programming language other than assembly language; A program for executing the above.
Citation Information
Patent Citations
Assembly instruction conversion method based on the correlation between high-level languages and assembly languages
CN113282301B
Software development support device
JP2004252807A
Assembly code conversion device and conversion method thereof
JP2015197821A
Document generation device, generation method for document, and program
JP2017062746A
Method and apparatus for converting software
US20110271247A1