Programming language conversion system, programming language conversion method, and program
The programming language conversion system generates intermediate programs to translate assembly language into COBOL by using register and linkage items, addressing register specifications and address additions, ensuring accurate conversion and user-friendly display.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2026-03-12
AI Technical Summary
Existing systems struggle to convert assembly language programs into other programming languages when certain instructions, such as those involving register specifications, dummy sections, address constants, and address additions, cannot be properly translated.
A programming language conversion system that generates an intermediate program by converting assembly language instructions into equivalent descriptions using register items, linkage items, and address constant items, allowing for appropriate conversion into another programming language.
Enables the conversion of assembly language programs into other languages like COBOL by addressing register specifications, dummy sections, and address additions, ensuring accurate translation and user-friendly display of conversion processes.
Smart Images

Figure 2026043647000001_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 assembly language into COBOL is known (see, for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2017-62746 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 that constitutes 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, the document generation device described in Patent Document 1 has a problem in that 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 that can appropriately convert 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 the description of the original program, register items that are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item that is a description for reserving address space for a first instruction that specifies a displacement 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 involves 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. [Effects of the Invention]
[0010] According to the present invention, it is possible to provide a system that can appropriately convert assembly language into other programming languages. [Brief explanation of the drawings]
[0011] [Figure 1] FIG. 1 illustrates an example of an outline of the configuration of a programming language conversion system. [Figure 2] FIG. 10 is a diagram showing an example of the correspondence between an original program, an intermediate program, and a conversion program regarding a first generation process and a second generation process. [Figure 3] FIG. 10 is a diagram illustrating an example of the correspondence between an original program, an intermediate program, and a conversion program in relation to the third generation process. [Figure 4] FIG. 10 is a diagram showing an example of the correspondence between an original program, an intermediate program, and a conversion program in relation to a fourth generation process. [Figure 5] FIG. 13 is a diagram showing an example of the correspondence between an original program, an intermediate program, and a conversion program in relation to a fifth generation process. [Figure 6] FIG. 10 is a diagram showing an example of the correspondence between an original program, an intermediate program, and a converted program regarding processing in a conversion unit according to a modified example. [Figure 7] FIG. 10 is a flowchart illustrating an example of a processing procedure of a programming language conversion system. [Figure 8] FIG. 2 illustrates an example of a hardware configuration of a computer. DETAILED DESCRIPTION OF THE INVENTION
[0012] A preferred embodiment of the present invention (hereinafter referred to as "the present embodiment") will be described with reference to the accompanying drawings. In each drawing, components with the same reference numerals have the same or similar configurations. In this embodiment, "unit," "means," "device," and "system" do not simply mean physical means, but also include cases where the functions of the "unit," "means," "device," and "system" are realized by software. Furthermore, the functions of one "unit," "means," "device," or "system" may be realized by two or more physical means or devices, and the functions of two or more "units," "means," "device," or "system" may be realized by one physical means or device.
[0013] ===Programming Language Conversion System 100=== <<Summary>> 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 the "original program") into a program written in another programming language (such as COBOL, C, or Java) (hereinafter referred to as the "converted program"), the programming language conversion system 100 generates a program written in assembly language (hereinafter referred to as the "intermediate program") by converting part of the original 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 simply referring to a database that associates the original program description with the converted program description one-to-one.The programming language conversion system 100 has a feature not found in conventional technologies: it can convert an original program into a converted program appropriately and without problems by using an intermediate program that appropriately converts descriptions that hinder conversion of the original program into a converted program.
[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 part of the description 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, laptop, tablet, etc.), a media computing platform (e.g., a cable or satellite set-top box, a digital video recorder), a handheld computing device (e.g., a PDA, an email client, etc.), or any other type of computing or communications 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, but not limited to, cloud computing configured with 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 assembly language. The original program may include, for example, a description including instructions not written in assembly language and assembly language instructions 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 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 in order 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 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 calculation, and logical operations.
[0026] By using 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 that directly specify registers.
[0027] Specifically, in the first generation process, register items Cre corresponding to 16 registers in the assembly language of the original program are generated in the work area of the intermediate program, as shown in Figure 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 that includes an item (hereinafter referred to as "first linkage item Cl1") for reserving an address area for a displacement instruction that uses a specific register out of 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 assembly language cannot be appropriately converted into a converted program by the second generation process.
[0030] Specifically, in the second generation process, 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 Figure 2, for displacement specification, is converted into "MVC R6L_X0000012,TRNHINBN," which includes the register number, a description of the register item attribute, and a description indicating the address length. The register item attribute can be, for example, character, packed number, or binary number.
[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 register-specifying instruction is executed, 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 that specifies the area definition when an address is passed.
[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 converted program in the third generation process.
[0036] The third generation process generates an intermediate program that includes an item (hereinafter referred to as a "second linkage item C12") for reserving an address area for an instruction that includes a definition item of a dummy section.
[0037] A dummy section is an instruction that defines the format of an area without reserving a real 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 real 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 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 Figure 3, the original program contains the instruction "USING DSCTRN,R9" (instruction on line number "9"), which indicates that DSCTRN, which indicates the dummy section, is used in register R9, and the instruction "LA R9,TRNDAT" (instruction on line number "10"), which indicates that the actual area is the DS definition area of TRNDAT. For this instruction, the third generation process defines register R9 with "R9L_DS" (line number "9"), and defines the DSCTRN item with "R9L_" appended to it with "R9L_" appended to "R9L_DSCDAT" (line number "33"). In this way, the third generation process replaces the items of the dummy section in the original program with definitions appended 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 that address in a register item in the converted program (for example, 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 (for example, "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 between the original program, the intermediate program, and the conversion program in relation to the fourth generation process.
[0043] The fourth generation process generates an intermediate program that includes items that can be converted into a conversion program, in which a specified string is added to an item in the original program where an absolute address corresponding to a specified process is set (hereinafter referred to as an "address constant item Ca").
[0044] The address constant item Ca is an item whose initial value is set at compile time, for example, the specification of "DC A(TRNDAT)" ("TRNDAT" is a DS definition item) shown in Figure 4. 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) that cannot set an initial value item for an address, it is not possible to define an initial value that calculates and sets an absolute address at runtime. 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 between the original program, the intermediate program, and the converted 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" containing 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 start 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.", which is an instruction to add 10 to a register item for arithmetic operations, for the original program's instruction "LA R2,10(R2)" (line number "3"), 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] This is the same as moving WK-W2P forward by 10 bytes, since the "05 WK-R2" area and the "WK-R2P" area in the conversion program are the same area.
[0052] In this way, in the fifth generation process, the "SET ADDRESS OF R2L-DS TO WK-R2P" instruction (line number "3") resets the address of the entry advanced by one to the area of register R2 in the "LINKAGE SECTION" of the intermediate program generated by the generation unit 130, thereby generating an intermediate program in which the items in the "LINKAGE SECTION" can be advanced by one entry.
[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 a register item definition in the converted program. Specifically, as shown in Fig. 2, the conversion unit 140 converts into an item definition using 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 a register item definition 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 to enable the LINKAGE area to be referenced in a special register for each register (line number "5" in the converted program in Fig. 2), and a data item definition instruction for each register under "LINKAGE SECTION".
[0057] At this time, the conversion unit 140 converts "R6L_X0000012" in the intermediate program, which indicates a displacement of "0", a length of "12", and a register specification of "R6", 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 register item definitions in the converted program. Specifically, as shown in Fig. 3, the conversion unit 140 converts the instructions "LA 9,TRNDAT" and linkage item C12 in the intermediate program into an instruction in the converted program to set the TRNDAT address to "WK-R9P POINTER" in the register definition of the converted program, an instruction that enables the LINKAGE area to be referenced in a special register for each register (line number "10" in 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 that sets 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 appropriate conversion of the original program into the 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 a register item definition in the converted program. Specifically, as shown in Fig. 4, the conversion unit 140 converts "ADTRNDAT_P DS R" 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] The conversion unit 140 then generates a PERFORM instruction for initialization and an instruction for the ASMTOCBL-INIT routine in the converted program (line number "16" in the converted program in FIG. 4). In this way, the converted program transfers control to the ASMTOCBL-INIT routine when program execution starts, and it becomes possible to set an address in the generated POINTER item. This makes it possible to set the absolute address at which 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 to each line of the original program, intermediate program, and 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 converted program that corresponds to each line. This allows 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 converted program.
[0065] The comment section 160 specifies a comment for each line of instruction in the original program (for example, "ADTRNDAT-P is the address of TRNDAT" on line number "16" in the intermediate program in FIG. 4).
[0066] The display processing unit 170 outputs various information to the display unit 1007. For example, the display processing unit 170 may display the original program, intermediate program, and 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 understand the correspondence between the original program, intermediate program, and converted program, thereby improving user convenience.
[0067] The display processing unit 170 associates the comments for each line of the original program identified by the comment unit 160 with the instructions in the converted program corresponding to each line, and displays the comments on the display unit 1007. 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, one line above that instruction. This allows the programming language conversion system 100 to display the intermediate program (or 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 on each line included in the intermediate program (and the original program) in association with each of the instructions on each line.The display processing unit 170 then displays on the display unit 1007 the identification code that is associated with each of the instructions on each line included in the intermediate program in association with each of the instructions on each line included in the converted program that corresponds to each of the instructions on 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 content 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 Fig. 6 shows the "original program," "intermediate program," and "converted program" (COBOL as an example) in order from the left frame on the page, and the same line numbers are assigned to the corresponding statements.
[0071] The conversion unit 140 may appropriately convert each item located at consecutive addresses in the original assembly language program into a converted program. In this case, the conversion unit 140 sets a level number for each group item and elementary item. For example, elementary 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 allocated to level number 01. In this way, the conversion unit 140 can convert the original assembly language program into a converted program by arranging each item at consecutive addresses by setting level numbers using group items 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 or fewer digits. 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, the "H" in "URISU DS H" (line number "21") is defined as a level 05 elementary item, and is converted as "05 URISU PIC S9(4) COMP.". Similarly, in the original program and intermediate program, the "PL4" in "URITANKA DS PL4" (line number "22") is defined as a level 05 elementary item, and is converted as "05 URITANKA PIC S9(7) COMP-3.". Similarly, in the original program and intermediate program, the "PL6" in "URIKINGK DS PL6" (line number "23") is defined as a level 05 elementary item, and is converted as "05 URIKINGK PIC S9(11) COMP-3.". At this time, since 24 digits of level 03 have been secured, the level number is initialized. After this, lines 24 and onward 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 COBOL conversion program, for example, 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 to each line of the original program, allowing each line to be individually identified. 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, the intermediate program, and the converted program.
[0078] In step S101, the programming language conversion system 100 copies the original program to generate a program for use in 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, the 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), flash memory, etc. The storage device 1003 stores an operating system and various programs for realizing 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, and a wearable device. 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 this 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 devices external to the computer 1000. The communication I / F unit 1006 may be provided external to the computer 1000. In this 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, and a display of a wearable device. The display unit 1007 may be provided outside the computer 1000. In this case, the display unit 1007 is connected to the computer 1000 via, for example, a display cable. Furthermore, when a touch panel is used as the input I / F unit 1004, the display unit 1007 can be configured as an integrated unit with the input I / F unit 1004.
[0091] ===Summary=== <1> The programming language conversion system 100 of 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 generation unit 130 that generates an intermediate program including original description items corresponding to the description of the original program, register items Cre that are descriptions corresponding to each of a predetermined number of registers in the assembly language, and a first linkage item C11 that is a description for reserving an address area for a first instruction that specifies a displacement using a first register among the predetermined number of registers; and a conversion unit 140 that converts the intermediate program into a converted program. This allows the programming language conversion system 100 to convert a converted program (e.g., COBOL) that does not have an instruction that directly specifies a register so that register values can be referenced and rewritten.
[0092] <2> Furthermore, the generation unit 130 in the programming language conversion system 100 of 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 register item attributes, and a description indicating the address length. This allows the programming language conversion system 100 to appropriately convert operands indicating register specification in the original program into a converted program.
[0093] <3> Furthermore, the generation unit 130 in the programming language conversion system 100 of this embodiment generates an intermediate program that further includes a second linkage item C12, which is 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, and is a description for reserving an address area for the second instruction. This allows the programming language conversion system 100 to appropriately convert the dummy section in the original program into a converted program.
[0094] <4> Furthermore, the generation unit 130 in the programming language conversion system 100 of 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 to which predetermined character strings are added and which can be converted into a conversion program. 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 generation unit 130 in the programming language conversion system 100 of 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 a converted program.
[0096] It should be noted that the present embodiment is an example for explaining the present invention, and is not intended to limit the present invention to only this embodiment. Furthermore, the present invention can be modified in various ways without departing from the spirit of the present invention. Furthermore, the components of the programming language conversion system 100 described in the above embodiment are assumed to be 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 original description items corresponding to descriptions of the original program, register items that are descriptions corresponding to a predetermined number of registers in an assembly language, and a first linkage item that is a description for reserving an address area for a first instruction that specifies a displacement 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 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; 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 second instruction using a second register among the predetermined number of registers and includes a definition item of a dummy section written in assembly language, and is a description for reserving an address area for the second instruction; The programming language conversion system of claim 1 .
4. the generation unit converts address constant items, which are written in assembly language and in which absolute addresses corresponding to predetermined processes are set, into items to which predetermined character strings are added and which can be converted into the conversion program, to generate the intermediate program. The programming language conversion system of claim 1 .
5. the generation unit converts a third instruction for adding an address written in assembly language into an instruction for adding to the register item using the first linkage item, thereby generating the intermediate program. The programming language conversion system of claim 1 .
6. The computer generating an intermediate program including original description items corresponding to descriptions 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 an address area for a first instruction specifying a displacement using a first register among the predetermined number of registers; converting the intermediate program into a converted 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 original description items corresponding to descriptions 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 an address area for a first instruction specifying a displacement using a first register among the predetermined number of registers; converting the intermediate program into a converted program written in a programming language other than assembly language; A program to execute.
Citation Information
Patent Citations
Document generation device, generation method for document, and program
JP2017062746A