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

The programming language conversion system effectively translates assembly language into other languages by extracting and replacing undefined instructions, allowing for accurate conversion of assembly language programs.

JP2025132282AActive Publication Date: 2025-09-10유겐가이샤티아이에스
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing systems struggle to convert assembly language programs into other programming languages when certain instructions, such as those defining constants, variables, mathematical expressions, and instruction description areas, cannot be properly translated.

Method used

A programming language conversion system that extracts and replaces these instructions with definitions that can be converted into another programming language, using definition and conversion information to generate a replacement program that can be accurately translated.

Benefits of technology

Enables appropriate conversion of assembly language into other programming languages by addressing the issues of instruction placement and meaning, ensuring a seamless translation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025132282000001_ABST
    Figure 2025132282000001_ABST
Patent Text Reader

Abstract

To provide a programming language conversion system, a method, and a program for appropriately converting an assembly language to another programming language.SOLUTION: A system comprises: an acquisition section for acquiring a first program that is at least partially described by an assembly language; an instruction extraction section for extracting an instruction for defining a constant, a variable, a numerical expression, and an instruction description area described by an assembly language by a predetermined name from the first program; a substitution section for substituting information showing a constant, a variable, a numerical expression, and an instruction description area in an assembly language convertible to an instruction of a conversion program described in a programming language different from the assembly language for a constant, a variable, a numerical expression, and an instruction description area defined by a predetermined name in the first program; and a conversion section for converting a substitution program that is the first converted program to a conversion program on the basis of conversion information for converting an instruction of an assembly language to an instruction of a programming language.SELECTED DRAWING: Figure 1
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 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 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 instructions that define, with predetermined names, at least one of constants, variables, mathematical expressions, and instruction description areas written in assembly language; a replacement unit that replaces, based on definition information generated by associating the predetermined names defined in the instructions extracted by the instruction extraction unit with any of the constants, variables, mathematical expressions, and instruction description areas in the first program, the constants, variables, mathematical expressions, and instruction description areas defined with the predetermined names, with information indicating any of the constants, variables, mathematical expressions, and instruction description areas in assembly language that can be converted into instructions for a conversion program written in a programming language other than assembly language; 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, with predetermined names, at least one of constants, variables, mathematical expressions, and instruction description areas written in assembly language; replaces, based on definition information generated by associating the predetermined names defined in the extracted instructions with any of the constants, variables, mathematical expressions, and instruction description areas in the first program, any of the constants, variables, mathematical expressions, and instruction description areas defined with the predetermined names, with information indicating any of the constants, variables, mathematical expressions, and instruction description areas in assembly language that can be converted into instructions for a conversion program written in a programming language other than assembly language; and converts, 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.

[0009] A program according to one embodiment of the present invention causes a computer to acquire a first program at least a portion of which is written in assembly language; extract from the first program instructions that define, with predetermined names, at least one of constants, variables, mathematical expressions, and instruction description areas written in assembly language; based on definition information generated by associating the predetermined names defined in the extracted instructions with any of the constants, variables, mathematical expressions, and instruction description areas, replace any of the constants, variables, mathematical expressions, and instruction description areas defined with the predetermined names in the first program with information indicating any of the constants, variables, mathematical expressions, and instruction 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 converting 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. [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 configuration of replacement information D111. [Figure 3] FIG. 10 is a diagram showing an example of the configuration of definition information D112. [Figure 4] FIG. 11 is a diagram showing an example of the configuration of conversion information D113. [Figure 5] FIG. 10 is a flowchart illustrating an example of a processing procedure of a programming language conversion system. [Figure 6]FIG. 10 is a diagram illustrating an example of a process for creating a register area for a conversion program. [Figure 7] FIG. 10 illustrates an example of a process for connecting consecutive lines. [Figure 8] FIG. 10 is a diagram illustrating an example of a decomposition process of a DC instruction that defines a constant. [Figure 9] FIG. 10 is a diagram illustrating an example of a process of replacing a first description with a second description. [Figure 10] FIG. 10 is a diagram illustrating an example of a process of replacing a third description with a fourth description. [Figure 11] FIG. 10 is a diagram illustrating an example of a process for converting a constant definition of an EQU instruction. [Figure 12] FIG. 10 is a diagram illustrating an example of a process for converting an area defined by a DSECT command. [Figure 13] 10 is a diagram showing an example of a process of converting a DC instruction and a DS instruction out of information indicating a DC instruction, a DS instruction, an ORG instruction, and a DCB macro instruction. FIG. [Figure 14] FIG. 10 is a diagram illustrating an example of a process for converting length notation and operation notation. [Figure 15] FIG. 10 is a diagram illustrating an example of a process for replacing an area name in an instruction operand portion. [Figure 16] FIG. 10 is a diagram illustrating an example of a process for generating an address constant in an area definition of a DS (POINTER). [Figure 17] FIG. 10 is a diagram illustrating an example of a process for replacing an address notation specified by a base and a displacement. [Figure 18] FIG. 10 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 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. Before 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 into which part of the original program has been converted (hereinafter referred to as the "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 (described later), which is a database for generating a replacement program, based on the description of the original program. The definition information D112 includes, for example, information that may cause problems when converting the original program into a converted program. Potentially problematic information includes, for example, constants, variables, mathematical expressions, and instructions that define instruction description areas. In assembly, this information has no fixed location in the program where it is written, so it can cause problems when converting the original program into a converted program.

[0016] Therefore, the programming language conversion system 100 refers to the definition information D112 to generate 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.The programming language conversion system 100 then 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] In other words, the programming language conversion system 100 does not convert an original program into a converted program by referring only to a database that associates descriptions of the original program with descriptions of the converted program one-to-one. As described above, the programming language conversion system 100 has a feature not found in conventional technologies in that it extracts predetermined descriptions from the original program to generate definition information D112, and uses a replacement program that replaces some descriptions of the original program with reference to the definition information D112 to enable appropriate and problem-free conversion of 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 substituting a partial description 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, 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).

[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 the original program, the conversion program, and the 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 such as [Defined Name] and [Instruction]. [Defined Name] stores a name that defines an instruction word in assembly language. That is, the defined name (first description) is a description of an instruction not written in assembly language, which 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 an original program. The programming language conversion system 100 generates a replacement program by replacing 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 an assembly language program cannot be appropriately converted by converting the program from the top line onwards, because various instructions can be arranged arbitrarily. Note that the definition information D112 may store the description of each assembly language instruction 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 the DS instruction and DC instruction, a database D112b relating to the ORG instruction, a database D112c relating to the EQU instruction, a database D112d relating to the DCB macro instruction, and a database D112e relating to the DSECT instruction in assembly language.

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

[0028] The database D112b related to ORG instructions is a database that stores ORG instructions (e.g., instructions that change the location counter) included in the original program. The database D112b related to ORG instructions is shown as an example in which the program P2 is stored in a table format. For example, the database D112b related to ORG instructions may include the following 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 related to DCB macro instructions is a database that stores DCB macro instructions included in the original program. The database D112d related to DCB macro instructions (e.g., instructions used to complete information in a data control block during job execution) is shown as storing the program P4 in table format, as an example. For example, the database D112d related to DCB macro instructions may include the following items: [Label Name], [Macro Instruction], [DDNAME], [DSORG], [MACRF], [EODAD], and [SYNAD].

[0031] The database D112e related to the DSECT instruction is a database that stores the DSECT instruction included in the original program. The database D112e related to the DSECT instruction (e.g., an instruction indicating an instruction description area that includes 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 related to the DSECT instruction may include the following 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, for example, items such as [Assembly Language], [Conversion Language], and [Conversion Location]. [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 Location] stores the location of the description in the converted program.

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

[0035] The instruction extraction unit 130 extracts from the original program instructions defined by predetermined names that can be identified by label names, assembler instructions, etc., included in the original program. For example, the instruction extraction unit 130 extracts "C'1'" that has the label name "ON" and is defined by the 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 generation unit 140 generates definition information D112 based on the information extracted by the instruction extraction 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, thereby generating a replacement program that can be appropriately converted into a converted program.

[0037] The replacement unit 150 replaces a predetermined name in the original program with any 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 by "EQU" shown in FIG. 3 with "C'1'" (e.g., a constant). Furthermore, for example, the replacement unit 150 replaces a length notation (e.g., "L'") and an operation notation with a notation convertible to a conversion program (e.g., a constant, a variable, or a numerical value). Furthermore, for example, the replacement unit 150 replaces an area name in an instruction operand section (e.g., the label name "OLAKBN" of the DSECT shown in FIG. 3) with a notation convertible to a conversion program (e.g., "R7L_OLAKBN" including register information). This allows the programming language conversion system 100 to generate a replacement program in which a description in the original program that cannot be properly converted to a conversion program is replaced with a properly convertible description, thereby enabling proper conversion to a conversion program.

[0038] Furthermore, the replacement unit 150 refers to the replacement information D111 and 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. Specifically, the replacement unit 150 refers to a conversion table (not shown) and 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. 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, if the original program contains a description of an instruction used in the conversion program, the replacement unit 150 replaces the description 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 in the conversion information D113) to identify a description used in the conversion program in the original program. The replacement unit 150 refers to the conversion table (not shown) to replace the identified description with an assembly language description that is not used in the conversion program and can be converted into the conversion program. In this way, the programming language conversion system 100 can generate a replacement program by replacing a description that is included in the original program and used in the conversion program but has a different meaning from the conversion program with an assembly language description that can be appropriately converted into the conversion program.

[0040] The conversion unit 160 converts the replacement program into a conversion program by referring 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, if the programming language of the conversion program is COBOL, the conversion unit 160 places the descriptions of variable definitions (e.g., DS, DC, etc.) in the replacement program in an upper area (an area with a small line number) in the conversion program. This allows the programming language conversion system 100 to convert descriptions at any position in an assembly language program into a conversion program while ensuring a unique arrangement in the programming language of the conversion program.

[0042] The identification code assigning unit 170 assigns an identification code to each line of the original program, the replacement program, and the converted program. The identification code may be any code that can identify each line, and may be, for example, consecutive numbers (line numbers). The programming language conversion system 100 assigns an identification code to each line of the original program, and assigns the same identification code to each line of the replacement program and the 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 replacement program and the converted program.

[0043] The 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 understand the correspondence between the original program, the replacement program, and the conversion program, thereby improving user convenience.

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

[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 predetermined instruction in the conversion program, one line above that instruction. This allows the programming language conversion system 100 to display the replacement program (or 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 on each line included in the replacement program (and the original program) in association with each of the instructions on each line.The display processing unit 190 then displays on the display unit 1007 the identification code that is associated with each of the instructions on each line included in the replacement program in association with each of the instructions on each line included in the conversion program that corresponds to each of the instructions on each line included in the replacement program.This allows the programming language conversion system 100 to easily recognize the correspondence between the original program, replacement program, and 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 chart 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 for creating a register area for a converted program. FIG. 7 is a diagram showing an example of a process for concatenating continuation lines. FIG. 8 is a diagram showing an example of a process for decomposing a DC instruction that defines a constant. FIG. 9 is a diagram showing an example of a process for replacing a first description with a second description. FIG. 10 is a diagram showing an example of a process for replacing a third description with a fourth description. FIG. 11 is a diagram showing an example of a process for converting a constant definition of an EQU instruction. FIG. 12 is a diagram showing an example of a process for converting an area specified by a DSECT instruction. FIG. 13 is a diagram showing an example of a process for 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 for converting a length notation and an operation notation. FIG. 15 is a diagram showing an example of a process for replacing an area name in an instruction operand portion. Fig. 16 is a diagram showing an example of a process for generating an address constant in an area definition of a 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 in order 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 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 visual display of the correspondence between the original program and the replacement and converted programs.

[0051] In step S101, the programming language conversion system 100 copies the 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 performs initialization processing on the replacement program. The initialization processing includes, for example, creating a register area for the conversion program, linking continuation lines, and decomposing DC definitions.

[0053] 6, when the conversion program is, for example, COBOL, registers cannot be used in COBOL, so the process of creating a register area for the conversion program creates a virtual register area in the replacement program, allowing the register area definition to be reflected in the COBOL conversion program. This enables the programming language conversion system 100 to properly convert assembly language into a conversion program.

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

[0055] 8, when DC instructions that define constants are defined horizontally in assembly language, if the conversion program is, for example, COBOL, horizontal DC instructions cannot be converted into the conversion program, so they are defined vertically in multiple lines in the replacement program. This enables the programming language conversion system 100 to properly convert assembly language into the conversion program.

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

[0057] Specifically, as shown in Fig. 9, 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 converted 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, the programming language conversion system 100 can appropriately convert into a converted program as shown in Fig. 10.

[0060] In step S105, the programming language conversion system 100 obtains the 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 (line "101420" in FIG. 11) of the replacement program with a constant.

[0061] Specifically, as shown in Figure 11, the programming language conversion system 100 obtains the constant definitions of the EQU instructions on lines "100420" and "100430" of the replacement program (ON is defined as "C'1'" and OFF is defined as "C'0'") 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" that appear in the replacement program with constants. As a result, as shown in Figure 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 acquires 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 the area (lines "102150" to "102240" in FIG. 12) defined by the DSECT command from the replacement program.

[0064] In step S107, the programming language conversion system 100 acquires 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 acquires the DC instruction after acquiring 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 the DS command (the DC command vertically decomposed in step S102) and the area specified 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 refers to the definition information D112, for example, to identify "TYP+L'TBLLOG-5(L'PTNLOG)" in the original program, and if 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 properly 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 Figure 15, the programming language conversion system 100 replaces, for example, "OLAKBN" in the original program with "R7L_OLAKBN" in the replacement program (OLAKBN means that register 7 is used as the base register). 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. As a result, the replacement program in assembly language can be properly converted into a conversion program, as shown in the conversion program in Figure 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 line "A(WOLA)" of DC in the original program with a line of pseudo-assembler instructions of DS (definition to be converted as a POINTER item) in the replacement program. In this way, for example, if the conversion program is in COBOL, by replacing it with a data type indicating an address called POINTER, the replacement program in assembly language can be properly 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 operands in the original program, for example, with addresses expressed using a base and a displacement in each mnemonic.

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

[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, the "Assembly Language Area" in FIG. 18) with the corresponding line of the converted program and display the comment (line "100460*" in the center of the converted program in 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*@@@" in the converted program on the right side of FIG. 18). In this way, the programming language conversion system 100 visually and easily displays the assembly language and the corresponding converted program description, thereby providing the user with a tool that allows them to easily check whether the conversion was appropriate.

[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 also generates a replacement program in which each instruction in 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 that has the characteristic that instructions indicating constants, variables, mathematical expressions, 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 (for example, "PCON" and "CCON" in Figure 2), instructions that cannot be converted into other programming languages ​​(for example, instructions written on multiple lines, instructions written on one line, the length notation "L'" in Figure 2, and operation notations), and statements used in other programming languages ​​(for example, 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, 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.

[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), flash memory, etc. The storage device 1003 stores an operating system and various programs for realizing 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, 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).

[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 this 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 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.

[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, 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.

[0090] ===Summary=== <1> The programming language conversion system 100 of 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 description areas written in assembly language with predetermined names (such as label names and mnemonics), and a program 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 description areas written in assembly language from the original program (first program) based on definition information D112 that is generated by associating the predetermined names (such as label names and mnemonics) defined in the instructions extracted by the instruction extraction unit 130 with any of constants, variables, mathematical expressions, and instruction description areas. The programming language conversion system 100 includes a replacement unit 150 that replaces any of the constants, variables, mathematical expressions, and instruction description areas defined by the predetermined names (e.g., label names, mnemonics, etc.) with information indicating any of the constants, variables, mathematical expressions, and instruction description areas in assembly language (e.g., descriptions indicating the "value" or "mathematical expression" of an EQU instruction, the constants, variables, or length notation of a DS / DC instruction, or the instruction description area of ​​a DSECT instruction), which can be converted into instructions of a conversion program written in a programming language other than assembly language, 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 assembly language instructions into instructions in a programming language (e.g., COBOL, etc.). In this way, the programming language conversion system 100 extracts predetermined descriptions from the original program to generate definition information D112, and uses the replacement program in which some descriptions of the original program are replaced by referring to the definition information D112, thereby enabling the original program to be converted into a conversion program appropriately and without problems.

[0091] <2> Furthermore, the original program (first program) in the programming language conversion system 100 of this embodiment includes a first description of an instruction that is 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 that is 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 of 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 but has a different meaning from the conversion program with an assembly language description that can be appropriately converted into the conversion program.

[0093] <4> Furthermore, the conversion information D113 in the programming language conversion system 100 of this embodiment includes information indicating the description position 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 predetermined positions in the conversion program based on the conversion information D113. This allows the programming language conversion system 100 to convert a description at any position in an assembly language program into a conversion program while ensuring a unique arrangement in the programming language of the conversion program.

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

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

[0096] <7> Furthermore, 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 assembly language and the corresponding conversion program description, and can provide the user with a tool that allows them to easily check whether the conversion has been performed appropriately.

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

[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 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 assembly language; a replacement unit that replaces any of the constants, variables, mathematical expressions, and command writing areas defined by the predetermined names in the first program with information indicating any of the constants, variables, mathematical expressions, and command writing 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 names defined in the instructions extracted by the instruction extraction unit with any of the constants, variables, mathematical expressions, and command writing areas; a conversion unit that converts the replaced program, which is the first program replaced by the replacement unit, into the converted program based on conversion information for converting instructions in an assembly language into instructions in a programming language of the converted program; A programming language conversion system comprising:

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

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

4. the conversion information includes information indicating the location of a description of each instruction included in the replacement program in the conversion program; the conversion unit writes 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; The programming language conversion system of claim 1 .

5. a comment section specifying a comment for each line of instruction in the first program; a display processing unit that associates the comment specified in the comment portion with an instruction in the converted program corresponding to the instruction to which the comment is 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, instructions in the replacement program corresponding to each instruction in each line of the conversion program in association with the instruction, The programming language conversion system of claim 1 .

7. displaying, 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; 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, 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, a mathematical expression, 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 of a constant, a variable, a mathematical expression, and a command description area, replacing any of the constants, variables, mathematical expressions, and command description areas defined by the predetermined name in the first program with information indicating any of the constants, variables, mathematical expressions, and command description areas in assembly language that can be converted into instructions of a conversion program written in a programming language different from assembly language; converting the replaced first program into the converted program based on conversion information for converting assembly language instructions into instructions in the 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, a mathematical expression, 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 of a constant, a variable, a mathematical expression, and a command description area, replacing any of the constants, variables, mathematical expressions, and command description areas defined by the predetermined name in the first program with information indicating any of the constants, variables, mathematical expressions, and command description areas in assembly language that can be converted into instructions of a conversion program written in a programming language different from assembly language; converting the replaced first program into the converted program based on conversion information for converting assembly language instructions into instructions in the programming language of the converted program; A program to execute.

Citation Information

Patent Citations

  • Document generation device, generation method for document, and program

    JP2017062746A