Programming language conversion system, programming language conversion method, and program

The programming language conversion system effectively translates assembly language programs into other languages by replacing and rearranging instructions, ensuring complete and accurate conversion.

JP7608654B1Active Publication Date: 2025-01-06유겐가이샤티아이에스
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2024029719
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2024-02-29
Publication Date
2025-01-06
Estimated Expiration
2044-02-29

AI Technical Summary

Technical Problem

Existing systems struggle to convert assembler programs containing instructions that cannot be properly converted to another programming language, leading to incomplete translation.

Method used

A programming language conversion system that extracts and replaces assembly language instructions with equivalent instructions in a different programming language, using definition and conversion information to generate a replacement program that can be accurately translated.

Benefits of technology

Enables the conversion of assembly language programs into other programming languages like COBOL, C, or Java, by addressing the unique positions and meanings of instructions, ensuring complete and accurate translation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007608654000001_ABST
    Figure 0007608654000001_ABST
Patent Text Reader

Abstract

A programming language conversion system, method and program for appropriately converting an assembly language into another programming language are provided. [Solution] The system includes an acquisition unit that acquires a first program, at least a portion of which is written in assembly language; an instruction extraction unit that extracts instructions from the first program that define constants, variables, formulas, and command description areas written in assembly language with specified names; a replacement unit that replaces constants, variables, formulas, and command description areas defined with specified names in the first program with information indicating constants, variables, formulas, and command description areas in assembly language that can be converted into instructions of a conversion program written in a programming language other than assembly language; and a conversion unit that converts the replaced first program, the replacement program, into a conversion program based on conversion information for converting instructions in assembly language into instructions in the programming language of the conversion program.
Need to check novelty before this filing date? Find Prior Art

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 includes an acquisition unit that acquires a first program, at least a portion of which is written in assembly language; an instruction extraction unit that extracts from the first program an instruction that defines at least one of constants, variables, formulas, and instruction writing areas written in assembly language with a predetermined name; a replacement unit that replaces any of the constants, variables, formulas, and instruction writing areas defined with the predetermined name in the first program with information indicating any of the constants, variables, formulas, and instruction writing areas in assembly language, which can be converted into instructions of a conversion program written in a programming language other than assembly language, based on definition information generated by associating the predetermined name defined in the instruction extracted by the instruction extraction unit with any of the constants, variables, formulas, and instruction writing areas; and a conversion unit that converts the replacement program, which is the first program replaced by the replacement unit, into the conversion program based on conversion information for converting instructions in assembly language into instructions in the programming language of the conversion program.

[0008] A programming language conversion method according to one embodiment of the present invention includes a computer that acquires a first program, at least a portion of which is written in assembly language; extracts from the first program instructions that define at least one of constants, variables, formulas, and command description areas written in assembly language with a predetermined name; replaces any of the constants, variables, formulas, and command description areas defined with the predetermined name in the extracted instructions with information indicating any of the constants, variables, formulas, and command description areas in assembly language that can be converted into instructions of a conversion program written in a programming language other than assembly language, based on definition information generated by associating the predetermined name defined in the extracted instructions with any of the constants, variables, formulas, and command description areas; and converts the replaced first program, which is the replacement program, into the conversion program based on conversion information for converting instructions in assembly language into instructions in the programming language of the conversion program.

[0009] A program according to one embodiment of the present invention causes a computer to execute the following steps: acquire a first program, at least a portion of which is written in assembly language; extract from the first program an instruction that defines, with a predetermined name, at least one of a constant, a variable, a formula, and a command description area written in assembly language; replace, based on definition information generated by associating the predetermined name defined in the extracted instruction with any one of a constant, a variable, a formula, and a command description area, the constant, the variable, the formula, and the command description area defined with the predetermined name in the first program, with information indicating any one of a constant, a variable, a formula, and a command description area in assembly language that can be converted into instructions of a conversion program written in a programming language different from assembly language; and convert, based on conversion information for converting instructions in assembly language into instructions in the programming language of the conversion program, the replaced first program, into the conversion program. 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 a configuration of a programming language conversion system. [Diagram 2] 13 is a diagram showing an example of the configuration of replacement information D111. FIG. [Diagram 3] 13 is a diagram showing an example of the configuration of definition information D112. FIG. [Figure 4] FIG. 13 is a diagram showing an example of the configuration of conversion information D113. [Diagram 5] FIG. 2 is a flowchart illustrating an example of a processing procedure of the programming language conversion system. [Figure 6]FIG. 13 is a diagram illustrating an example of a process for creating a register area for a conversion program. [Figure 7] 13A and 13B are diagrams illustrating an example of a process for connecting continuing lines. [Figure 8] FIG. 13 is a diagram illustrating an example of a decomposition process of a DC instruction that defines a constant. [Figure 9] FIG. 11 is a diagram illustrating an example of a process of replacing a first description with a second description. [Figure 10] FIG. 11 is a diagram illustrating an example of a process of replacing a third description with a fourth description. [Figure 11] FIG. 13 is a diagram illustrating an example of a process for converting a constant definition of an EQU instruction. [Figure 12] FIG. 11 is a diagram showing an example of a process for converting an area defined by a DSECT command. [Figure 13] 11 is a diagram showing an example of a process of converting a DC command and a DS command out of information indicating a DC command, a DS command, an ORG command, and a DCB macro command. FIG. [Figure 14] 11A and 11B are diagrams illustrating an example of a process for converting a length notation and an operation notation. [Figure 15] FIG. 13 is a diagram illustrating an example of a process for replacing an area name in an instruction operand portion; [Figure 16] FIG. 13 is a diagram showing an example of a process for generating an address constant in an area definition of a DS (POINTER). [Figure 17] FIG. 13 is a diagram illustrating an example of a process for replacing an address notation specified by a base and a displacement. [Figure 18] FIG. 13 illustrates an example of a process for adding a comment to a conversion program. [Figure 19] 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 an assembly language into another programming language. Before converting a program written in an assembly language (hereinafter referred to as an "original program") into a program written in another programming language (such as a programming language such as COBOL, C language, or Java) (hereinafter referred to as a "converted program"), the programming language conversion system 100 generates a program written in an assembly language by converting a part of the original program (hereinafter referred to as a "replacement program").

[0014] The replacement 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] The programming language conversion system 100 generates definition information D112, which is a database for generating a replacement program and will be described later, based on the description of the original program. The definition information D112 includes, for example, information that may be an obstacle when converting the original program into a conversion program. Information that may be an obstacle is, for example, instructions that define constants, variables, mathematical expressions, and instruction description areas. In assembly, the position where such information is written in the program is not fixed, and therefore, it becomes an obstacle when converting the original program into the conversion program.

[0016] Therefore, the programming language conversion system 100 refers to the definition information D112 and generates a replacement program in which the instructions in the original program that define constants, variables, mathematical expressions, and instruction description areas are replaced with descriptions that can be converted into a conversion program. Then, the programming language conversion system 100 converts the replacement program into a conversion program by referring to conversion information D113, which will be described later and is a database for converting the description of the replacement program into the description of the conversion program.

[0017] That is, the programming language conversion system 100 does not convert an original program into a converted program by referring only to a database that has a one-to-one correspondence between the description of the original program and the description of the converted program. As described above, the programming language conversion system 100 has a feature not found in the prior art, that is, it extracts a predetermined description from the original program to generate definition information D112, and uses a replacement program that replaces a part of the description of the original program with reference to the definition information D112, thereby making it possible to appropriately and without problems convert the original program into a converted program.

[0018] <<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.

[0019] The programming language conversion system 100 is a system that generates a substituted program by replacing a part of an original program and converts the substituted program into a converted program.

[0020] 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).

[0021] As shown in FIG. 1, the programming language conversion system 100 includes, for example, a memory unit 110, an acquisition unit 120, an instruction extraction unit 130, an instruction information generation unit 140, a replacement unit 150, a conversion unit 160, an identification code assignment unit 170, a comment unit 180, and a display processing unit 190.

[0022] The storage unit 110 stores an original program, a conversion program, and a replacement program in association with each other. The storage unit 110 also includes, for example, replacement information D111, definition information D112, and conversion information D113.

[0023] The replacement information D111 will be described with reference to Fig. 2. Fig. 2 is a diagram showing an example of the configuration of the replacement information D111. The programming language conversion system 100 uses the replacement information D111 to replace a description that is not written in assembly language and that includes at least one instruction included in the original program, with an instruction in assembly language.

[0024] As shown in FIG. 2, the replacement information D111 may include, for example, items of [defined name] and [instruction]. [defined name] stores a name that defines an instruction word in assembly language. In other words, the defined name (first description) is a description of an instruction not written in assembly language, and is a so-called macro instruction. [Instruction] includes at least one instruction written in assembly language that is defined by the defined name. As shown in FIG. 2, for example, the defined name "CCON" is a description indicating a macro instruction not written in assembly language, and is composed of "C0001 DC C'0001'" and "C10 DC C'10'".

[0025] The definition information D112 will be described with reference to FIG. 3. FIG. 3 is a diagram showing an example of the configuration of the definition information D112. The definition information D112 is a database generated by extracting each instruction included in the original program. The programming language conversion system 100 generates a replacement program by replacing a part of the description of the original program using the definition information D112. By generating the definition information D112, the programming language conversion system 100 can solve the problem that the program cannot be appropriately converted by a process of converting into a conversion program in order from the top line, which is caused by the arbitrary arrangement of various instructions in an assembly language program. Note that the definition information D112 may store the description of each instruction in the assembly language in association with a description that can be converted into a conversion program (for example, a length notation, not shown).

[0026] As shown in FIG. 3, the definition information D112 includes, for example, a database D112a relating to DS and DC instructions, a database D112b relating to an ORG instruction, a database D112c relating to an EQU instruction, a database D112d relating to a DCB macro instruction, and a database D112e relating to a DSECT instruction in assembly language.

[0027] The database D112a relating to DS instructions and DC instructions is a database that stores DS instructions (e.g., defining variables) and DC instructions (e.g., defining constants) included in the original program. The database D112a relating to DS instructions and DC instructions is shown as storing the program P1 in a table format as an example. For example, the database D112a relating to DS instructions and DC instructions may include the items [Label name], [Assembler instruction], [Attribute], [Length], and [Constant].

[0028] The database D112b related to the ORG instruction is a database that stores ORG instructions (e.g., instructions that change a location counter) included in the original program. The database D112b related to the ORG instruction is shown as an example in which the program P2 is stored in a table format. For example, the database D112b related to the ORG instruction may include the items [Order of appearance], [Assembler instruction], [Area name], and [Displacement].

[0029] The database D112c related to the EQU instruction is a database that stores the EQU instruction included in the original program. The database D112c related to the EQU instruction (e.g., an instruction for naming an expression or a numerical value) is shown as storing the program P3 in a table format as an example. For example, the database D112c related to the EQU instruction may include the items [label name], [assembler instruction], and [value].

[0030] The database D112d relating to DCB macro instructions is a database that stores DCB macro instructions included in an original program. The database D112d relating to DCB macro instructions (e.g., instructions used to complete information in a data control block during execution of a job) is shown as storing the program P4 in a table format as an example. For example, the database D112d relating to DCB macro instructions may include the items [Label name], [Macro instruction], [DDNAME], [DSORG], [MACRF], [EODAD], and [SYNAD].

[0031] The database D112e relating to the DSECT instruction is a database that stores the DSECT instruction included in the original program. The database D112e relating to the DSECT instruction (e.g., an instruction indicating an instruction description area including definitions of multiple constants and variables) is shown as storing the program P5 in a table format as an example. For example, the database D112e relating to the DSECT instruction may include the items [DSECT name], [label name], [assembler instruction], [attribute], and [length].

[0032] The conversion information D113 will be described with reference to Fig. 4. Fig. 4 is a diagram showing an example of the configuration of the conversion information D113. The programming language conversion system 100 uses the conversion information D113 to convert each line of the replacement program into each line of the conversion program.

[0033] 4, the conversion information D113 may include items such as [Assembly language], [Conversion language], and [Conversion position]. [Assembly language] stores assembly language instructions. [Conversion language] stores a conversion language (e.g., a programming language such as COBOL) that corresponds to the assembly language. [Conversion position] stores the position of a statement in the converted program.

[0034] 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.

[0035] The instruction extraction unit 130 extracts from the original program instructions defined by a predetermined name that can be specified by a label name or assembler instruction included in the original program. For example, the instruction extraction unit 130 extracts "C'1'" that has a label name "ON" and is defined by an assembler instruction "EQU". In other words, the instruction extraction unit 130 extracts from the original program instructions that can be included in, for example, definition information D112.

[0036] The instruction information generating unit 140 generates definition information D112 based on the information extracted by the instruction extracting unit 130. This enables the programming language conversion system 100 to identify instruction contents defined by label names and assembler instructions in the original program, and therefore to generate a replacement program that can be appropriately converted into a converted program.

[0037] The replacement unit 150 replaces a given name in the original program with any one of a constant, a variable, a mathematical expression, and an instruction description area with reference to the definition information D112 to generate a replacement program. Specifically, for example, the replacement unit 150 replaces "ON" defined in "EQU" shown in FIG. 3 with "C'1'" (for example, a constant). Also, for example, the replacement unit 150 replaces a length notation (for example, "L'") and an arithmetic notation with a notation convertible to a conversion program (for example, a constant, a variable, or a numerical value). Also, for example, the replacement unit 150 replaces an area name in an instruction operand section (for example, a label name "OLAKBN" of DSECT shown in FIG. 3) with a notation convertible to a conversion program (for example, "R7L_OLAKBN" including information on a register). As a result, the programming language conversion system 100 can generate a replacement program in which a description in the original program that cannot be appropriately converted to a conversion program is replaced with a description that can be appropriately converted, and therefore can appropriately convert to a conversion program.

[0038] Furthermore, the replacement unit 150 replaces descriptions in the original program that are not written in assembly language (e.g., macro instructions) with descriptions that can be converted into a conversion program, with reference to the replacement information D111. Specifically, the replacement unit 150 replaces, for example, "CCON" shown in FIG. 2, which is not written in assembly language, with "C0001 DC C'0001'" and "C10 DC C'10'", which are in assembly language and can be converted into a conversion program, with reference to a conversion table (not shown). This allows the programming language conversion system 100 to generate a replacement program in which descriptions specific to the original program have been replaced with descriptions that can be appropriately converted into a conversion program.

[0039] Furthermore, when the original program contains a description of an instruction used in the conversion program, the replacement unit 150 replaces the description contained in the original program with a different description that can be converted into the conversion program. Specifically, the replacement unit 150, for example, refers to a conversion language table (not shown) (which may be the [Conversion Language] item of the conversion information D113) to identify a description used in the conversion program in the original program. The replacement unit 150 refers to a conversion table (not shown) to replace the identified description with a description in an assembly language that is not used in the conversion program and can be converted into the conversion program. This allows the programming language conversion system 100 to generate a replacement program by replacing a description that is contained in the original program and used in the conversion program, but has a different meaning from the conversion program, with a description in an assembly language that can be appropriately converted into the conversion program.

[0040] The conversion unit 160 converts the replacement program into the conversion program with reference to the conversion information D113. Specifically, the conversion unit 160 converts each line of the replacement program into the programming language of the conversion program in ascending order of line number, for example.

[0041] Furthermore, the conversion unit 160 refers to the conversion information D113 and writes instructions in the programming language of the conversion program corresponding to each instruction included in the replacement program at a predetermined position in the conversion program. Specifically, for example, the conversion unit 160 places the description of the variable definition (e.g., DS, DC, etc.) in the replacement program in an upper area (area with a small line number) in the conversion program when the programming language of the conversion program is COBOL, for example. This allows the programming language conversion system 100 to convert a description at an arbitrary position in an assembly language program into a conversion program while ensuring a specific arrangement in the programming language of the conversion program.

[0042] The identification code assigning unit 170 assigns an identification code for identifying each line of the original program, the replacement program, and the conversion 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 replacement program and the conversion 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 replacement program and the conversion program.

[0043] Comment section 180 specifies the comment for each line of instruction in the original program.

[0044] The display processing unit 190 outputs various information to the display unit 1007. For example, the display processing unit 190 may display the original program, the replacement program, and the conversion 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 replacement program, and the conversion program, thereby improving user convenience.

[0045] The display processing unit 190 displays the comments for each line of the original program identified by the comment unit 180 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.

[0046] Furthermore, the display processing unit 190 associates each instruction in each line of the conversion program with an instruction in the replacement program corresponding to that instruction and displays the associated instruction on the display unit 1007. Specifically, the display processing unit 190 displays, for example, an instruction in the replacement program corresponding to a specific instruction in the conversion program, on a line above that instruction. This allows the programming language conversion system 100 to display the replacement program (or the original program) corresponding to each line of the conversion program together with the conversion program, thereby improving user convenience.

[0047] Furthermore, the display processing unit 190 displays on the display unit an identification code that can uniquely identify each of the instructions in each line included in the replacement program (and the original program) in association with each of the instructions in each line. Then, the display processing unit 190 displays on the display unit 1007 the identification code associated with each of the instructions in each line included in the replacement program in association with each of the instructions in each line included in the conversion program that corresponds to each of the instructions in each line included in the replacement program. This allows the programming language conversion system 100 to easily recognize the correspondence between the original program, the replacement program, and the conversion program, thereby improving user convenience.

[0048] <<Processing Procedure>> The processing procedure of the programming language conversion system 100 will be described with reference to Figs. 5 to 17. Fig. 5 is a flow diagram showing an example of the processing procedure of the programming language conversion system 100. Fig. 6 is a diagram showing an example of a process of creating a register area for a conversion program. Fig. 7 is a diagram showing an example of a process of linking a continuation line. Fig. 8 is a diagram showing an example of a process of decomposing a DC instruction that defines a constant. Fig. 9 is a diagram showing an example of a process of replacing a first description with a second description. Fig. 10 is a diagram showing an example of a process of replacing a third description with a fourth description. Fig. 11 is a diagram showing an example of a process of converting a constant definition of an EQU instruction. Fig. 12 is a diagram showing an example of a process of converting an area specified by a DSECT instruction. Fig. 13 is a diagram showing an example of a process of converting a DC instruction and a DS instruction among information indicating a DC instruction, a DS instruction, an ORG instruction, and a DCB macro instruction. Fig. 14 is a diagram showing an example of a process of converting a length notation and an operation notation. Fig. 15 is a diagram showing an example of a process of replacing an area name of an instruction operand part. Fig. 16 is a diagram showing an example of a process for generating an address constant in an area definition of DS (POINTER). Fig. 17 is a diagram showing an example of a process for replacing an address notation specified by a base and a displacement. Fig. 18 is a diagram showing an example of a process for adding a comment to a converted program.

[0049] 6 to 17, the "original program", "replacement program", and "conversion program" (COBOL as an example) are shown from the left frame on the paper, and the corresponding descriptions are enclosed in dashed lines.

[0050] 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 replacement program and conversion program.

[0051] In step S101, the programming language conversion system 100 copies an original program to generate a program for creating a replacement program. For convenience, the copied original program will be described below as the replacement program.

[0052] In step S102, the programming language conversion system 100 executes an initial process on the replacement program. The initial process includes, for example, a process of creating a register area for the conversion program, a process of linking continuation lines, and a process of decomposing DC definitions.

[0053] 6, when the conversion program is, for example, COBOL, the process of creating a register area for the conversion program creates a virtual register area in the replacement program because registers cannot be used in COBOL, making it possible to reflect the register area definition in the conversion program, COBOL. This enables the programming language conversion system 100 to appropriately convert assembly language into a conversion program.

[0054] 7, when the DCB macro instructions are defined vertically in the assembly language, if the conversion program is, for example, COBOL, the continuation line linking process is defined horizontally in one line in the replacement program because vertically-aligned DCB macro instructions cannot be converted into the conversion program. This enables the programming language conversion system 100 to appropriately convert the assembly language into the conversion program.

[0055] 8, when the DC instructions are defined horizontally in the assembly language, the DC instructions defining constants are decomposed in multiple vertical lines in the replacement program because the horizontal DC instructions cannot be converted into the conversion program if the conversion program is, for example, COBOL. This enables the programming language conversion system 100 to appropriately convert the assembly language into the conversion program.

[0056] In step S103, the programming language conversion system 100 refers to the replacement information D111 and replaces a first description that is uniquely defined in each original program with a second description that can be converted into a conversion program.

[0057] As shown in Fig. 9, specifically, the programming language conversion system 100 replaces the first description (e.g., macro instructions) "CCON" and "PCON" (see the description of the original program) with the second description (assembly language) "DC" instruction (see the description of the replacement program). As an example, in Fig. 9, "CCON" and "PCON" are defined as instructions that generate DS and DC. This allows for appropriate conversion to the conversion program as shown in Fig. 9.

[0058] In step S104, if a third statement, which is an instruction word used in the conversion program, is used with a different meaning in the original program, the programming language conversion system 100 replaces the instruction word with a different fourth statement in the replacement program. Note that the programming language conversion system 100 identifies the third statement in the original program, for example, by referring to an instruction word table (not shown) that stores a list of instruction words used in the conversion program.

[0059] Specifically, as shown in Fig. 10, the programming language conversion system 100 replaces "PLUS" (see the description of the original program), which is an instruction word (third description) used in COBOL, with, for example, "PLUS_Y" (see the description of the replacement program). As a result, as shown in Fig. 10, the programming language conversion system 100 can appropriately convert into a conversion program.

[0060] In step S105, the programming language conversion system 100 obtains an EQU instruction, which is an instruction word in assembly language, from the replacement program and stores it in the definition information D112. The programming language conversion system 100 refers to the definition information D112 and replaces the EQU instruction of the replacement program (line "101420" in FIG. 11) with a constant.

[0061] Specifically, as shown in Fig. 11, the programming language conversion system 100 obtains the constant definitions (ON is "C'1'" and OFF is "C'0'") of the EQU instructions on lines "100420" and "100430" of the replacement program and stores them in definition information D112. Then, the programming language conversion system 100 refers to the definition information D112 and replaces "ON" and "OFF" appearing in the replacement program with constants. In this way, as shown in Fig. 11, the programming language conversion system 100 can appropriately convert into the conversion program even the names of constants in the original program that cannot be recognized by the conversion program.

[0062] In step S106, the programming language conversion system 100 obtains information indicating the area (instruction description area) of the DSECT instruction that includes definitions of multiple constants and variables, and stores it in the definition information D112.

[0063] As shown in FIG. 12, specifically, the programming language conversion system 100 acquires information indicating an area (lines "102150" to "102240" in FIG. 12) defined by a DSECT command from the replacement program.

[0064] In step S107, the programming language conversion system 100 obtains information indicating the DC instruction that defines a constant, the DS instruction that defines a variable, the ORG instruction that changes the location counter, and the DCB macro instruction that is used to complete information in a data control block during job execution, and stores the information in the definition information D112. Here, it is preferable that the programming language conversion system 100 obtains the DC instruction after obtaining the DS instruction, because the DS instruction is referenced by the DC instruction.

[0065] As shown in FIG. 13, specifically, the programming language conversion system 100 acquires, for example, information indicating a DS command (a DC command vertically decomposed in step S102) and an area defined by the DC command (lines "100590" to "100620" in FIG. 13).

[0066] In step S108, the programming language conversion system 100 refers to the definition information D112 and replaces the length notation "L'" and the operation notation "L'TBLLOG-5" in the original program with notations that can be changed to variable programs.

[0067] 14, specifically, the programming language conversion system 100, for example, refers to the definition information D112 to identify "TYP+L'TBLLOG-5(L'PTNLOG)" in the original program, and when it is determined that "the length of TBLLOG is 32" and "the length of PTNLOG is 12", it substitutes the result of this calculation, "TYP+27(12)", in the replacement program. This allows the replacement program to be appropriately converted into a conversion program, as shown in the conversion program in FIG.

[0068] In step S109, the programming language conversion system 100 replaces the area name of the instruction operand portion in the replacement program with reference to the definition information D112 (information indicating the area of ​​the DSECT instruction acquired in step S106).

[0069] Specifically, as shown in Fig. 15, the programming language conversion system 100 replaces, for example, "OLAKBN" shown in the original program with "R7L_OLAKBN" (OLAKBN means that register 7 is used as a base register) in the replacement program. In this way, by acquiring information indicating the area of ​​the DSECT instruction in advance in step S106, it is possible to generate a replacement program by replacing a description in the original program that cannot be properly converted into a conversion program with a description that can be properly converted. This makes it possible to properly convert the replacement program in assembly language into a conversion program, as shown in the conversion program in Fig. 15.

[0070] In step S110, the programming language conversion system 100 generates an area definition of DS(POINTER) in the replacement program, for example, if an address constant is used in the original program.

[0071] Specifically, as shown in Fig. 16, the programming language conversion system 100 replaces, for example, the "A(WOLA)" line of DC in the original program with a pseudo assembler instruction line of DS (definition to be converted as a POINTER item) in the replacement program. In this way, for example, when the conversion program is in COBOL, by replacing with a data type indicating an address called POINTER, the replacement program in assembly language can be appropriately converted into a conversion program as shown in the conversion program in Fig. 16.

[0072] In step S111, the programming language conversion system 100 replaces, for example, operands in which an address is expressed by a base and a displacement in each mnemonic of the original program.

[0073] Specifically, as shown in Fig. 17, the programming language conversion system 100 replaces the first operand of "CLC", "5(4,R9)", with "R9L_X0005004" (meaning that register 9 is used as the base register and the displacement is 5, and is an area name that can be converted into the conversion program) in the replacement program. As a result, the replacement program in assembly language can be appropriately converted into the conversion program as shown in the conversion program in Fig. 17.

[0074] In step S112, the programming language conversion system 100 refers to the definition information D112 and defines the area replaced in step S109 and the area replaced in step S111 together in the linkage section.

[0075] In step S113, the programming language conversion system 100 converts the replacement program into a conversion program, for example, by referring to the definition information D112 and the conversion information D113. At this time, the programming language conversion system 100 places each line of the replacement program in an appropriate line of the conversion program, by referring to the conversion information D113.

[0076] In step S114, the programming language conversion system 100 displays the converted program on the display unit. As shown in Fig. 18, the programming language conversion system 100 may add a comment to the converted program.

[0077] Specifically, the programming language conversion system 100 may associate a comment written in an assembler line of the original program (for example, "Assembly Language Reference Area" in FIG. 18) with a corresponding line of the converted program and display the comment (line "100460*" of the converted program in the center of FIG. 18). Furthermore, the programming language conversion system 100 may identifiably display the assembly language of the original program in association with the corresponding line of the converted program (line "100460*@@@" of the converted program on the right side of FIG. 18). In this way, the programming language conversion system 100 can visually and easily display the description of the assembly language and the corresponding converted program, thereby providing the user with a tool that allows them to easily check whether the conversion has been performed appropriately.

[0078] As described above, when converting an original program into a converted program, the programming language conversion system 100 generates referenceable definition information D112 and generates a replacement program in which each instruction of the original program is replaced with 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.

[0079] That is, for example, the programming language conversion system 100 can solve the problem of not being able to properly convert assembly language instructions when converting instructions of an original program in assembly language, which has the characteristic that instructions indicating constants, variables, formulas, and instruction description areas, etc. are not written in specific positions, into a converted program simply by referring to a conversion table.

[0080] Furthermore, for example, the programming language conversion system 100 generates a replacement program that replaces statements that would cause problems when directly converting an original program into a converted program, such as instructions that are not written in assembly language (e.g., "PCON" and "CCON" in FIG. 2), instructions that cannot be converted into other programming languages ​​(e.g., instructions written on multiple lines, instructions written on a single line, the length notation "L'" in FIG. 2, and operation notations), and statements used in other programming languages ​​(e.g., a third statement), thereby enabling appropriate and problem-free conversion into a converted program.

[0081] ===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. 19. Fig. 19 is a diagram showing an example of a hardware configuration of a computer.

[0082] As shown in FIG. 19, 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.

[0083] The processor 1001 is a control unit that controls various processes in the computer 1000 by executing programs stored in the memory 1002 .

[0084] 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.

[0085] 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.

[0086] 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).

[0087] 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.

[0088] 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.

[0089] 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.

[0090] ===Summary=== <1> The programming language conversion system 100 in this embodiment includes an acquisition unit that acquires an original program (first program) at least a part of which is written in assembly language, an instruction extraction unit 130 that extracts instructions (such as a DS instruction, a DC instruction, an ORG instruction, an EQU instruction, a DCB macro instruction, and a DSECT instruction) that define at least one of constants, variables, mathematical expressions, and instruction writing areas written in assembly language with a predetermined name (such as a label name or a mnemonic), from the original program (first program), and a definition information D112 that is generated by associating the predetermined name (such as a label name or a mnemonic) defined in the instruction extracted by the instruction extraction unit 130 with any one of constants, variables, mathematical expressions, and instruction writing areas, and a preceding instruction in the original program (first program) based on the definition information D112. The system includes a replacement unit 150 that replaces any of the constants, variables, formulas, and instruction description areas defined by the predetermined names (e.g., label names, mnemonics, etc.) with information indicating any of the constants, variables, formulas, and instruction description areas in assembly language that can be converted into instructions of a conversion program written in a programming language different from assembly language (e.g., a description indicating a "value" or "formula" of an EQU instruction, a constant, variable, or length notation of a DS / DC instruction, an instruction description area of ​​a DSECT instruction, etc.), and a conversion unit 160 that converts the replacement program, which is the original program (first program) replaced by the replacement unit 150, into the conversion program based on conversion information D113 for converting instructions in the assembly language into instructions in a programming language (e.g., COBOL, etc.) of the conversion program. In this way, the programming language conversion system 100 extracts predetermined descriptions from the original program to generate definition information D112, and uses a replacement program in which a part of the description of the original program is replaced with reference to the definition information D112, thereby making it possible to convert the original program into the conversion program appropriately and without problems.

[0091] <2> Furthermore, the original program (first program) in the programming language conversion system 100 in this embodiment includes a first description of an instruction not written in assembly language, and the replacement unit 150 replaces the first description in the original program (first program) with the second description based on replacement information D111 that associates the first description with a second description of an instruction written in assembly language. This allows the programming language conversion system 100 to generate a replacement program in which a description specific to the original program (e.g., a macro instruction) is replaced with a description that can be appropriately converted into a conversion program.

[0092] <3> Furthermore, when a third description of an instruction used in the conversion program is included in the original program (first program), the replacement unit 150 in the programming language conversion system 100 in this embodiment replaces the third description included in the original program (first program) with a fourth description that is different from the third description and can be converted into the conversion program. This allows the programming language conversion system 100 to generate a replacement program by replacing a description that is included in the original program and used in the conversion program, and has a different meaning from the conversion program, with a description in assembly language that can be appropriately converted into the conversion program.

[0093] <4> Furthermore, the conversion information D113 in the programming language conversion system 100 in this embodiment includes information indicating the position of the description in the conversion program of each instruction included in the replacement program, and the conversion unit 160 describes instructions in the conversion program corresponding to each instruction included in the replacement program at a predetermined position in the conversion program based on the conversion information D113. This allows the programming language conversion system 100 to convert a description at an arbitrary position in an assembly language program into a conversion program while ensuring a specific arrangement in the programming language of the conversion program.

[0094] <5> The programming language conversion system 100 in this embodiment further includes a comment section 180 that identifies a comment for each line of an instruction in the original program (first program), and a display processing section 190 that associates the comment identified by the comment section 180 with an instruction in the converted program that corresponds to an instruction to which a comment has been added in the original program (first program) and displays the associated comment on a display section. As a result, the programming language conversion system 100 visually and easily displays the description of the assembly language and the corresponding converted program, and can provide the user with a tool that allows easy confirmation of whether or not the conversion has been performed appropriately.

[0095] <6> In addition, the programming language conversion system 100 in this embodiment further includes a display processing unit 190 that associates each instruction in each line of the conversion program with an instruction in the replacement program corresponding to that instruction and displays the associated instruction on a display unit. As a result, the programming language conversion system 100 can visually and easily display the assembly language and the corresponding conversion program description, thereby providing the user with a tool that allows them to easily check whether or not the conversion has been performed appropriately.

[0096] <7> The programming language conversion system 100 in this embodiment further includes a display processing unit 190 that displays, on a display unit, an identification code that can uniquely identify each of the instructions in each line included in the replacement program in association with each of the instructions in each line, and displays, on a display unit, the identification code that is associated with each of the instructions in each line included in the replacement program in association with each of the instructions in each line included in the conversion program that corresponds to each of the instructions in each line included in the replacement program. As a result, the programming language conversion system 100 visually and easily displays the description of the assembly language and the conversion program corresponding thereto, and therefore can provide the user with a tool that allows easy confirmation of whether or not the conversion has been performed appropriately.

[0097] 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]

[0098] 100... programming language conversion system, 110... memory unit, 120... acquisition unit, 130... instruction extraction unit, 140... instruction information generation unit, 150... replacement unit, 160... conversion unit, 170... identification code assignment unit, 180... comment unit, 190... display processing unit.

Claims

1. an acquisition unit that acquires a first program at least a part of which is written in an assembly language; an instruction extraction unit that extracts, from the first program, an instruction that defines, by a predetermined name, at least one of a constant, a variable, a mathematical expression, and an instruction description area written in an assembly language; a replacement unit that replaces any of the constants, variables, formulas, and command writing areas defined by the predetermined name in the first program with information indicating any of the constants, variables, formulas, and command writing areas in an assembly language that can be converted into an instruction of a conversion program written in a programming language different from an assembly language, based on definition information generated by associating the predetermined name defined in the instruction extracted by the instruction extraction unit with any of the constants, variables, formulas, and command writing areas; a conversion unit that converts a replacement program, which is the first program replaced by the replacement unit, into the conversion program based on conversion information for converting instructions in an assembly language into instructions in a programming language of the conversion program; A programming language conversion system comprising:

2. the first program includes a first set of instructions that are not written in assembly language; the replacement unit replaces the first statement in the first program with the second statement based on replacement information that associates the first statement with a second statement of an instruction written in an assembly language; 2. The programming language conversion system of claim 1.

3. the replacement unit, when a third description of an instruction used in the conversion program is included in the first program, replaces the third description included in the first program with a fourth description that is convertible into the conversion program and different from the third description; 2. The programming language conversion system of claim 1.

4. the conversion information includes information indicating a location in the conversion program of each of the instructions included in the replacement program; the conversion unit writes instructions in the conversion program corresponding to each of the instructions included in the replacement program at a predetermined position in the conversion program based on the conversion information; 2. The programming language conversion system of claim 1.

5. a comment section that specifies a comment for each line of instructions in the first program; a display processing unit that associates a comment specified in the comment portion with an instruction in the converted program corresponding to an instruction to which a comment has been added in the first program, and displays the comment on a display unit; The programming language conversion system of claim 1 further comprising:

6. a display processing unit that displays, on a display unit, an instruction in the replacement program corresponding to each instruction in each line of the conversion program in association with the instruction, 2. The programming language conversion system of claim 1.

7. displaying, on a display unit, an identification code capable of uniquely identifying each of the instructions in each line included in the replacement program in association with each of the instructions in each line; a display processing unit that displays, on a display unit, the identification codes associated with the respective lines of instructions included in the replacement program in association with the respective lines of instructions included in the conversion program corresponding to the respective lines of instructions included in the replacement program; 2. The programming language conversion system of claim 1.

8. The computer Obtaining a first program written at least in part in assembly language; extracting from the first program an instruction that defines, by a predetermined name, at least one of a constant, a variable, an equation, and an instruction description area written in assembly language; based on definition information generated by associating the predetermined name defined in the extracted instruction with any one of a constant, a variable, a mathematical expression, and a command description area, replacing any one of the constants, variables, mathematical expressions, and command description areas defined by the predetermined name in the first program with information indicating any one of the constants, variables, mathematical expressions, and command description areas in an assembly language that can be converted into an instruction of a conversion program written in a programming language different from an assembly language; converting the converted first program into the converted program based on conversion information for converting assembly language instructions into instructions in a programming language of the converted program; A programming language transformation method for performing

9. On the computer, Obtaining a first program written at least in part in assembly language; extracting from the first program an instruction that defines, by a predetermined name, at least one of a constant, a variable, an equation, and an instruction description area written in assembly language; based on definition information generated by associating the predetermined name defined in the extracted instruction with any one of a constant, a variable, a mathematical expression, and a command description area, replacing any one of the constants, variables, mathematical expressions, and command description areas defined by the predetermined name in the first program with information indicating any one of the constants, variables, mathematical expressions, and command description areas in an assembly language that can be converted into an instruction of a conversion program written in a programming language different from an assembly language; converting the converted first program into the converted program based on conversion information for converting assembly language instructions into instructions in a programming language of the converted program; 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