JP2017062746A - Document generation device, generation method for document, and program - Google Patents

Document generation device, generation method for document, and program Download PDF

Info

Publication number
JP2017062746A
JP2017062746A JP2015188841A JP2015188841A JP2017062746A JP 2017062746 A JP2017062746 A JP 2017062746A JP 2015188841 A JP2015188841 A JP 2015188841A JP 2015188841 A JP2015188841 A JP 2015188841A JP 2017062746 A JP2017062746 A JP 2017062746A
Authority
JP
Japan
Prior art keywords
source
program
information
comment
original source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2015188841A
Other languages
Japanese (ja)
Inventor
菜岐佐 石浦
Nagisa Ishiura
菜岐佐 石浦
隆史 小河原
Takashi Ogawara
隆史 小河原
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SYSTEMS CO Ltd
Kwansei Gakuin Educational Foundation
Original Assignee
SYSTEMS CO Ltd
Kwansei Gakuin Educational Foundation
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SYSTEMS CO Ltd, Kwansei Gakuin Educational Foundation filed Critical SYSTEMS CO Ltd
Priority to JP2015188841A priority Critical patent/JP2017062746A/en
Publication of JP2017062746A publication Critical patent/JP2017062746A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To generate a target language program with high readability under the consideration of maintainability by outputting an other language program obtained by converting an assembler program and comments in association.SOLUTION: A document generation device 1 includes: a comment source information storage part 114 for storing comment source information in association with one or more conversion information as information for converting an assembler program into an other language program; a conversion part 122 for converting one or more respective original source components as a partial program constituting an original source of assembler language into an other language program by using the conversion information associated with the respective original source components, and for acquiring target source components as the other language program for each of one or more respective conversion targets; a comment acquisition part 123 for acquiring comments by using comment source information associated with the conversion information; and an output part 13 for outputting one or more respective source components in association with the comments associated with the respective target source components.SELECTED DRAWING: Figure 1

Description

本発明は、アセンブラのプログラムから他言語のプログラムへのマイグレーションに関する有用なドキュメントを生成するドキュメント生成装置等に関するものである。   The present invention relates to a document generation apparatus that generates a useful document related to migration from an assembler program to another language program.

従来技術において、レガシーシステムのログを元に稼動JCLおよびファイルを抽出して、その抽出された稼動JCLおよびファイルを使用しているCOBOLファイル定義から整理されたデータモデルを作成し、その作成されたデータモデルとMDAツールを繋いだので、新しいオープン系システムを再構築することが可能であるレガシーシステム再構築システムがあった(例えば、特許文献1参照)。   In the prior art, the operating JCL and file are extracted based on the log of the legacy system, and a data model organized from the COBOL file definition that uses the extracted operating JCL and file is created. Since the data model and the MDA tool are connected, there is a legacy system reconstruction system that can reconstruct a new open system (see, for example, Patent Document 1).

特開2007−334号公報(第1頁、第1図等)JP 2007-334 (first page, FIG. 1 etc.)

しかしながら、従来技術においては、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、他言語のプログラムとコメントとを対応付けて出力できなかった。また、従来技術においては、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、アセンブラのプログラムと他言語のプログラムとコメントとを対応付けて出力できなかった。なお、他言語のプログラムとは、アセンブラ以外の言語のプログラムであり、例えば、C言語等の高級言語のプログラムである。   However, in the prior art, when performing migration for converting an assembler program into a program in another language, the program in another language and a comment cannot be output in association with each other. In the prior art, when migration is performed to convert an assembler program into another language program, the assembler program, the other language program, and the comment cannot be output in association with each other. The other language program is a program in a language other than the assembler, for example, a high-level language program such as C language.

本第一の発明のドキュメント生成装置は、アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、アセンブラのプログラムを他言語のプログラムに変換するための情報である1以上の変換情報を格納し得る変換情報格納部と、1以上の変換情報のいずれかの変換情報に対応付けて、コメントの元になるコメント元情報を格納し得るコメント元情報格納部と、原ソース格納部に格納されている原ソースを構成する一部のプログラムである1以上の各原ソース部品を、各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する変換部と、変換部が用いた変換情報に対応するコメント元情報を用いてコメントを取得するコメント取得部と、変換部が取得した1以上の各目的ソース部品と、各目的ソース部品が取得される際に利用された変換情報に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力する出力部とを具備するドキュメント生成装置である。   The document generation apparatus according to the first aspect of the present invention is an assembler program written in an assembler language, and converts an original source storage unit that can store an original source, which is a migration target program, into a program in another language. A conversion information storage unit that can store one or more pieces of conversion information that is information to be used, and a comment that can store comment source information that is a source of a comment in association with any one piece of conversion information of the one or more pieces of conversion information The source information storage unit and one or more source source parts that are part of the source source stored in the source source storage unit are converted into other languages using conversion information corresponding to each source source part. A conversion unit that obtains a target source component that is a program in another language for each one or more conversion targets, and a conversion used by the conversion unit. Corresponds to the comment acquisition unit that acquires comments using the comment source information corresponding to the information, one or more target source components acquired by the conversion unit, and the conversion information used when each target source component is acquired The document generation device includes an output unit that outputs a comment obtained by using the comment source information in association with each other.

かかる構成により、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、他言語のプログラムと適切なコメントとを対応付けて出力できる。   With this configuration, when performing migration for converting an assembler program into a program in another language, the program in another language and an appropriate comment can be output in association with each other.

また、本第二の発明のドキュメント生成装置は、第一の発明に対して、出力部は、1以上の各目的ソース部品と、各目的ソース部品に対応するコメントと、各目的ソース部品の元になった原ソースを構成する原ソース部品とを対応付けて出力するドキュメント生成装置である。   Further, in the document generating apparatus according to the second aspect of the present invention, in contrast to the first aspect, the output unit includes one or more target source parts, a comment corresponding to each target source part, and a source of each target source part. This is a document generation device that outputs the original source components constituting the original source in association with each other.

かかる構成により、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、アセンブラプログラムと他言語のプログラムとコメントとを対応付けて出力できる。   With this configuration, when performing migration for converting an assembler program into a program in another language, the assembler program, the program in another language, and a comment can be output in association with each other.

また、本第三の発明のドキュメント生成装置は、第一または第二の発明に対して、原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部をさらに具備し、変換部は、原ソース格納部に格納されている原ソースに対して、1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する原ソース部品に対して、合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得する可読性向上処理手段を具備し、コメント元情報格納部は、変換情報に対応付いているコメント元情報に代えて、または変換情報に対応付いているコメント元情報に加えて、1以上の箇所特定条件のいずれかの箇所特定条件に対応付いたコメント元情報を格納し得、コメント取得部は、可読性向上処理手段が用いた箇所特定条件に対応するコメント元情報を用いてコメントを取得し、出力部は、変換部が取得した1以上の各目的ソース部品と、各目的ソース部品が取得される際に利用された変換情報または箇所特定条件に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力するドキュメント生成装置である。   The document generation device of the third aspect of the invention is a condition for specifying a portion for performing processing for improving the readability of the program for the original source with respect to the first or second aspect of the invention. And further comprising a location specifying condition storage unit capable of storing one or more location specifying conditions, and the conversion unit applies each of the one or more location specifying conditions to the original source stored in the original source storage unit, The target source corresponding to the original source part by performing the readability improvement process, which is a process corresponding to the matching part specifying condition and improving the readability of the program, for the original source part corresponding to the matching part specifying condition The comment source information storage unit includes a readability improvement processing unit for acquiring a component, and the comment source information storage unit replaces the comment source information corresponding to the conversion information or the comment source corresponding to the conversion information. In addition to the information, the comment source information associated with any one of the one or more location specifying conditions can be stored, and the comment acquisition unit can provide the comment source corresponding to the location specifying condition used by the readability improvement processing means A comment is acquired using information, and the output unit outputs one or more target source parts acquired by the conversion unit and comments corresponding to the conversion information or location specifying conditions used when each target source part is acquired. This is a document generation device that outputs a comment obtained using original information in association with the comment.

かかる構成により、保守性を考慮した、可読性の高い目的言語のプログラムを生成できる。   With this configuration, it is possible to generate a target language program with high readability in consideration of maintainability.

また、本第四の発明のドキュメント生成装置は、第三の発明に対して、箇所特定条件は、プログラムのパターンに関する情報であるソースパターン情報であり、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する原ソース部品に対して、合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得するドキュメント生成装置である。   Further, in the document generation device according to the fourth aspect of the present invention, in contrast to the third aspect of the invention, the location specifying condition is source pattern information that is information related to a program pattern, and the readability improvement processing means is stored in the original source storage unit One or more pieces of source pattern information are applied to stored source sources, and processing corresponding to matching source pattern information is performed on source source parts corresponding to matching source pattern information. This is a document generation device that performs readability improvement processing, which is processing for improving readability, and acquires a target source component corresponding to an original source component.

かかる構成により、予め決められたパターンに合致するアセンブラのプログラムを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   With this configuration, an assembler program matching a predetermined pattern can be converted into a target language program with high readability in consideration of maintainability.

また、本第五の発明のドキュメント生成装置は、第四の発明に対して、ソースパターン情報は、ダミーセクションを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、ダミーセクションを含む原ソース部品を決定し、原ソース部品を用いて、構造体を定義する目的ソース部品を取得するドキュメント生成装置である。   Further, in the document generating apparatus according to the fifth aspect of the invention, in contrast to the fourth aspect of the invention, the source pattern information includes information indicating a dummy section, and the readability improving processing means is stored in the original source storage unit. A document generation apparatus that applies one or more pieces of source pattern information to a source, determines an original source part including a dummy section, and obtains a target source part that defines a structure using the original source part. .

かかる構成により、アセンブラのプログラムの中のダミーセクションのプログラムを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   With this configuration, the dummy section program in the assembler program can be converted into a target language program with high readability in consideration of maintainability.

また、本第六の発明のドキュメント生成装置は、第四の発明に対して、ソースパターン情報は、オフセットを持つ戻りであることを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む原ソース部品を決定し、原ソース部品を用いて、原ソース部品に含まれるオフセットを条件に用いた分岐を示す目的ソース部品を取得するドキュメント生成装置である。   The document generation apparatus according to the sixth aspect of the present invention is the same as the fourth aspect of the invention in that the source pattern information includes information indicating that the return has an offset, and the readability improvement processing means is Apply one or more pieces of source pattern information to the stored source source, determine the source source part including the return with offset, and use the source source part as a condition for the offset included in the source source part This is a document generation apparatus that acquires a target source component indicating a branch used in the above.

かかる構成により、アセンブラのプログラムの中のオフセットを持つ戻り処理のプログラムを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   With this configuration, it is possible to convert a return processing program having an offset in the assembler program into a target language program having high readability in consideration of maintainability.

また、本第七の発明のドキュメント生成装置は、第四の発明に対して、ソースパターン情報は、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令を有する原ソース部品を特定するためのパターンの情報であり、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上の命令を有する原ソース部品を決定し、原ソース部品を用いて、一命令の他言語のプログラムである目的ソース部品を取得するドキュメント生成装置である。   Further, the document generation apparatus according to the seventh aspect of the invention, in contrast to the fourth aspect, specifies an original source part having two or more instructions of an assembler that can convert source pattern information into a program of another language of one instruction. Readability improving processing means applies one or more pieces of source pattern information to the original source stored in the original source storage unit and has two or more instructions. The document generation apparatus obtains a target source component which is a program of another language of one instruction using the original source component.

かかる構成により、予め決められたパターンに合致する、アセンブラのプログラムの中の2以上の命令からなるプログラムを、保守性を考慮した、可読性の高い目的言語の一命令のプログラムに変換できる。   With such a configuration, a program composed of two or more instructions in an assembler program that matches a predetermined pattern can be converted into a program of one instruction in a target language with high readability in consideration of maintainability.

また、本第八の発明のドキュメント生成装置は、第四の発明に対して、ソースパターン情報は、退避コードまたは復帰コードを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの原ソース部品を決定し、原ソース部品に対応するプログラムを、原ソースから削除するドキュメント生成装置である。   Further, in the document generating apparatus of the eighth invention, in contrast to the fourth invention, the source pattern information includes information indicating a save code or a return code, and the readability improving processing means is stored in the original source storage unit. A document generation apparatus that applies one or more pieces of source pattern information to an original source, determines an original source part of a save code or a return code, and deletes a program corresponding to the original source part from the original source is there.

かかる構成により、アセンブラのプログラムの中の退避コードまたは復帰コードを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   With this configuration, the saved code or the return code in the assembler program can be converted into a target language program with high maintainability in consideration of maintainability.

また、本第九の発明のドキュメント生成装置は、第四の発明に対して、ソースパターン情報は、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更するドキュメント生成装置である。   In the document generation device according to the ninth aspect of the invention, in contrast to the fourth aspect of the invention, the source pattern information is information indicating that a part of two or more loops formed by two or more jump instructions overlap. The readability improving processing means applies one or more pieces of source pattern information to the original source stored in the original source storage unit, determines a portion where two or more loops overlap, This is a document generation device that changes a program corresponding to a location to a program that indicates a loop that does not have a jump instruction by giving priority to one loop that satisfies a predetermined condition.

かかる構成により、アセンブラのプログラムの中の2以上のループの一部が重なっている箇所を、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   With such a configuration, a portion where two or more loops overlap in the assembler program can be converted into a target language program with high readability in consideration of maintainability.

また、本第十の発明のドキュメント生成装置は、第三の発明に対して、箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件であり、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うドキュメント生成装置である。   Further, in the document generation apparatus of the tenth invention, in contrast to the third invention, the location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source. The readability improvement processing means applies one or more range conditions to the original source stored in the original source storage unit, and matches the range condition for the location corresponding to the matching range condition. Is a document generation apparatus that performs readability improvement processing that is processing for improving readability of a program.

かかる構成により、アセンブラのプログラムの中の予め決められた条件を満たす箇所の範囲を特定し、保守性を考慮して、当該範囲に対応する可読性の高い目的言語のプログラムに変換できる。   With this configuration, it is possible to identify a range of locations that satisfy a predetermined condition in the assembler program, and to convert the program into a target language program having high readability corresponding to the range in consideration of maintainability.

また、本第十一の発明のドキュメント生成装置は、第十の発明に対して、範囲条件は、実行され得ないプログラムの範囲を判定するための条件であり、可読性向上処理手段は、原ソースを静的解析し、合致する範囲条件に対応する箇所のプログラムを特定し、プログラムを削除するドキュメント生成装置である。   In the document generation device of the eleventh aspect of the invention, the range condition is a condition for determining the range of programs that cannot be executed, and the readability improvement processing means is the original source. Is a document generation device that statically analyzes the program, identifies the program corresponding to the matching range condition, and deletes the program.

かかる構成により、静的解析し、到達できない箇所のアセンブラプログラムを削除することにより、可読性の高い目的言語のプログラムを得ることができる。   With this configuration, it is possible to obtain a highly readable target language program by performing static analysis and deleting an assembler program at a location that cannot be reached.

また、本第十二の発明のドキュメント生成装置は、第十の発明に対して、範囲条件は、変数を特定するための条件であり、可読性向上処理手段は、原ソースまたは目的ソースから変数を取得し、変数の生存区間を取得し、変数を、生存区間におけるローカル変数として定義する可読性向上処理を行うドキュメント生成装置である。   Further, in the document generation device of the twelfth aspect of the invention, the range condition is a condition for specifying a variable with respect to the tenth aspect of the invention, and the readability improvement processing means reads the variable from the original source or the target source. This is a document generation apparatus that performs readability improvement processing that acquires a life span of a variable and defines the variable as a local variable in the life span.

かかる構成により、アセンブラプログラム内の変数の生存区間を特定し、当該変数を当該生存区間におけるローカル変数とすることにより、可読性の高い目的言語のプログラムを得ることができる。   With this configuration, it is possible to obtain a program in a target language with high readability by specifying the life span of a variable in the assembler program and using the variable as a local variable in the life span.

また、本第十三の発明のドキュメント生成装置は、第一から第十二いずれか1つの発明に対して、原ソースは、アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであり、原ソースから、アセンブラプログラムを取得するアセンブラプログラム取得部をさらに具備し、変換部は、アセンブラプログラム取得部が取得したアセンブラプログラムを目的ソースに変換するドキュメント生成装置である。   Further, in the document generation device of the thirteenth invention, in contrast to any one of the first to twelfth inventions, the original source has an assembler program and another language program which is a program in a language other than the assembler. It is a program, and further includes an assembler program acquisition unit that acquires an assembler program from an original source, and the conversion unit is a document generation device that converts the assembler program acquired by the assembler program acquisition unit into a target source.

かかる構成により、アセンブラ以外の言語のプログラムである他言語プログラムと連結して動作するアセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い目的言語のプログラムを生成できる。   With this configuration, when migrating an assembler program that operates in conjunction with another language program that is a program in a language other than the assembler, it is possible to generate a target language program with high readability in consideration of maintainability.

本発明によるドキュメント生成装置によれば、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、他言語のプログラムとコメントとを対応付けて出力できる。   According to the document generation device of the present invention, when performing migration for converting an assembler program into a program of another language, the program of another language and a comment can be output in association with each other.

実施の形態1におけるドキュメント生成装置1のブロック図Block diagram of document generation apparatus 1 in the first embodiment 同ドキュメント生成装置1の動作について説明するフローチャートA flowchart for explaining the operation of the document generation apparatus 1 同静的解析処理について説明するフローチャートFlow chart explaining the static analysis process 同出力情報構成処理について説明するフローチャートFlowchart explaining the output information configuration process 同原ソースを示す図Diagram showing the same source 同箇所特定条件管理表を示す図Figure showing the same location specific condition management table 同生成されたC言語のプログラムを示す図The figure which shows the program of the same C language which is generated 同アセンブラプログラムを示す図Diagram showing the assembler program 同変換情報管理表を示す図Figure showing the conversion information management table 同生成されたC言語のプログラムを示す図The figure which shows the program of the same C language which is generated 同箇所特定条件管理表を示す図Figure showing the same location specific condition management table 同アセンブラプログラムを示す図Diagram showing the assembler program 同生成されたC言語のプログラムを示す図The figure which shows the program of the same C language which is generated 同中間表現を含む変換例を示す図Diagram showing conversion example including the intermediate representation 同中間表現を含む変換例を示す図Diagram showing conversion example including the intermediate representation 同ループの処理を示す図Diagram showing the processing of the same loop 同変換対象のアセンブラプログラムの例を示す図Diagram showing an example of the assembler program to be converted 同C言語のプログラムの例を示す図The figure which shows the example of the program of the same C language 同ループの処理を示す図Diagram showing the processing of the same loop 同変換対象のアセンブラプログラムの例を示す図Diagram showing an example of the assembler program to be converted 同C言語のプログラムの例を示す図The figure which shows the example of the program of the same C language 同C言語のプログラムの例を示す図The figure which shows the example of the program of the same C language 同コメント元情報格管理表を示す図Figure showing the same comment source information case management table 同出力情報の出力例を示す図The figure which shows the output example of the same output information 同出力情報の出力例を示す図The figure which shows the output example of the same output information 同コンピュータシステムの概観図Overview of the computer system 同コンピュータシステムのブロック図Block diagram of the computer system

以下、ドキュメント生成装置等の実施形態について図面を参照して説明する。なお、実施の形態において同じ符号を付した構成要素は同様の動作を行うので、再度の説明を省略する場合がある。   Hereinafter, embodiments of a document generation device and the like will be described with reference to the drawings. In addition, since the component which attached | subjected the same code | symbol in embodiment performs the same operation | movement, description may be abbreviate | omitted again.

(実施の形態1)
本実施の形態において、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、変換した他言語のプログラムと対応するコメントを対応付けて出力するドキュメント生成装置について説明する。なお、かかるドキュメント生成装置により、他言語のプログラムの保守が容易になる。なお、他言語のプログラムとは、アセンブラ以外の言語のプログラムのことである。
(Embodiment 1)
In the present embodiment, a description will be given of a document generation apparatus that outputs a comment corresponding to a converted program in another language when performing migration for converting the assembler program into a program in another language. Such a document generation device facilitates maintenance of programs in other languages. The other language program is a program in a language other than the assembler.

また、本実施の形態において、さらに、アセンブラプログラムをも対応付けて出力するドキュメント生成装置について説明する。   Further, in the present embodiment, a document generation apparatus that outputs an assembler program in association with each other will also be described.

また、本実施の形態において、アセンブラのプログラム集合の中から、予め決められたソースパターンに合致するソース列に対して、可読性向上のための処理を施し、蓄積するドキュメント生成装置について説明する。予め決められたソースパターンとは、例えば、ダミーセクションの箇所を特定するパターン、オフセットを持つ戻りの箇所を特定するパターン、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターン、退避コードまたは復帰コードの箇所を特定するためのパターン、2以上のループの一部が重なっている箇所を特定するためのパターン等である。   Also, in the present embodiment, a document generation apparatus that performs processing for improving readability on a source string that matches a predetermined source pattern from an assembler program set and stores the document sequence will be described. The predetermined source pattern is, for example, a pattern for specifying a dummy section location, a pattern for specifying a return location having an offset, or a location of two or more instructions of an assembler that can be converted into another language program of one instruction. A pattern for specifying the location of the save code or the return code, a pattern for specifying a location where a part of two or more loops overlap, and the like.

また、本実施の形態において、アセンブラのプログラム集合の中の、予め決められた条件を満たす箇所の範囲を特定し、当該箇所に対応する処理を行うドキュメント生成装置について説明する。なお、当該箇所に対応する処理とは、例えば、削除処理、ローカル変数の定義を生成する処理等である。   Also, in the present embodiment, a document generation apparatus that specifies a range of locations that satisfy a predetermined condition in an assembler program set and performs processing corresponding to the locations will be described. The process corresponding to the location is, for example, a deletion process, a process for generating a local variable definition, or the like.

図1は、本実施の形態におけるドキュメント生成装置1のブロック図である。   FIG. 1 is a block diagram of a document generation apparatus 1 in the present embodiment.

ドキュメント生成装置1は、格納部11、処理部12、および出力部13を備える。   The document generation device 1 includes a storage unit 11, a processing unit 12, and an output unit 13.

格納部11は、原ソース格納部111、箇所特定条件格納部112、変換情報格納部113、およびコメント元情報格納部114を備える。   The storage unit 11 includes an original source storage unit 111, a location specifying condition storage unit 112, a conversion information storage unit 113, and a comment source information storage unit 114.

処理部12は、アセンブラプログラム取得部121、変換部122、コメント取得部123、および出力情報構成部124を備える。   The processing unit 12 includes an assembler program acquisition unit 121, a conversion unit 122, a comment acquisition unit 123, and an output information configuration unit 124.

変換部122は、可読性向上処理手段1221を備える。   The conversion unit 122 includes a readability improvement processing unit 1221.

格納部11は、各種の情報を格納し得る。各種の情報とは、後述する原ソース、箇所特定条件、変換情報、コメント元情報などである。   The storage unit 11 can store various types of information. The various types of information include an original source, a part specifying condition, conversion information, comment source information, and the like, which will be described later.

原ソース格納部111は、マイグレーション対象のプログラムである原ソースを格納し得る。原ソースは、通常、アセンブラ言語で記述されたアセンブラプログラムを含む。また、原ソースとは、アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであっても良い。なお、他言語プログラムは、ここでは、例えば、高級言語のプログラムである。高級言語は、COBOL、C言語、C++、JAVA(登録商標)等、問わない。また、他言語プログラムは、例えば、アセンブラプログラムを呼び出して利用しているプログラムである。また、アセンブラプログラムにおけるアセンブラの種類は問わない。アセンブラは、ここでは、アセンブリ言語と言っても良い。アセンブラは、例えば、IBM System/370で使用されているアセンブラである。   The original source storage unit 111 can store an original source that is a program to be migrated. The original source usually includes an assembler program written in an assembler language. The original source may be a program having an assembler program and another language program that is a program in a language other than the assembler. Here, the other language program is, for example, a high-level language program. The high-level language is not limited, such as COBOL, C language, C ++, JAVA (registered trademark), or the like. The other language program is, for example, a program that is used by calling an assembler program. The type of assembler in the assembler program is not limited. The assembler may be referred to herein as assembly language. The assembler is an assembler used in, for example, IBM System / 370.

また、原ソース格納部111が格納している原ソースは、アセンブラ言語で記述されたアセンブラプログラムを変換した中間言語のプログラム(中間表現と言っても良い)でも良い。中間言語のプログラムは、例えば、アセンブラプログラムの一の命令が行う複数の処理を2以上の処理に分解し、得られた2以上の命令群である。なお、中間言語のプログラムの一の命令は、アセンブラプログラムの一の命令に対応づいているものがあっても良い。また、アセンブラプログラムを中間言語のプログラムに変換する処理は、後述する変換部122が行っても良いし、他の装置で行われても良い。   Further, the original source stored in the original source storage unit 111 may be an intermediate language program (which may be referred to as an intermediate expression) obtained by converting an assembler program described in an assembler language. The intermediate language program is, for example, a group of two or more instructions obtained by decomposing a plurality of processes performed by one instruction of the assembler program into two or more processes. Note that one instruction of the intermediate language program may correspond to one instruction of the assembler program. The process of converting the assembler program into an intermediate language program may be performed by the conversion unit 122 described later, or may be performed by another device.

箇所特定条件格納部112は、1以上の箇所特定条件を格納し得る。箇所特定条件とは、原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である。箇所特定条件は、例えば、アセンブラプログラムのパターンに関する情報であるソースパターン情報である。箇所特定条件は、例えば、原ソース内において、予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件である。箇所特定条件格納部112は、箇所特定条件に対応付けて、アセンブラプログラムを他言語に変換する情報を保持していても良い。アセンブラプログラムを他言語に変換する情報は、例えば、他言語のプログラムのパターンに関する他言語パターン情報である。また、アセンブラプログラムを他言語に変換する情報は、例えば、アセンブラプログラムを他言語に変換するプログラムにより構成されている。なお、ソースパターン情報とは、例えば、ダミーセクションを示す情報、オフセットを持つ戻りであることを示す情報、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令を有する原ソース部品を特定するためのパターンの情報、退避コードまたは復帰コードを示す情報、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報等であっても良い。なお、箇所特定条件は、アセンブラプログラムを他言語に変換する際に使用されるので、変換情報の一種である、と考えても良い。かかる場合、箇所特定条件格納部112は、変換情報格納部113の中に含まれる。   The location specifying condition storage unit 112 can store one or more location specifying conditions. The part specifying condition is a condition for specifying a part for performing processing for improving the readability of the program with respect to the original source. The location specifying condition is, for example, source pattern information that is information related to the pattern of the assembler program. The location specifying condition is, for example, a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source. The location specifying condition storage unit 112 may hold information for converting the assembler program into another language in association with the location specifying condition. The information for converting the assembler program into another language is, for example, other language pattern information related to the program pattern of the other language. The information for converting the assembler program into another language is constituted by, for example, a program for converting the assembler program into another language. The source pattern information includes, for example, information indicating a dummy section, information indicating a return having an offset, and an original source component having two or more instructions of an assembler that can be converted into a program of one language in another language. It may be pattern information for specifying, information indicating a save code or a return code, information indicating that two or more loops formed by two or more jump instructions are overlapped, or the like. Note that the location specifying condition is used when the assembler program is converted into another language, and thus may be considered as a kind of conversion information. In such a case, the location specifying condition storage unit 112 is included in the conversion information storage unit 113.

変換情報格納部113は、1以上の変換情報を格納し得る。変換情報とは、アセンブラのプログラムを高級言語等の他言語のプログラムに変換するための情報である。変換情報は、通常、可読性を向上するとは限らないプログラム変換のための情報である。変換情報は、例えば、アセンブラプログラムのパターンを示すアセンブラパターン情報と、他言語プログラムのパターンを示す他言語パターン情報とを有する。変換情報は、例えば、アセンブラプログラムのパターンを示すアセンブラパターン情報と、アセンブラプログラムを他言語に変換するプログラムである。   The conversion information storage unit 113 can store one or more pieces of conversion information. The conversion information is information for converting an assembler program into a program in another language such as a high-level language. The conversion information is information for program conversion that does not always improve readability. The conversion information includes, for example, assembler pattern information indicating an assembler program pattern and other language pattern information indicating a pattern of another language program. The conversion information is, for example, assembler pattern information indicating an assembler program pattern and a program for converting the assembler program into another language.

変換情報は、アセンブラのプログラムを他のアセンブラのプログラムに変換するための情報でも良い。かかる場合、他のアセンブラのプログラムは、通常、他言語のプログラムへの変換を容易にするプログラムである。   The conversion information may be information for converting an assembler program into another assembler program. In such a case, the other assembler program is usually a program that facilitates conversion to a program in another language.

また、変換情報は、他言語のプログラムを他の他言語のプログラムに変換するための情報でも良い。かかる場合、他の他言語のプログラムは、通常、元の他言語のプログラムより可読性が向上したプログラムである。   The conversion information may be information for converting a program in another language into a program in another language. In such a case, the other language program is usually a program whose readability is improved compared to the original other language program.

また、変換情報は、中間言語のプログラムをアセンブラのプログラムに変換するための情報でも良い。   The conversion information may be information for converting an intermediate language program into an assembler program.

また、変換情報は、中間言語のプログラムを他の中間言語のプログラムに変換するための情報でも良い。かかる場合、他の中間言語のプログラムは、通常、他言語のプログラムへの変換を容易にするプログラムである。   The conversion information may be information for converting an intermediate language program into another intermediate language program. In such a case, the other intermediate language program is usually a program that facilitates conversion to another language program.

変換情報は、例えば、「DSECT以外のUSING命令は削除することを示す情報」「DSECT以外のDROP命令は削除することを示す情報」「アセンブラ"M $変数1,$変数2"はC言語"$変数1=$変数1*$変数2"に変換することを示す情報」「アセンブラ"A $変数1,$変数2"はC言語"$変数1=$変数1+$変数2"に変換することを示す情報」などである。なお、「$変数1」等は、任意の変数を示す文字列である。   The conversion information includes, for example, “information indicating that a USING instruction other than DECT is deleted” “information indicating that a DROP instruction other than DECT is deleted” “assembler“ M $ variable 1, $ variable 2 ”is C language” $ Variable 1 = information indicating conversion to $ variable 1 * $ variable 2 "" assembler "A $ variable 1, $ variable 2" is converted to C language "$ variable 1 = $ variable 1 + $ variable 2" "Information indicating that". “$ Variable 1” or the like is a character string indicating an arbitrary variable.

コメント元情報格納部114は、変換情報格納部113のいずれかの変換情報に対応付けて、1以上のコメント元情報を格納し得る。また、コメント元情報格納部114は、箇所特定条件格納部112のいずれかの箇所特定条件に対応付けて、1以上のコメント元情報を格納し得る。   The comment source information storage unit 114 can store one or more comment source information in association with any conversion information in the conversion information storage unit 113. Further, the comment source information storage unit 114 can store one or more comment source information in association with any one of the location specifying conditions in the location specifying condition storage unit 112.

コメント元情報格納部114は、変換情報に対応付いているコメント元情報に代えて、または変換情報に対応付いているコメント元情報に加えて、1以上の箇所特定条件のいずれかの箇所特定条件に対応付いたコメント元情報を格納し得る。   The comment source information storage unit 114 replaces the comment source information associated with the conversion information, or in addition to the comment source information associated with the conversion information, any one of the one or more location identification conditions The comment source information associated with can be stored.

なお、コメント元情報は、コメントの元になる情報である。コメント元情報は、例えば、文字列である。コメント元情報は、例えば、アセンブラプログラム内の情報が代入される変数を含んだ文字列パターンでも良い。また、コメント元情報は、例えば、他言語プログラム内の情報が代入される変数を含んだ文字列パターンでも良い。   The comment source information is information that is a source of the comment. The comment source information is, for example, a character string. The comment source information may be, for example, a character string pattern including a variable into which information in the assembler program is substituted. The comment source information may be, for example, a character string pattern including a variable to which information in another language program is substituted.

また、コメント元情報が対応付いていない変換情報が存在しても良いし、コメント元情報が対応付いていない箇所特定条件が存在しても良い。   Also, there may be conversion information that does not correspond to comment source information, or there may exist a location specifying condition that does not correspond to comment source information.

処理部12は、各種の処理を行う。各種の処理とは、例えば、アセンブラプログラム取得部121、変換部122、可読性向上処理手段1221、コメント取得部123、出力情報構成部124が行う処理である。   The processing unit 12 performs various processes. The various processes are processes performed by the assembler program acquisition unit 121, the conversion unit 122, the readability improvement processing unit 1221, the comment acquisition unit 123, and the output information configuration unit 124, for example.

アセンブラプログラム取得部121は、原ソースから、アセンブラプログラムを取得する。原ソースがアセンブラプログラムと他言語プログラムとを有するプログラムである場合、アセンブラプログラム取得部121は、原ソースからアセンブラプログラムを抽出する。なお、例えば、アセンブラプログラム取得部121は、アセンブラプログラムの開始を示す文字列と終了を示す文字列とを用いて、開始を示す文字列と終了を示す文字列との間のプログラム(文字列)を、原ソースから取得する。また、例えば、アセンブラプログラム取得部121は、アセンブラプログラムであることを示す拡張子(例えば、「asm」)を有するファイルを原ソース格納部111から取得する。また、例えば、アセンブラプログラム取得部121は、アセンブラプログラムの命令または命令パターンに合致するプログラム(文字列)を、原ソースから取得する。なお、かかる場合、アセンブラプログラムのすべての命令または命令パターンは、格納部11に格納されている、とする。   The assembler program acquisition unit 121 acquires an assembler program from the original source. When the original source is a program having an assembler program and another language program, the assembler program acquisition unit 121 extracts the assembler program from the original source. For example, the assembler program acquisition unit 121 uses a character string indicating the start and a character string indicating the end of the assembler program, and a program (character string) between the character string indicating the start and the character string indicating the end. From the original source. For example, the assembler program acquisition unit 121 acquires a file having an extension (for example, “asm”) indicating that it is an assembler program from the original source storage unit 111. Further, for example, the assembler program acquisition unit 121 acquires a program (character string) that matches an instruction or instruction pattern of the assembler program from the original source. In such a case, it is assumed that all instructions or instruction patterns of the assembler program are stored in the storage unit 11.

変換部122は、原ソース格納部111に格納されている原ソース(ここでは、アセンブラプログラム)を、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する。なお、目的言語のプログラムは、C言語などの他言語のプログラムである。原ソースを目的ソースに変換する処理は、原ソースを無くす処理とは限らず、原ソースと目的ソースの両方が存在する状況にする処理であることは好適である。原ソースを目的ソースに変換する処理は、原ソースから目的ソースを取得する処理である。   The conversion unit 122 converts the original source (here, the assembler program) stored in the original source storage unit 111 into a target source that is a program in another language and is a program in the target language. The target language program is a program in another language such as C language. The process of converting the original source to the target source is not limited to the process of eliminating the original source, and is preferably a process for setting both the original source and the target source. The process of converting the original source into the target source is a process of acquiring the target source from the original source.

変換部122は、アセンブラプログラム取得部121が取得したアセンブラプログラムを目的ソースに変換しても良い。かかる場合、変換部122は、アセンブラプログラム以外のプログラム(例えば、Java、COBOL等のプログラム)を、目的ソースに変換しても良い。アセンブラプログラム以外のプログラムとは、アセンブラプログラム取得部121が原ソース格納部111から取得しなかったプログラムであり、原ソース格納部111に格納されているプログラムである。なお、アセンブラプログラム以外のプログラムを、目的ソースに変換するプログラムは公知技術であるので、詳細な説明は省略する。   The conversion unit 122 may convert the assembler program acquired by the assembler program acquisition unit 121 into a target source. In such a case, the conversion unit 122 may convert a program other than the assembler program (for example, a program such as Java or COBOL) into a target source. A program other than the assembler program is a program that is not acquired from the original source storage unit 111 by the assembler program acquisition unit 121 and is a program stored in the original source storage unit 111. Since a program for converting a program other than the assembler program into a target source is a known technique, detailed description thereof is omitted.

変換部122は、1以上の変換情報を用いて、アセンブラプログラムを目的ソースに変換しても良い。また、変換部122は、1以上の箇所特定条件を用いて、アセンブラプログラムを目的ソースに変換する。つまり、変換部122は、例えば、箇所特定条件に合致する変換対象のプログラムの箇所に対して、当該箇所特定条件に対応する変換情報を用いて、当該変換対象のプログラムの箇所を変換して、変換後のプログラムを取得する。   The conversion unit 122 may convert the assembler program into a target source using one or more pieces of conversion information. The conversion unit 122 converts the assembler program into a target source using one or more location specifying conditions. That is, for example, the conversion unit 122 converts the location of the program to be converted using the conversion information corresponding to the location specifying condition for the location of the program to be converted that matches the location specifying condition, Get the converted program.

変換対象のプログラムは、通常、アセンブラプログラムであるが、中間言語のプログラム、目的ソースのプログラムでも良い。また、変換後のプログラムは、通常、目的ソースのプログラムであるが、アセンブラプログラム、中間言語のプログラムでも良い。   The program to be converted is usually an assembler program, but may be an intermediate language program or a target source program. The converted program is usually a target source program, but may be an assembler program or an intermediate language program.

変換部122は、原ソース格納部111に格納されている原ソースを構成する一部のプログラムである1以上の各原ソース部品を、各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する。なお、目的ソース部品とは、目的ソースを構成する一部のプログラムである。   The conversion unit 122 converts one or more original source parts, which are a part of programs constituting the original source stored in the original source storage unit 111, into other languages using conversion information corresponding to each original source part. The target source component which is a program in another language is acquired for each of one or more conversion objects. The target source component is a part of the program that constitutes the target source.

変換部122は、アセンブラプログラム取得部121が取得したアセンブラプログラムを構成する一部のプログラムである1以上の各原ソース部品を、各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する。   The conversion unit 122 converts one or more original source parts, which are a part of the assembler program acquired by the assembler program acquisition unit 121, into a program in another language using conversion information corresponding to each original source part. And a target source component that is a program in another language is acquired for each of one or more conversion objects.

可読性向上処理手段1221は、プログラムの可読性を向上させる処理である可読性向上処理を行う。可読性向上処理は、例えば、アセンブラのダミーセクションの定義をC言語等の他言語の構造体の定義に書き換える処理である。また、可読性向上処理は、例えば、アセンブラのオフセットを持つ戻り処理を、適切な他言語のプログラムに書き換える処理である。また、可読性向上処理は、例えば、2以上の命令群のアセンブラプログラムを、1命令の他言語のプログラムに書き換える処理である。なお、1命令の他言語のプログラムとは、例えば、C言語において、「;」が一つで足りる命令である。また、可読性向上処理は、例えば、アセンブラプログラム中の退避コードまたは復帰コードを削除する処理である。また、可読性向上処理は、例えば、アセンブラプログラム中の複数のループ処理を、適切な他言語のプログラムに書き換える処理である。また、可読性向上処理は、例えば、到達できないアセンブラプログラムの箇所を削除する処理である。また、可読性向上処理は、例えば、アセンブラプログラムの変数の生存区間を検査し、他言語のローカル変数とする処理である。   The readability improvement processing unit 1221 performs readability improvement processing that is processing for improving the readability of the program. The readability improving process is, for example, a process of rewriting the definition of the assembler dummy section to the definition of a structure in another language such as C language. The readability improving process is, for example, a process of rewriting a return process having an assembler offset into an appropriate other language program. Further, the readability improving process is a process of rewriting an assembler program of two or more instruction groups into a program of another language of one instruction, for example. The one-language other language program is, for example, an instruction in which one “;” is sufficient in the C language. Further, the readability improving process is a process of deleting a save code or a return code in the assembler program, for example. Further, the readability improving process is a process of rewriting a plurality of loop processes in the assembler program into appropriate other language programs, for example. Further, the readability improving process is a process of deleting a part of the assembler program that cannot be reached, for example. The readability improving process is, for example, a process of checking a life span of a variable in an assembler program and setting it as a local variable in another language.

また、可読性向上処理は、例えば、2以上の命令群のアセンブラプログラムを、2以上の命令の目的ソースのプログラムに書き換える処理である。つまり、一の命令のアセンブラプログラムは2以上の命令群を有する中間言語のプログラムに変換され得る。また、2以上の命令群の中間言語のプログラムは、一または2以上の命令の目的ソースのプログラムに変換され得る。そして、かかる場合、2以上の命令群のアセンブラプログラムを、2以上の命令の目的ソースのプログラムに書き換えられ得る。さらに具体的には、2以上の命令群(ac1,ac2)のアセンブラプログラムが存在する場合、アセンブラプログラムの第一の命令(ac1)が中間言語のプログラム(mc1,mc2)に変換され、アセンブラプログラムの第二の命令(ac2)が中間言語のプログラム(mc3,mc4)に変換された、とする。そして、中間言語のプログラムの第一の命令(mc1)は、目的ソースのプログラムの命令(ts1)に変換され、中間言語のプログラムの第二、第三の命令(mc2,mc3)は、目的ソースのプログラムの命令(ts2)に変換され、中間言語のプログラムの第四の命令(mc4)は、目的ソースのプログラムの命令(ts3)に変換された、とする。かかる場合、2つの命令を有するアセンブラプログラム(ac1,ac2)が、3つの命令(ts1,ts2,ts3)を有する目的ソースのプログラムに変換される。   The readability improving process is a process of rewriting an assembler program of two or more instruction groups into a program of a target source of two or more instructions, for example. That is, an assembler program of one instruction can be converted into an intermediate language program having two or more instruction groups. Further, an intermediate language program of two or more instruction groups can be converted into a target source program of one or more instructions. In such a case, an assembler program of two or more instruction groups can be rewritten into a program of a target source of two or more instructions. More specifically, if there is an assembler program of two or more instruction groups (ac1, ac2), the first instruction (ac1) of the assembler program is converted into an intermediate language program (mc1, mc2), and the assembler program Is converted to an intermediate language program (mc3, mc4). The first instruction (mc1) of the intermediate language program is converted to the instruction (ts1) of the target source program, and the second and third instructions (mc2, mc3) of the intermediate language program are converted to the target source. It is assumed that the fourth instruction (mc4) of the intermediate language program is converted to the instruction (ts3) of the target source program. In such a case, the assembler program (ac1, ac2) having two instructions is converted into a target source program having three instructions (ts1, ts2, ts3).

さらに具体的には、可読性向上処理は、原ソース格納部111に格納されている原ソースが有するアセンブラプログラムに対して、1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、合致する箇所特定条件に対応する処理である。   More specifically, the readability improving process applies one or more location specifying conditions to the assembler program included in the original source stored in the original source storage unit 111, and corresponds to the matching location specifying conditions. This is processing corresponding to the location specifying condition that matches the location.

第一の可読性向上処理は、箇所特定条件がプログラムのパターンに関する情報であるソースパターン情報である場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースが有するアセンブラプログラムに対して、1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する箇所に対して、合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う。合致するソースパターン情報に対応する処理は、通常、プログラムで実現される。   The first readability improving process is a case where the location specifying condition is source pattern information which is information related to a program pattern. In such a case, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the assembler program included in the original source stored in the original source storage unit 111, and corresponds to the matching source pattern information. On the other hand, the readability improving process is a process corresponding to the matching source pattern information and improving the readability of the program. The processing corresponding to the matching source pattern information is usually realized by a program.

第二の可読性向上処理は、箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件である場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースが有するアセンブラプログラムに対して、1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う。なお、合致する範囲条件に対応する処理は、通常、プログラムで実現される。   The second readability improving process is a case where the location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source. In such a case, the readability improvement processing unit 1221 applies one or more range conditions to the assembler program included in the original source stored in the original source storage unit 111, and applies to the portion corresponding to the matching range condition. Thus, the readability improving process, which is a process corresponding to the matching range condition and improving the readability of the program, is performed. The processing corresponding to the matching range condition is usually realized by a program.

また、範囲条件は、例えば、着目した一の変数が使用されている生存区間を特定する条件である。生存区間は、着目した一の変数が出現するプログラムの範囲である、と言える。また、範囲条件は、例えば、アセンブラプログラムを静的解析した結果、実行され得ないプログラムの範囲を特定する条件である。   In addition, the range condition is a condition for specifying, for example, a life span in which one focused variable is used. It can be said that the life span is a range of a program in which one focused variable appears. The range condition is a condition for specifying a range of programs that cannot be executed as a result of static analysis of the assembler program, for example.

また、範囲条件は、例えば、実行され得ないプログラムの範囲を判定するための条件、変数を特定するための条件等である。   The range condition is, for example, a condition for determining a range of a program that cannot be executed, a condition for specifying a variable, or the like.

(A)以下、第一の可読性向上処理の具体例を説明する。第一の可読性向上処理の例は、以下の(A−1)から(A−5)の5つである。   (A) Hereinafter, a specific example of the first readability improving process will be described. Examples of the first readability improvement process are the following five (A-1) to (A-5).

(A−1)ソースパターン情報が、ダミーセクションを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、ダミーセクションを含む原ソース部品を決定し、当該原ソース部品を用いて、構造体を定義する他言語のプログラムを取得する。   (A-1) This is a case where the source pattern information includes information indicating a dummy section. In such a case, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines an original source part including a dummy section, and Using a source part, obtain a program in another language that defines the structure.

(A−2)ソースパターン情報が、オフセットを持つ戻りであることを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む原ソース部品を決定し、当該原ソース部品を用いて、プログラムに含まれるオフセットを条件に用いた分岐を示す他言語のプログラムを取得する。   (A-2) This is a case where the source pattern information includes information indicating that the return has an offset. In such a case, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines an original source part including a return having an offset, Using the original source part, a program in another language indicating a branch using an offset included in the program as a condition is acquired.

(A−3)ソースパターン情報が、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上の命令の原ソース部品を決定し、当該原ソース部品を用いて、一命令の他言語のプログラムを取得する。   (A-3) This is a case where the source pattern information is pattern information for specifying the location of two or more instructions of the assembler that can be converted into a program of another language of one instruction. In such a case, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines original source parts of two or more instructions, Using the original source part, obtain a program in another language of one instruction.

(A−4)ソースパターン情報が、退避コードまたは復帰コードを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの原ソース部品を決定し、当該原ソース部品に対応するプログラムを、原ソースまたは目的ソースから削除する。可読性向上処理手段1221は、退避コードまたは復帰コードが対象とするレジスタまたは変数が、退避コードまたは復帰コードが出現する関数内で使用されていないか否かを判断し、使用されていない場合に、退避コードまたは復帰コードを削除することは好適である。   (A-4) This is a case where the source pattern information includes information indicating a save code or a return code. In such a case, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines the original source part of the save code or the return code, The program corresponding to the original source part is deleted from the original source or the target source. The readability improvement processing unit 1221 determines whether the register or variable targeted by the save code or the return code is not used in the function in which the save code or the return code appears. It is preferable to delete the save code or the return code.

(A−5)ソースパターン情報が、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示す他言語のプログラムに変更する。   (A-5) This is a case where the source pattern information includes information indicating that two or more loops formed by two or more jump instructions overlap each other. In such a case, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, and finds a place where a part of two or more loops overlap. The program corresponding to the location is changed to a program in another language indicating a loop that does not have a jump instruction, giving priority to one loop that satisfies a predetermined condition.

ここで、予め決められた条件とは、例えば、以下の(1)(2)の2つである。
(1)ボトムが起点から最も遠いループであること。
Here, the predetermined conditions are, for example, the following two (1) and (2).
(1) The bottom is the loop farthest from the starting point.

この条件の場合、ループが複数あれば、 可読性向上処理手段1221は、ボトムが起点から遠いループを優先し、当該優先されたループの箇所を、他言語のループのプログラムに書き換え、当該優先されたループの箇所からジャンプ命令を無くす。これは、複雑な構造がある場合に、なるべくループへの飛び込みを避けることにより、プログラムの可読性を良くする趣旨である。なお、この場合、ループからの飛び出しは容認する。   In the case of this condition, if there are a plurality of loops, the readability improvement processing unit 1221 gives priority to the loop whose bottom is far from the starting point, and rewrites the portion of the priority loop with a program of a loop in another language. Eliminate jump instructions from loop locations. This is to improve the readability of the program by avoiding jumping into the loop as much as possible when there is a complicated structure. In this case, jumping out of the loop is permitted.

また、ここで、起点とは、複数のループを含むプログラム群の最初の命令(行と言っても良い)または基本ブロックである。また、ボトムとは、複数のループを含むプログラム群の最後の命令(行と言っても良い)または基本ブロックである。さらに、他言語のループのプログラムとは、例えば、C言語の場合、「while」や「for」を用いたプログラムである。
(2)ボトムが同じループが複数ある場合、ループのトップが起点から最も近いループであること。
Here, the starting point is the first instruction (also referred to as a line) or a basic block of a program group including a plurality of loops. The bottom is the last instruction (also referred to as a line) or basic block of a program group including a plurality of loops. Furthermore, the loop program in another language is, for example, a program using “while” or “for” in the case of C language.
(2) When there are a plurality of loops having the same bottom, the top of the loop is the loop closest to the starting point.

この条件の場合、ボトムが同じループが複数あれば、可読性向上処理手段1221は、トップが起点から最も近いループを優先し、当該優先されたループの箇所を、他言語のループのプログラムに書き換え、当該優先されたループの箇所からジャンプ命令を無くす。   In the case of this condition, if there are a plurality of loops having the same bottom, the readability improvement processing unit 1221 gives priority to the loop whose top is closest to the starting point, and rewrites the place of the priority loop to a loop program in another language. The jump instruction is eliminated from the location of the priority loop.

本条件に対応するマイグレーション処理を行うことにより、可読性が向上するだけではなく、外側のループから処理することになり、全体の計算量が少なくなる、という効果がある。   By performing the migration processing corresponding to this condition, not only the readability is improved, but also the processing is performed from the outer loop, and the entire calculation amount is reduced.

(B)以下、第二の可読性向上処理の具体例を説明する。第二の可読性向上処理の例は、以下の(B−1)から(B−2)の2つである。   (B) Hereinafter, a specific example of the second readability improving process will be described. Examples of the second readability improvement process are the following two (B-1) to (B-2).

(B−1)範囲条件が、実行され得ないプログラムの範囲を判定するための条件である場合である。かかる場合、可読性向上処理手段1221は、原ソースを静的解析し、合致する範囲条件に対応する箇所のプログラムを特定し、プログラムを削除する。   (B-1) This is a case where the range condition is a condition for determining the range of a program that cannot be executed. In such a case, the readability improvement processing unit 1221 statically analyzes the original source, identifies a program corresponding to the matching range condition, and deletes the program.

(B−2)範囲条件が、変数を特定するための条件である場合である。かかる場合、可読性向上処理手段1221は、原ソースまたは目的ソースから変数を取得し、変数の生存区間を取得し、変数を、生存区間におけるローカル変数として定義する可読性向上処理を行う。   (B-2) This is a case where the range condition is a condition for specifying a variable. In such a case, the readability improvement processing unit 1221 acquires a variable from the original source or the target source, acquires a life span of the variable, and performs readability improvement processing that defines the variable as a local variable in the life span.

なお、可読性向上処理手段1221は、例えば、原ソースまたは目的ソースに出現する一の変数に対して、出現する1以上の基本ブロックを特定する。そして、可読性向上処理手段1221は、特定した1以上の基本ブロックを一の関数として、定義する。そして、可読性向上処理手段1221は、当該一の関数の命令の前に、当該一の変数を定義する。   Note that the readability improvement processing unit 1221 identifies one or more basic blocks that appear for one variable that appears in the original source or the target source, for example. Then, the readability improvement processing unit 1221 defines the identified one or more basic blocks as one function. Then, the readability improvement processing unit 1221 defines the one variable before the instruction of the one function.

例えば、変換する他言語がC言語の場合、可読性向上処理手段1221は、例えば、「function_name(){ 1以上の変数定義; 1以上の基本ブロックを変換した他言語の命令列;}」を取得する。なお、「function_name」は関数名であり、可読性向上処理手段1221が、予め決められた規則に基づいて生成した関数名であることは好適である。また、「1以上の変数定義」は、例えば、「char 変数名;」「int 変数名;」などであり、可読性向上処理手段1221は、C言語の文法に従って、変数の型、変数名を取得し、記載する。なお、変数名は、予め決められたルールに基づいて、決定されることは好適である。   For example, when the other language to be converted is C language, the readability improvement processing unit 1221 obtains, for example, “function_name () {one or more variable definitions; one or more basic block converted instruction sequence;}”, for example. To do. Note that “function_name” is a function name, and it is preferable that the function name generated by the readability improvement processing unit 1221 based on a predetermined rule. The “one or more variable definitions” are, for example, “char variable name;” “int variable name;”, etc., and the readability improvement processing unit 1221 acquires the variable type and variable name according to the C language grammar. And describe. The variable name is preferably determined based on a predetermined rule.

可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する原ソース部品に対して、合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得する。   The readability improvement processing unit 1221 applies one or more location specifying conditions to the original source stored in the original source storage unit 111, and matches the source source parts corresponding to the matching location specifying conditions. The target source component corresponding to the original source component is acquired by performing readability improving processing that is processing corresponding to the location specifying condition to be performed and improving the readability of the program.

可読性向上処理手段1221は、例えば、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する原ソース部品に対して、合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得する。   For example, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, and applies to the original source component corresponding to the matching source pattern information. The target source component corresponding to the original source component is obtained by performing the readability improving process, which is a process corresponding to the matching source pattern information and improving the readability of the program.

可読性向上処理手段1221は、例えば、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、ダミーセクションを含む原ソース部品を決定し、原ソース部品を用いて、構造体を定義する目的ソース部品を取得する。   For example, the readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines an original source part including a dummy section, and determines the original source part. Is used to obtain the target source part that defines the structure.

可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む原ソース部品を決定し、原ソース部品を用いて、原ソース部品に含まれるオフセットを条件に用いた分岐を示す目的ソース部品を取得する。   The readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines an original source part including a return having an offset, and the original source part Is used to obtain the target source part indicating the branch using the offset included in the original source part as a condition.

可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上の命令を有する原ソース部品を決定し、原ソース部品を用いて、一命令の他言語のプログラムである目的ソース部品を取得する。   The readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines an original source part having two or more instructions, and determines the original source part. Is used to obtain a target source component which is a program in another language of one instruction.

可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの原ソース部品を決定し、原ソース部品に対応するプログラムを、原ソースまたは目的ソースから削除する。   The readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines the original source part of the save code or the return code, and the original source part The program corresponding to is deleted from the original source or the target source.

可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更する。   The readability improvement processing unit 1221 applies one or more pieces of source pattern information to the original source stored in the original source storage unit 111, determines a portion where two or more loops overlap, The program corresponding to the location is changed to a program indicating a loop that does not have a jump instruction by giving priority to one loop that satisfies a predetermined condition.

可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う。   The readability improvement processing unit 1221 applies one or more range conditions to the original source stored in the original source storage unit 111, and sets the matching range condition to a location corresponding to the matching range condition. It is a corresponding process, and a readability improving process, which is a process for improving the readability of the program, is performed.

可読性向上処理手段1221は、原ソースを静的解析し、合致する範囲条件に対応する箇所のプログラムを特定し、プログラムを削除する。   The readability improvement processing unit 1221 statically analyzes the original source, specifies a program corresponding to the matching range condition, and deletes the program.

可読性向上処理手段1221は、原ソースまたは目的ソースから変数を取得し、変数の生存区間を取得し、変数を、生存区間におけるローカル変数として定義する可読性向上処理を行う。   The readability improvement processing unit 1221 acquires a variable from the original source or the target source, acquires a life span of the variable, and performs a readability improvement process of defining the variable as a local variable in the live life section.

コメント取得部123は、変換部122が用いた変換情報に対応するコメント元情報を用いてコメントを取得する。   The comment acquisition unit 123 acquires a comment using comment source information corresponding to the conversion information used by the conversion unit 122.

コメント取得部123は、可読性向上処理手段1221が用いた箇所特定条件に対応するコメント元情報を用いてコメントを取得する。   The comment acquisition unit 123 acquires a comment using comment source information corresponding to the location specifying condition used by the readability improvement processing unit 1221.

なお、コメント元情報がコメントである場合、コメント取得部123は、変換情報または箇所特定条件に対応するコメント元情報を、コメントとして取得する。なお、コメントは、通常、対応する他言語のプログラムを説明する情報である。また、コメントは、例えば、原ソース部品から目的ソース部品を得る変換処理を説明する情報である。   When the comment source information is a comment, the comment acquisition unit 123 acquires comment source information corresponding to the conversion information or the part specifying condition as a comment. Note that the comment is usually information that describes a program of a corresponding other language. Also, the comment is information that explains, for example, conversion processing for obtaining a target source part from an original source part.

また、コメント元情報がアセンブラプログラム内の情報が代入される変数を含んだ文字列パターンである場合、コメント取得部123は、変換情報または箇所特定条件に対応するコメント元情報の1以上の各変数に対応する文字列をアセンブラプログラム(原ソース部品)から取得し、当該取得した1以上の各文字列を対応する変数に代入し、変数のない文字列であるコメントを取得する。   In addition, when the comment source information is a character string pattern including a variable to which information in the assembler program is substituted, the comment acquisition unit 123 includes one or more variables of the comment source information corresponding to the conversion information or the part specifying condition. Is obtained from the assembler program (original source part), and each of the obtained one or more character strings is substituted into the corresponding variable to obtain a comment that is a character string having no variable.

出力情報構成部124は、出力する情報である出力情報を構成する。出力情報は、目的ソース部品と、コメント取得部123が取得したコメントとを有する。なお、このコメントは、目的ソース部品に対応するコメントである。また、出力情報は、原ソース部品と目的ソース部品とコメント取得部123が取得したコメントとを有する。なお、このコメントは、原ソース部品と目的ソース部品に対応するコメントである。出力情報は、原ソース部品と目的ソース部品とコメントのうちの2種類以上の情報を有する。   The output information configuration unit 124 configures output information that is information to be output. The output information includes the target source component and the comment acquired by the comment acquisition unit 123. This comment is a comment corresponding to the target source component. The output information includes the original source component, the target source component, and the comment acquired by the comment acquisition unit 123. This comment is a comment corresponding to the original source part and the target source part. The output information includes two or more types of information of the original source part, the target source part, and the comment.

出力部13は、出力情報構成部124が構成した出力情報を出力する。   The output unit 13 outputs the output information configured by the output information configuration unit 124.

出力部13は、変換部122が取得した1以上の各目的ソース部品と、各目的ソース部品が取得される際に利用された変換情報に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力しても良い。   The output unit 13 includes one or more target source components acquired by the conversion unit 122 and a comment acquired using comment source information corresponding to the conversion information used when each target source component is acquired. You may output correspondingly.

出力部13は、1以上の各目的ソース部品と、各目的ソース部品に対応するコメントと、各目的ソース部品の元になった原ソースを構成する原ソース部品とを対応付けて出力しても良い。   The output unit 13 may output one or more target source parts, a comment corresponding to each target source part, and an original source part constituting the original source that is the basis of each target source part in association with each other. good.

出力部13は、変換部122が取得した1以上の各目的ソース部品と、各目的ソース部品が取得される際に利用された変換情報または箇所特定条件に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力しても良い。   The output unit 13 is acquired using one or more target source components acquired by the conversion unit 122 and the conversion source information used when the target source components are acquired or comment source information corresponding to the location specifying conditions. The comment may be output in association with the comment.

出力部13は、変換部122が取得した1以上の各目的ソース部品と、各目的ソース部品が取得される際に利用された変換情報または箇所特定条件に対応するコメント元情報を用いて取得されたコメントと、各目的ソース部品の元になった原ソースを構成する原ソース部品とを対応付けて出力しても良い。   The output unit 13 is acquired using one or more target source components acquired by the conversion unit 122 and the conversion source information used when the target source components are acquired or comment source information corresponding to the location specifying conditions. The comment may be output in association with the original source component constituting the original source that is the basis of each target source component.

出力部13は、変換部122が変換して、取得した目的ソースを出力しても良い。また、出力部13は、変換できないアセンブラプログラムが存在する場合、変換できないアセンブラプログラムが存在する旨のエラーを出力しても良い。   The output unit 13 may output the target source obtained by conversion by the conversion unit 122. Further, when there is an assembler program that cannot be converted, the output unit 13 may output an error indicating that there is an assembler program that cannot be converted.

ここで、出力とは、ディスプレイへの表示、プロジェクターを用いた投影、プリンタでの印字、外部の装置への送信、記録媒体への蓄積、他の処理装置や他のプログラムなどへの処理結果の引渡しなどを含む概念である。   Here, output refers to display on a display, projection using a projector, printing on a printer, transmission to an external device, storage in a recording medium, processing result to another processing device or other program, etc. It is a concept that includes delivery.

格納部11、原ソース格納部111、箇所特定条件格納部112、変換情報格納部113、およびコメント元情報格納部114は、不揮発性の記録媒体が好適であるが、揮発性の記録媒体でも実現可能である。   The storage unit 11, the original source storage unit 111, the location specifying condition storage unit 112, the conversion information storage unit 113, and the comment source information storage unit 114 are preferably non-volatile recording media, but are also realized by volatile recording media. Is possible.

格納部11等に情報が記憶される過程は問わない。例えば、記録媒体を介して情報が格納部11等で記憶されるようになってもよく、通信回線等を介して送信された情報が格納部11等で記憶されるようになってもよく、あるいは、入力デバイスを介して入力された情報が格納部11等で記憶されるようになってもよい。   The process in which information is stored in the storage unit 11 or the like is not limited. For example, information may be stored in the storage unit 11 or the like via a recording medium, information transmitted via a communication line or the like may be stored in the storage unit 11 or the like, Alternatively, information input via the input device may be stored in the storage unit 11 or the like.

処理部12、アセンブラプログラム取得部121、変換部122、可読性向上処理手段1221、コメント取得部123、出力情報構成部124、および出力部13は、通常、MPUやメモリ等から実現され得る。処理部12等の処理手順は、通常、ソフトウェアで実現され、当該ソフトウェアはROM等の記録媒体に記録されている。但し、ハードウェア(専用回路)で実現しても良い。   The processing unit 12, the assembler program acquisition unit 121, the conversion unit 122, the readability improvement processing unit 1221, the comment acquisition unit 123, the output information configuration unit 124, and the output unit 13 can be usually realized by an MPU, a memory, or the like. The processing procedure of the processing unit 12 or the like is usually realized by software, and the software is recorded on a recording medium such as a ROM. However, it may be realized by hardware (dedicated circuit).

出力部13は、例えば、出力デバイスのドライバーソフトまたは、出力デバイスのドライバーソフトと出力デバイス等で実現され得る、と考えても良い。   The output unit 13 may be considered to be realized by, for example, driver software for an output device or driver software for an output device and an output device.

次に、ドキュメント生成装置1の動作について、図2のフローチャートを用いて説明する。   Next, the operation of the document generation apparatus 1 will be described using the flowchart of FIG.

(ステップS201)アセンブラプログラム取得部121は、原ソース格納部111に格納されている原ソースから、アセンブラプログラムを取得する。   (Step S201) The assembler program acquisition unit 121 acquires an assembler program from the original source stored in the original source storage unit 111.

(ステップS202)変換部122は、ステップS201で取得されたアセンブラプログラムに対して、静的解析処理を行う。静的解析処理について、図3のフローチャートを用いて説明する。   (Step S202) The conversion unit 122 performs a static analysis process on the assembler program acquired in Step S201. The static analysis process will be described with reference to the flowchart of FIG.

(ステップS203)変換部122は、カウンタiに1を代入する。   (Step S203) The conversion unit 122 substitutes 1 for the counter i.

(ステップS204)変換部122は、i番目の基本ブロックが存在するか否かを判断する。i番目の基本ブロックが存在する場合はステップS205に行き、i番目の基本ブロックが存在しない場合は処理を終了する。   (Step S204) The conversion unit 122 determines whether or not the i-th basic block exists. If the i-th basic block exists, the process goes to step S205. If the i-th basic block does not exist, the process ends.

(ステップS205)可読性向上処理手段1221は、カウンタjに1を代入する。   (Step S205) The readability improvement processing unit 1221 substitutes 1 for the counter j.

(ステップS206)可読性向上処理手段1221は、j番目の箇所特定条件が箇所特定条件格納部112に存在するか否かを判断する。j番目の箇所特定条件が存在する場合はステップS207に行き、存在しない場合はステップS213に行く。   (Step S <b> 206) The readability improvement processing unit 1221 determines whether or not the j-th location specifying condition exists in the location specifying condition storage unit 112. If the j-th location specifying condition exists, the process goes to step S207; otherwise, the process goes to step S213.

(ステップS207)可読性向上処理手段1221は、箇所特定条件格納部112からj番目の箇所特定条件を取得する。   (Step S207) The readability improvement processing unit 1221 acquires the j-th location specifying condition from the location specifying condition storage unit 112.

(ステップS208)可読性向上処理手段1221は、i番目の基本ブロックがj番目の箇所特定条件に合致するか否かを判断する。合致する場合はステップS209に行き、合致しない場合はステップS212に行く。なお、i番目の基本ブロックの一部のアセンブラプログラムがj番目の箇所特定条件に合致する場合も、i番目の基本ブロックがj番目の箇所特定条件に合致するとする。また、i番目の基本ブロックのアセンブラプログラムが変換された中間表現(中間コードと言っても良い)の全部または一部が、j番目の箇所特定条件に合致する場合も、i番目の基本ブロックがj番目の箇所特定条件に合致するとする。   (Step S208) The readability improvement processing unit 1221 determines whether or not the i-th basic block matches the j-th location specifying condition. If they match, go to step S209; otherwise, go to step S212. It should be noted that even if some assembler programs of the i-th basic block match the j-th location specifying condition, the i-th basic block also matches the j-th location specifying condition. In addition, even if all or part of the intermediate representation (which may be called intermediate code) converted from the assembler program of the i-th basic block matches the j-th location specifying condition, the i-th basic block is Assume that the jth location specifying condition is met.

(ステップS209)可読性向上処理手段1221は、j番目の箇所特定条件に合致する箇所を対象として、j番目の箇所特定条件に対応する処理を行い、当該合致する箇所に対応する他言語のプログラムを取得する。   (Step S209) The readability improvement processing unit 1221 performs a process corresponding to the jth location specifying condition for a location that matches the jth location specifying condition, and executes a program in another language corresponding to the matched location. get.

(ステップS210)出力情報構成部124等は、出力情報構成処理を行う。出力情報構成処理について、図4のフローチャートを用いて説明する。   (Step S210) The output information configuration unit 124 etc. performs output information configuration processing. The output information configuration process will be described with reference to the flowchart of FIG.

(ステップS211)出力部13は、ステップS210で構成された出力情報を出力する。   (Step S211) The output unit 13 outputs the output information configured in step S210.

(ステップS212)可読性向上処理手段1221は、i番目の基本ブロックのすべてが、他言語のプログラムに変換されたか否かを判断する。i番目の基本ブロックのすべてが変換された場合はステップS213に行き、i番目の基本ブロックにおいて未変換の箇所を含む場合はステップS214に行く。   (Step S212) The readability improvement processing unit 1221 determines whether or not all the i-th basic block has been converted into a program in another language. If all i-th basic blocks have been converted, the process goes to step S213. If the i-th basic block includes an unconverted part, the process goes to step S214.

(ステップS213)変換部122は、カウンタiを1、インクリメントする。ステップS204に戻る。   (Step S213) The converter 122 increments the counter i by one. The process returns to step S204.

(ステップS214)可読性向上処理手段1221は、カウンタjを1、インクリメントする。ステップS206に戻る。   (Step S214) The readability improvement processing unit 1221 increments the counter j by 1. The process returns to step S206.

(ステップS215)変換部122は、カウンタkに1を代入する。   (Step S215) The conversion unit 122 substitutes 1 for the counter k.

(ステップS216)変換部122は、変換情報格納部113にk番目の変換情報が存在するか否を判断する。k番目の変換情報が存在する場合はステップS217に行き、k番目の変換情報が存在しない場合はステップS223に行く。   (Step S216) The conversion unit 122 determines whether or not the k-th conversion information exists in the conversion information storage unit 113. If the k-th conversion information exists, the process goes to step S217. If the k-th conversion information does not exist, the process goes to step S223.

(ステップS217)変換部122は、i番目の基本ブロックがk番目の変換情報に対応するか否かを判断する。i番目の基本ブロックがk番目の変換情報に対応する場合はステップS218に行き、対応しない場合はステップS222に行く。なお、i番目の基本ブロックがk番目の変換情報に対応することは、i番目の基本ブロックの中に、変換情報が有するアセンブラパターン情報に合致するアセンブラプログラムを少なくとも一部に含むことである。   (Step S217) The conversion unit 122 determines whether or not the i-th basic block corresponds to the k-th conversion information. If the i-th basic block corresponds to the k-th conversion information, the process goes to step S218, and if not, the process goes to step S222. The fact that the i-th basic block corresponds to the k-th conversion information means that the ith basic block includes at least a part of an assembler program that matches the assembler pattern information included in the conversion information.

(ステップS218)変換部122は、k番目の変換情報を用いて、k番目の変換情報に対応するアセンブラプログラムを、他言語のプログラムに変換する。変換部122は、例えば、k番目の変換情報に対応するアセンブラプログラムを、k番目の変換情報が有する他言語パターン情報を用いて、他言語のプログラムを取得する。   (Step S218) The conversion unit 122 converts the assembler program corresponding to the kth conversion information into a program in another language using the kth conversion information. The conversion unit 122 acquires, for example, an assembler program corresponding to the kth conversion information, using another language pattern information included in the kth conversion information, and a program in another language.

(ステップS219)出力情報構成部124等は、出力情報構成処理を行う。出力情報構成処理について、図4のフローチャートを用いて説明する。   (Step S219) The output information configuration unit 124 and the like perform output information configuration processing. The output information configuration process will be described with reference to the flowchart of FIG.

(ステップS220)出力部13は、ステップS219で構成された出力情報を出力する。   (Step S220) The output unit 13 outputs the output information configured in step S219.

(ステップS221)変換部122は、i番目の基本ブロックに含まれるすべてのアセンブラプログラムの変換が完了したか否かを判断する。i番目の基本ブロックの変換が完了した場合はステップS213に行き、変換が完了していない場合はステップS222に行く。   (Step S221) The conversion unit 122 determines whether or not conversion of all assembler programs included in the i-th basic block has been completed. When the conversion of the i-th basic block is completed, the process goes to step S213, and when the conversion is not completed, the process goes to step S222.

(ステップS222)変換部122は、カウンタkを1、インクリメントする。ステップS216に戻る。   (Step S222) The conversion unit 122 increments the counter k by 1. The process returns to step S216.

(ステップS223)出力部13は、i番目の基本ブロックの中に変換できないプログラムが存在する旨のエラーを出力する。ステップS213に行く。   (Step S223) The output unit 13 outputs an error indicating that there is a program that cannot be converted in the i-th basic block. Go to step S213.

なお、図2のフローチャートにおいて、原ソースがアセンブラ言語以外の他言語のプログラムを含む場合、当該他言語のプログラムも、マイグレーションのために変換することは好適である。かかる変換処理は、例えば、特許第4354514号、特許第4698943号、特許第5124660号、特許第5253115号等に記載の公知技術等を用いて、行うことができる。   In the flowchart of FIG. 2, when the source source includes a program in another language other than the assembler language, it is preferable to convert the program in the other language for migration. Such conversion processing can be performed using, for example, known techniques described in Japanese Patent No. 4354514, Japanese Patent No. 4698943, Japanese Patent No. 5124660, Japanese Patent No. 5253115, and the like.

次に、ステップS202の静的解析処理の一例について、図3のフローチャートを用いて説明する。なお、静的解析処理は、ここでは、基本ブロックの範囲を確定する処理と、基本ブロック間のリンクを生成する処理と、実行され得ないプログラムの箇所を特定するための処理である。   Next, an example of the static analysis process in step S202 will be described using the flowchart of FIG. Here, the static analysis process is a process for determining a range of basic blocks, a process for generating a link between basic blocks, and a process for specifying a location of a program that cannot be executed.

(ステップS301)変換部122は、カウンタiに1、カウンタjに1を代入する。   (Step S301) The conversion unit 122 substitutes 1 for the counter i and 1 for the counter j.

(ステップS302)変換部122は、ステップS201で取得されたアセンブラプログラムの中の命令であり、次に実行され得るi番目の命令が存在するか否かを判断する。i番目の命令が存在する場合はステップS303に行き、i番目の命令が存在しない場合はステップS311に行く。   (Step S302) The conversion unit 122 determines whether there is an i-th instruction that can be executed next, which is an instruction in the assembler program acquired in Step S201. If the i-th instruction exists, the process goes to step S303, and if the i-th instruction does not exist, the process goes to step S311.

(ステップS303)変換部122は、i番目の命令は分岐命令であるか否かを判断する。分岐命令である場合はステップS307に行き、分岐命令でない場合はステップS304に行く。   (Step S303) The conversion unit 122 determines whether or not the i-th instruction is a branch instruction. If it is a branch instruction, the process goes to step S307, and if it is not a branch instruction, the process goes to step S304.

(ステップS304)変換部122は、i番目の命令に対して、他の命令から分岐されてくる可能性があるか否か(ジャンプの先として指定されている命令が存在するか否か)を判断する。他の命令から分岐されてくる可能性がある場合はステップS307に行き、他の命令から分岐されてくる可能性がない場合はステップS305に行く。   (Step S304) The conversion unit 122 determines whether there is a possibility of branching from another instruction with respect to the i-th instruction (whether there is an instruction specified as a jump destination). to decide. If there is a possibility of branching from another instruction, the process goes to step S307, and if there is no possibility of branching from another instruction, the process goes to step S305.

(ステップS305)変換部122は、i番目をバッファに配置する。なお、バッファは、基本ブロックを作り出すためのワーク用の記憶領域である。   (Step S305) The conversion unit 122 places the i-th in the buffer. The buffer is a work storage area for creating a basic block.

(ステップS306)変換部122は、カウンタiを1、インクリメントする。ステップS302に戻る。   (Step S306) The conversion unit 122 increments the counter i by 1. The process returns to step S302.

(ステップS307)変換部122は、バッファ内の1以上の命令群をj番目の基本ブロックとする処理を行う。かかる処理は、例えば、基本ブロックを構成する1以上の命令に対して、「j」を付加したり、「j」をリンク付けたり、基本ブロックを構成する1以上の命令を他と区別してバッファに格納したりすること等である。なお、バッファ内に命令を有しない場合は、何らの処理も行わず、ステップS305に戻る。   (Step S307) The conversion unit 122 performs a process of setting one or more instruction groups in the buffer as the jth basic block. Such processing includes, for example, adding “j” to one or more instructions constituting a basic block, linking “j”, or distinguishing one or more instructions constituting a basic block from others. Or storing it in If there is no instruction in the buffer, no processing is performed and the process returns to step S305.

(ステップS308)変換部122は、j番目の基本ブロックからのリンク先が存在する場合、当該リンク先の基本ブロックの識別子を、j番目の基本ブロックに付加する。かかる処理は、基本ブロック間の制御フローが判断され得る情報を構成する処理であれば、何でも良い。   (Step S308) When there is a link destination from the jth basic block, the conversion unit 122 adds the identifier of the basic block of the link destination to the jth basic block. Such processing may be anything as long as it constitutes information that can determine the control flow between basic blocks.

(ステップS309)変換部122は、バッファ内の命令群を削除する。   (Step S309) The conversion unit 122 deletes the instruction group in the buffer.

(ステップS310)変換部122は、カウンタjを1、インクリメントする。ステップS305に戻る。   (Step S310) The converter 122 increments the counter j by 1. The process returns to step S305.

(ステップS311)変換部122は、未処理の命令(箇所)に未処理を示すフラグを付す。なお、未処理の命令は、実行され得ない命令である。また、未処理の命令は存在しない可能性もあり、かかる場合、本ステップは実行されない。上位処理にリターンする。なお、 なお、図3のフローチャートにおいて、可読性向上処理手段1221は、未処理を示すフラグを付した箇所のアセンブラプログラムを削除することは好適である。   (Step S311) The conversion unit 122 attaches a flag indicating unprocessed to an unprocessed instruction (location). An unprocessed instruction is an instruction that cannot be executed. Further, there is a possibility that an unprocessed instruction does not exist, and in this case, this step is not executed. Return to upper process. In the flowchart of FIG. 3, it is preferable that the readability improvement processing unit 1221 deletes the assembler program at a location with a flag indicating unprocessed.

また、図3のフローチャートにおいて示した静的解析処理は一例であり、異なるアルゴリズムにより、基本ブロックの範囲を確定する処理と、基本ブロック間のリンクを生成する処理と、実行され得ないプログラムの箇所を特定するための処理を行っても良い。   Also, the static analysis process shown in the flowchart of FIG. 3 is an example. The process of determining the basic block range, the process of generating a link between the basic blocks, and the location of the program that cannot be executed by different algorithms. You may perform the process for specifying.

次に、ステップS210、ステップS219の出力情報構成処理について、図4のフローチャートを用いて説明する。   Next, the output information configuration processing in step S210 and step S219 will be described using the flowchart in FIG.

(ステップS401)出力情報構成部124は、カレントの原ソース部品を取得する。なお、カレントの原ソース部品とは、現在、処理対象の原ソース部品である。   (Step S401) The output information configuration unit 124 acquires a current original source part. Note that the current original source part is the original source part to be processed.

(ステップS402)出力情報構成部124は、カレントの目的ソース部品を取得する。なお、カレントの目的ソース部品とは、現在、処理対象の目的ソース部品である。   (Step S <b> 402) The output information configuration unit 124 acquires the current target source part. Note that the current target source component is the target source component to be processed.

(ステップS403)コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件または変換情報に対応するコメント元情報をコメント元情報格納部114から取得する。   (Step S403) The comment acquisition unit 123 acquires comment source information corresponding to the part specifying condition or conversion information used when the target source component is acquired from the comment source information storage unit 114.

(ステップS404)コメント取得部123は、カウンタiに1を代入する。   (Step S404) The comment acquisition unit 123 assigns 1 to the counter i.

(ステップS405)コメント取得部123は、ステップS403で取得したコメント元情報の中に、i番目の変数が存在するか否かを判断する。i番目の変数が存在する場合はステップS406に行き、i番目の変数が存在しない場合はステップS409に行く。   (Step S405) The comment acquisition unit 123 determines whether or not the i-th variable exists in the comment source information acquired in step S403. If the i-th variable exists, the process goes to step S406. If the i-th variable does not exist, the process goes to step S409.

(ステップS406)コメント取得部123は、i番目の変数に対応する文字列を原ソース部品、または目的ソース部品から取得する。   (Step S406) The comment acquisition unit 123 acquires a character string corresponding to the i-th variable from the original source component or the target source component.

(ステップS407)コメント取得部123は、ステップS406で取得した文字列を、ステップS403で取得したコメント元情報の中に代入する。   (Step S407) The comment acquisition unit 123 substitutes the character string acquired in step S406 into the comment source information acquired in step S403.

(ステップS408)コメント取得部123は、カウンタiを1、インクリメントする。ステップS405に戻る。   (Step S408) The comment acquisition unit 123 increments the counter i by 1. The process returns to step S405.

(ステップS409)コメント取得部123は、コメントを取得する。なお、コメントは、ステップS403で取得したコメント元情報、またはコメント元情報の中のすべての変数に文字列が代入された文字列である。   (Step S409) The comment acquisition unit 123 acquires a comment. The comment is a comment source information acquired in step S403 or a character string in which a character string is substituted for all variables in the comment source information.

(ステップS410)出力情報構成部124は、ステップS401で取得した原ソース部品、ステップS402で取得した目的ソース部品、ステップS409で取得されたコメントを有する出力情報を構成する。上位処理にリターンする。   (Step S410) The output information configuration unit 124 configures output information including the original source part acquired in Step S401, the target source part acquired in Step S402, and the comment acquired in Step S409. Return to upper process.

なお、図4のフローチャートのステップS410において、出力情報構成部124は、原ソース部品、目的ソース部品、コメントのうち、2種類の情報を有する出力情報を構成しても良い。   In step S410 of the flowchart of FIG. 4, the output information configuration unit 124 may configure output information having two types of information among the original source part, the target source part, and the comment.

以下、本実施の形態におけるドキュメント生成装置1の具体的な動作について説明する。今、マイグレーション対象のアセンブラプログラムは、IBMアセンブラである。また、目的言語のプログラムはC言語のプログラムである。   Hereinafter, a specific operation of the document generation apparatus 1 according to the present embodiment will be described. Now, the migration target assembler program is the IBM assembler. The target language program is a C language program.

かかる状況において、以下に、6つの具体例を用いて、ドキュメント生成装置1を説明する。具体例1から具体例4は、アセンブラプログラムからC言語のプログラムを生成する場合の処理の例である。具体例5から具体例6は、出力情報を構成し、出力する例である。   In this situation, the document generation apparatus 1 will be described below using six specific examples. Specific examples 1 to 4 are examples of processing when a C language program is generated from an assembler program. Specific examples 5 to 6 are examples in which output information is configured and output.

(具体例1)
具体例1は、第一の可読性向上処理および第二の可読性向上処理の具体例である。具体例1は、ソースパターン情報が、ダミーセクションを示す情報を含む場合であり、かつ退避コードと復帰コードを示す情報を含む場合である。また、具体例1において、範囲条件が、実行され得ないプログラムの範囲を判定するための条件である場合も述べる。つまり、具体例1は、上記の(A−1)、(A−4)、(B−1)に該当する。
(Specific example 1)
Specific example 1 is a specific example of the first readability improving process and the second readability improving process. Specific Example 1 is a case where the source pattern information includes information indicating a dummy section and includes information indicating a save code and a return code. In the first specific example, a case where the range condition is a condition for determining the range of a program that cannot be executed will be described. That is, the specific example 1 corresponds to the above (A-1), (A-4), and (B-1).

今、原ソース格納部111は、図5に示す原ソースを格納している、とする。原ソースは、アセンブラ言語のプログラムの一部である。   Assume that the original source storage unit 111 stores the original source shown in FIG. The original source is part of an assembler language program.

また、箇所特定条件格納部112は、図6に示す箇所特定条件管理表を格納している、とする。箇所特定条件管理表は、「ID」「箇所特定条件」「変換情報」を有する1以上のレコードを格納している。「ID」はレコードを識別する情報である。「箇所特定条件」は、可読性向上処理を行う変換対象の箇所を特定する情報である。「箇所特定条件」は「開始条件」「終了条件」を有しても良い。「開始条件」は「箇所特定条件」に合致する箇所の開始の箇所を特定する条件である。「終了条件」は「箇所特定条件」に合致する箇所の終了の箇所を特定する条件である。つまり、「開始条件」に合致する箇所と「終了条件」に合致する箇所との間の範囲が「箇所特定条件」により特定される範囲である。また、「箇所特定条件」は一つの条件のみでも良い。また、「変換情報」は、「アセンブラ」「他言語」を有し得る。「アセンブラ」「他言語」は、「箇所特定条件」により特定された範囲において、「アセンブラ」に合致する命令や定義に対して、「他言語」に対応する他言語を生成することを意味する。また、「変換情報」は、変化のための処理を記述する情報等でも良い。   Further, it is assumed that the location specifying condition storage unit 112 stores the location specifying condition management table shown in FIG. The location specifying condition management table stores one or more records having “ID”, “location specifying condition”, and “conversion information”. “ID” is information for identifying a record. The “location specifying condition” is information for specifying a conversion target location for performing the readability improving process. The “location specifying condition” may include a “start condition” and an “end condition”. The “start condition” is a condition for specifying the start location of the location that matches the “location specifying condition”. The “end condition” is a condition for specifying the end location of the location that matches the “location specifying condition”. That is, the range between the location that matches the “start condition” and the location that matches the “end condition” is the range specified by the “location specifying condition”. Further, the “location specifying condition” may be only one condition. The “conversion information” may include “assembler” and “other language”. “Assembler” and “other language” mean to generate another language corresponding to “other language” for an instruction or definition that matches “assembler” within the range specified by “location specifying condition”. . The “conversion information” may be information describing processing for change.

図6において、「ID=1」の開始条件「$1_'DSECT'」の「$1」はすべての文字列が合致する。つまり、例えば、アセンブラプログラム「PKTDSECT DSECT」は開始条件「$1_'DSECT'」に合致する。また、「ID=1」の終了条件「'CSECT' or 'DCECT' or 'COM' or 'DXD' or 'END' or プログラムの終末」は文字列「CSECT」または文字列「DSECT」または文字列「COM」または文字列「END」に合致する、またはプログラムの終端である場合に真となる。さらに、アセンブラ「$2 'DS' 'PL'[1-99]」の[1-99]は、1から99のいずれかの数字であり、「$2 'DS' 'PL'[1-99]」は、例えば、「PKT00 DS PL8」が合致する。そして、他言語「'char' $2'['[1-99]'];'」は、例えば、「char PKT00[8];」を生成することを示す。 また、図6の「ID=2」の箇所特定条件「'STM' 数字','数字','$1」は、例えば、「STM 13,12,REGSAVEA」が合致することを示す。つまり、「$1」は任意の文字列に合致する。   In FIG. 6, “$ 1” of the start condition “$ 1_'DSECT '” of “ID = 1” matches all character strings. That is, for example, the assembler program “PKTDSECT DSECT” matches the start condition “$ 1_'DSECT '”. The end condition of “ID = 1” “CSECT” or “DCECT” or “COM” or “DXD” or “END” or the end of the program is the character string “CSECT” or the character string “DSECT” or the character string. True if it matches "COM" or the string "END" or is at the end of the program. Furthermore, [1-99] of the assembler “$ 2 'DS' 'PL' [1-99]” is any number from 1 to 99, and “$ 2 'DS' 'PL' [1-99” ] "Matches, for example," PKT00 DS PL8 ". The other language “'char' $ 2 ′ ['[1-99]']; '” indicates that “char PKT00 [8];” is generated, for example. Further, the location identification condition “'STM” number', 'number', '$ 1' of “ID = 2” in FIG. 6 indicates that, for example, “STM 13,12, REGSAVEA” matches. That is, “$ 1” matches an arbitrary character string.

そして、図6の「ID=2」の変換情報は、「'STM' $レジスタ番号1',' $レジスタ番号2','$1」に合致する命令について、変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号1で特定されるレジスタから$レジスタ番号2で特定されるレジスタのうち、当該合致する命令より前に値が定義されていない(使用されていない)レジスタが存在する場合、当該使用されていないレジスタの退避を行う他言語の命令は生成されないことを示す。当該レジスタは使用されていないからである。なお、上記を言い換えれば、「ID=2」の変換情報は、「'STM' $レジスタ番号1',' $レジスタ番号2','$1」に合致する命令について、変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号1で特定されるレジスタから$レジスタ番号2で特定されるレジスタのうち、当該命令より前に値が定義されている(使用されている)レジスタのみに対して、退避を行う他言語の命令を生成することを示す。   Then, the conversion information of “ID = 2” in FIG. 6 indicates that the variable $ 1 is used to save the register for an instruction that matches “'STM” $ register number 1 ”,“ $ register number 2 ”,“ $ 1 ”. Among the registers specified by $ register number 1 to the register specified by $ register number 1 that point to the address, there is a register whose value is not defined (not used) before the matching instruction. If present, it indicates that an instruction in another language for saving the unused register is not generated. This is because the register is not used. In other words, the conversion information of “ID = 2” indicates that the variable $ 1 is saved in the register for the instruction matching “STM” $ register number 1 ”,“ $ register number 2 ”,“ $ 1 ”. Of the register specified by $ register number 1 to the register specified by $ register number 2, only the register whose value is defined (used) before the instruction Indicates generation of an instruction in another language for saving.

また、図6の「ID=3」の変換情報は、「'LM' $レジスタ番号3',' $レジスタ番号4','$1」内の変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号3で特定されるレジスタから$レジスタ番号4で特定されるレジスタのうち、当該命令より後に値が参照されていない(使用されていない)レジスタが存在する場合、当該使用されていないレジスタの復帰を行う他言語の命令は生成されないことを示す。当該レジスタは使用されていないからである。なお、上記を言い換えれば、「ID=3」の変換情報は、「'LM' $レジスタ番号3',' $レジスタ番号4','$1」内の変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号3で特定されるレジスタから$レジスタ番号4で特定されるレジスタのうち、当該命令より後に値が参照されている(使用されている)レジスタのみに対して、復帰を行う他言語の命令を生成することを示す。   Also, the conversion information of “ID = 3” in FIG. 6 indicates that the variable $ 1 in “'LM” $ register number 3 ′, ′ $ register number 4 ′, ′ $ 1 ”points to the register saving address. And among registers specified by $ register number 3 to $ register number 4, if there is a register whose value is not referenced (not used) after the instruction, it is used. Indicates that no other language instruction that restores a register that has not been generated is generated. This is because the register is not used. In other words, the conversion information of “ID = 3” indicates that the variable $ 1 in “'LM' $ register number 3 ',' $ register number 4 ',' $ 1" indicates the register saving address. Return to only the register that is pointed to and whose value is referenced (used) after the instruction among the registers specified by $ register number 3 to $ register number 4 Indicates that an instruction in another language is performed.

以上に基づいて、ドキュメント生成装置1は、処理を開始した、とする。すると、アセンブラプログラム取得部121は、原ソース格納部111に格納されている原ソースから、図5に示すアセンブラプログラムを取得する。   Based on the above, it is assumed that the document generation device 1 has started processing. Then, the assembler program acquisition unit 121 acquires the assembler program shown in FIG. 5 from the original source stored in the original source storage unit 111.

次に、変換部122は、取得されたアセンブラプログラムに対して、静的解析処理を行う。そして、変換部122は、アセンブラプログラムを基本ブロックに分割する。そして、可読性向上処理手段1221は、未処理の命令(箇所)のアセンブラプログラムを削除する。   Next, the conversion unit 122 performs a static analysis process on the acquired assembler program. Then, the conversion unit 122 divides the assembler program into basic blocks. Then, the readability improvement processing unit 1221 deletes the assembler program of the unprocessed instruction (location).

次に、変換部122は、基本ブロック毎に、C言語に変換する。つまり、可読性向上処理手段1221は、図6の「ID=1」の箇所特定条件を図5のアセンブラプログラムに適用し、当該箇所特定条件に合致するダミーセクションの領域を検知する。そして、「ID=1」の変換情報の各「アセンブラ」に合致する命令や定義を、対応する「他言語」の情報を用いて、C言語に変換する。そして、可読性向上処理手段1221は、アセンブラのダミーセクションの定義を、C言語の構造体の定義に変換する。つまり、可読性向上処理手段1221は、図5の501の箇所のアセンブラプログラムを、図6の「ID=1」のレコードの情報を用いて、図7の701のC言語のプログラムを生成する。   Next, the conversion part 122 converts into C language for every basic block. That is, the readability improvement processing unit 1221 applies the location identification condition of “ID = 1” in FIG. 6 to the assembler program in FIG. 5 and detects a dummy section region that matches the location identification condition. Then, an instruction or definition that matches each “assembler” of the conversion information of “ID = 1” is converted into the C language using the corresponding “other language” information. Then, the readability improvement processing unit 1221 converts the definition of the dummy section of the assembler into the definition of the structure in C language. That is, the readability improvement processing unit 1221 generates the C language program 701 in FIG. 7 by using the assembler program at the location 501 in FIG. 5 and the information of the record of “ID = 1” in FIG.

次に、変換部122は、図6の「ID=2」の箇所特定条件を図5のアセンブラプログラムに適用し、退避コードの領域を検知する。そして、「ID=2」の変換情報に合致するように、退避コードの箇所を削除する。なお、ここで、変数「REGSAVEA」は、退避コードが出現する関数内では使用されていないとする。つまり、可読性向上処理手段1221は、図5の502の箇所のアセンブラプログラムを、図6の「ID=2」のレコードの情報を用いて、図7の702のC言語のプログラム「BB1: ;」を生成する。なお、「BB1:」はラベルである。また、変換部122は、「すべての基本ブロックの先頭にラベルを生成する」という予め決められたルールに従って、「BB1:」を生成する。なお、予め決められたルールは、例えば、変換部122が保持している。   Next, the conversion unit 122 applies the location identification condition of “ID = 2” in FIG. 6 to the assembler program in FIG. 5 to detect a save code area. Then, the portion of the save code is deleted so as to match the conversion information of “ID = 2”. Here, it is assumed that the variable “REGSAVEA” is not used in the function in which the save code appears. That is, the readability improvement processing unit 1221 uses the information in the record of “ID = 2” in FIG. 6 as the assembler program at the location 502 in FIG. 5 and the C language program “BB1:;” in 702 in FIG. Is generated. “BB1:” is a label. Further, the conversion unit 122 generates “BB1:” according to a predetermined rule “generate labels at the beginning of all basic blocks”. For example, the conversion unit 122 holds the predetermined rule.

次に、変換部122は、図6の「ID=3」の箇所特定条件を図5のアセンブラプログラムに適用し、復帰コードの領域を検知する。そして、「ID=3」の変換情報に合致するように、復帰コードの箇所を削除する。なお、ここで、変数「REGSAVEA」は、復帰コードが出現する関数内では使用されていないとする。つまり、可読性向上処理手段1221は、図5の503の箇所のアセンブラプログラムを、図6の「ID=3」のレコードの情報を用いて、図7の703のC言語のプログラム「BB2: ;」を生成する。なお、「BB2:」はラベルである。また、変換部122は、予め決められたルールに従って、「BB2:」を生成する。なお、予め決められたルールは、例えば、変換部122が保持している。   Next, the conversion unit 122 applies the location identification condition “ID = 3” in FIG. 6 to the assembler program in FIG. 5 to detect the return code area. The part of the return code is deleted so as to match the conversion information of “ID = 3”. Here, it is assumed that the variable “REGSAVEA” is not used in the function in which the return code appears. That is, the readability improvement processing unit 1221 uses the information in the record of “ID = 3” in FIG. 6 for the assembler program at the location 503 in FIG. 5 and the C language program “BB2:;” in 703 in FIG. Is generated. “BB2:” is a label. In addition, the conversion unit 122 generates “BB2:” according to a predetermined rule. For example, the conversion unit 122 holds the predetermined rule.

また、次に、ソースパターン情報が、退避コードを示す情報を含む場合の別の例を説明する。   Next, another example in which the source pattern information includes information indicating a save code will be described.

今、原ソース格納部111の原ソースが有するアセンブラプログラムの一命令は、「STM 5,8,SAVE」であったとする。この一命令は、レジスタ5からレジスタ8の内容を退避する命令である。   Assume that one instruction of the assembler program included in the original source in the original source storage unit 111 is “STM 5, 8, SAVE”. This one instruction is an instruction for saving the contents of the register 8 from the register 5.

そして、可読性向上処理手段1221は、この一命令が図5の「ID=2」の箇所特定情報「'STM' $レジスタ番号1',' $レジスタ番号2','$1」に合致する、と判断する。そして、可読性向上処理手段1221は、この一命令を、例えば、レジスタ5(r5)レジスタ6(r6)、レジスタ7(r7)、レジスタ8(r8)の内容を退避する中間表現に変換する。この中間表現は、例えば、以下である。
store(r5,SAVE);
tmp1=SAVE+4;
store(r6,tmp1);
tmp2=SAVE+8;
store(r7,tmp2);
tmp3=SAVE+12;
store(r8,tmp3);
Then, the readability improvement processing means 1221 matches this one instruction with the location identification information “'STM' $ register number 1 ',' $ register number 2 ',' $ 1" of "ID = 2" in FIG. Judge. Then, the readability improvement processing unit 1221 converts this one instruction into, for example, an intermediate representation that saves the contents of the register 5 (r5), register 6 (r6), register 7 (r7), and register 8 (r8). This intermediate representation is, for example:
store (r5, SAVE);
tmp1 = SAVE + 4;
store (r6, tmp1);
tmp2 = SAVE + 8;
store (r7, tmp2);
tmp3 = SAVE + 12;
store (r8, tmp3);

この中間表現は、変数「SAVE」が示すアドレスを先頭として、4バイトずつずらしなから、r5からr8の各レジスタの値を退避する命令群である。   This intermediate expression is an instruction group that saves the values of the registers r5 to r8 without shifting by 4 bytes starting from the address indicated by the variable “SAVE”.

次に、可読性向上処理手段1221は、レジスタ5からレジスタ8のうち、例えば、レジスタ5のみが、当該命令「STM 5,8,SAVE」の前に使用されている、と判断した、とする。   Next, it is assumed that the readability improvement processing unit 1221 determines that, for example, only the register 5 among the registers 5 to 8 is used before the instruction “STM 5, 8, SAVE”.

次に、可読性向上処理手段1221は、上記の中間表現のうち、レジスタ5(r5)の値のみを退避する目的ソースを生成する。つまり、可読性向上処理手段1221は、上記の中間表現から、レジスタ6からレジスタ8の値の退避に対応する命令群「tmp1=SAVE+4; store(r6,tmp1); tmp2=SAVE+8; store(r7,tmp2); tmp3=SAVE+12; store(r8,tmp3);」を削除する。そして、可読性向上処理手段1221は、中間表現「store(r5,SAVE);」を得る。   Next, the readability improvement processing unit 1221 generates a target source that saves only the value of the register 5 (r5) in the above intermediate representation. In other words, the readability improvement processing unit 1221 uses the above-described intermediate representation, the instruction group “tmp1 = SAVE + 4; store (r6, tmp1); tmp2 = SAVE + 8; (r7, tmp2); tmp3 = SAVE + 12; store (r8, tmp3); "is deleted. Then, the readability improvement processing unit 1221 obtains an intermediate expression “store (r5, SAVE);”.

次に、可読性向上処理手段1221は、中間表現「store(r5,SAVE);」を目的ソース「*(unit32_t *)SAVE = r5;」に変換する。そして、可読性向上処理手段1221は、最終的に、C言語のプログラムの命令「*(unit32_t *)SAVE = r5;」を得る。(具体例2)
具体例2も、第一の可読性向上処理の具体例である。具体例2は、ソースパターン情報が、オフセットを持つ戻りであることを示す情報を含む場合である。つまり、具体例2は、上記の(A−2)に該当する。
Next, the readability improvement processing unit 1221 converts the intermediate expression “store (r5, SAVE);” into the target source “* (unit32_t *) SAVE = r5;”. Then, the readability improvement processing unit 1221 finally obtains an instruction “* (unit32_t *) SAVE = r5;” of the C language program. (Specific example 2)
Specific example 2 is also a specific example of the first readability improving process. Specific example 2 is a case where the source pattern information includes information indicating that the return has an offset. That is, the specific example 2 corresponds to the above (A-2).

今、原ソース格納部111の原ソースが有するアセンブラプログラムは、図8に示すアセンブラプログラムである、とする。図8の801の命令は、サブルーチンPROC1の呼び出し命令である。801は、戻り番地(次の命令802)をレジスタ(14で識別されるレジスタ)に保存し、805のPROC1にジャンプするという命令である。また、802は、自分の番地(*)に8バイト足したところ(804の命令)にジャンプすることを示す。さらに、806は、サブルーチンからの戻り命令である。806は、レジスタ14+4(オフセット)の番地(命令803の箇所)にジャンプする命令である。   Assume that the assembler program included in the original source in the original source storage unit 111 is the assembler program shown in FIG. The instruction 801 in FIG. 8 is a call instruction for the subroutine PROC1. An instruction 801 stores the return address (next instruction 802) in a register (register identified by 14) and jumps to PROC1 in 805. Reference numeral 802 denotes a jump to a place (804 instruction) when 8 bytes are added to its own address (*). Reference numeral 806 denotes a return instruction from the subroutine. An instruction 806 jumps to the address of register 14 + 4 (offset) (the position of the instruction 803).

また、格納部11には、図9に示す変換情報管理表が格納されている。変換情報管理表は、「ID」「箇所特定条件」「適用条件」「変換情報」を有するレコードを1以上有する。「ID」は、レコードを識別する情報である。「適用条件」とは、「変換情報」が適用される条件であり、箇所特定条件に追加される条件である。「適用条件」は、箇所特定条件にさらに付加される条件である、と言える。また、「ID=2」の適用条件「$4のサブルーチンの最終部分が「ID=1」の箇所特定条件の場合」とは、変数$4で特定されるサブルーチンの最終部分が「B $1(,$2)」に合致する場合である。また、「ID=2」の変換情報のうち、$ラベルを含む文字列は、任意のラベルが該当し得る。$ラベルに対して、可読性向上処理手段1221は、$ラベルを含む異なる文字列に対して、ユニークなラベルを生成する。なお、2つの$ラベルXは同じラベルに置き換えられる。   The storage unit 11 stores a conversion information management table shown in FIG. The conversion information management table has one or more records having “ID”, “location specifying condition”, “application condition”, and “conversion information”. “ID” is information for identifying a record. “Applied condition” is a condition to which “conversion information” is applied, and is a condition added to the location specifying condition. It can be said that the “applicable condition” is a condition further added to the location specifying condition. Also, the application condition “ID = 2” “when the final part of the subroutine of $ 4 is the location specifying condition of“ ID = 1 ”” means that the final part of the subroutine specified by the variable $ 4 is “B $ 1”. (, $ 2) ". In addition, in the conversion information of “ID = 2”, a character string including a $ label can correspond to an arbitrary label. For the $ label, the readability improvement processing unit 1221 generates a unique label for different character strings including the $ label. Two $ labels X are replaced with the same label.

そして、可読性向上処理手段1221は、図8のアセンブラプログラムの中の命令801から命令804が、図9の「ID=2」の箇所特定条件に合致する、と判断する。   Then, the readability improvement processing unit 1221 determines that the instructions 801 to 804 in the assembler program in FIG. 8 match the location specifying condition of “ID = 2” in FIG. 9.

また、可読性向上処理手段1221は、図8のアセンブラプログラムの中の命令805以降のサブルーチンが、図9の「ID=2」の適用条件に合致する、と判断する。   Further, the readability improvement processing unit 1221 determines that the subroutine after the instruction 805 in the assembler program in FIG. 8 matches the application condition of “ID = 2” in FIG. 9.

そして、可読性向上処理手段1221は、図8のアセンブラプログラムの中の命令801から命令806に、図9の「ID=2」の変換情報を適用し、図10の命令1001から命令1006を得る。   Then, the readability improvement processing unit 1221 applies the conversion information “ID = 2” in FIG. 9 to the instructions 801 to 806 in the assembler program in FIG. 8 to obtain the instructions 1006 from the instructions 1001 in FIG.

また、可読性向上処理手段1221は、図8のアセンブラプログラムの中の命令806が、図9の「ID=1」の箇所特定条件に合致する、と判断する。   Further, the readability improvement processing unit 1221 determines that the instruction 806 in the assembler program in FIG. 8 matches the location specifying condition of “ID = 1” in FIG. 9.

そして、可読性向上処理手段1221は、図8のアセンブラプログラムの中の命令806に、図9の「ID=1」の変換情報を適用し、図10の命令1007、命令1008を得る。   Then, the readability improvement processing unit 1221 applies the conversion information “ID = 1” in FIG. 9 to the instruction 806 in the assembler program in FIG. 8 to obtain the instruction 1007 and the instruction 1008 in FIG.

(具体例3)
具体例3も、第一の可読性向上処理の具体例である。具体例3は、ソースパターン情報が、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり含む場合である。つまり、具体例3は、上記の(A−3)に該当する。
(Specific example 3)
Specific example 3 is also a specific example of the first readability improving process. Specific example 3 is a case in which the source pattern information is pattern information for specifying the location of two or more instructions of the assembler that can be converted into a program of another language of one instruction. That is, the specific example 3 corresponds to the above (A-3).

今、箇所特定条件格納部112は、図11に示す箇所特定条件管理表を保持している。図11の箇所特定条件管理表は「ID」「ソースパターン情報」「他言語パターン情報」を有するレコードを1以上格納している。「ID」はレコードを識別する情報である。「ソースパターン情報」はアセンブラの2以上の命令の箇所を特定するためのパターンの情報である。「他言語パターン情報」は、変換する他言語(ここではC言語)のパターンを示す情報である。   Now, the location specifying condition storage unit 112 holds the location specifying condition management table shown in FIG. The location specifying condition management table in FIG. 11 stores one or more records having “ID”, “source pattern information”, and “other language pattern information”. “ID” is information for identifying a record. “Source pattern information” is pattern information for specifying the location of two or more instructions of the assembler. “Other language pattern information” is information indicating a pattern of another language to be converted (here, C language).

図11の「ID=1」のソースパターン情報の「$1」は任意の文字列であり、「$変数」は任意の変数またはレジスタを示す情報である。また、「ID=1」の他言語パターン情報のlength($1)は、文字列$1の長さを示す。   “$ 1” in the source pattern information of “ID = 1” in FIG. 11 is an arbitrary character string, and “$ variable” is information indicating an arbitrary variable or register. The length ($ 1) of the other language pattern information of “ID = 1” indicates the length of the character string $ 1.

また、図11の「ID=2」のソースパターン情報の「$2」は任意の文字であり、「$変数」は任意の変数またはレジスタを示す情報である。   Further, “$ 2” in the source pattern information of “ID = 2” in FIG. 11 is an arbitrary character, and “$ variable” is information indicating an arbitrary variable or register.

また、図11の「ID=3」「ID=4」のソースパターン情報の各「$変数」は、変数の後の数字が異なれば、異なる変数である、とする。   Further, each “$ variable” of the source pattern information of “ID = 3” and “ID = 4” in FIG. 11 is a different variable if the number after the variable is different.

また、原ソース格納部111には、図12に示すアセンブラプログラムが格納されている。とする。   The original source storage unit 111 stores the assembler program shown in FIG. And

かかる場合、可読性向上処理手段1221は、図12の1201の箇所が 図11の「ID=1」のソースパターン情報に合致すると判断し、「ID=1」の他言語パターン情報に従って、1201を図13の1301のC言語に変換する。   In such a case, the readability improvement processing unit 1221 determines that the position 1201 in FIG. 12 matches the source pattern information of “ID = 1” in FIG. 11, and displays 1201 according to the other language pattern information of “ID = 1”. 13 to 1301 C language.

また、可読性向上処理手段1221は、図12の1202の箇所が 図11の「ID=2」のソースパターン情報に合致すると判断し、「ID=2」の他言語パターン情報に従って、1202を図13の1302のC言語に変換する。   Further, the readability improvement processing unit 1221 determines that the portion 1202 in FIG. 12 matches the source pattern information of “ID = 2” in FIG. 11, and sets 1202 in accordance with the other language pattern information of “ID = 2”. To 1302 C language.

また、可読性向上処理手段1221は、図12の1203の箇所が 図11の「ID=3」のソースパターン情報に合致すると判断し、「ID=3」の他言語パターン情報に従って、1203を図13の1303のC言語に変換する。   Further, the readability improvement processing unit 1221 determines that the position 1203 in FIG. 12 matches the source pattern information of “ID = 3” in FIG. 11, and sets 1203 in accordance with the other language pattern information of “ID = 3”. To 1303 C language.

また、可読性向上処理手段1221は、図12の1204の箇所が 図10の「ID=4」のソースパターン情報に合致すると判断し、「ID=4」の他言語パターン情報に従って、1204を図13の1304のC言語に変換する。   Further, the readability improvement processing unit 1221 determines that the position 1204 in FIG. 12 matches the source pattern information of “ID = 4” in FIG. 10, and 1204 is changed according to the other language pattern information of “ID = 4”. To 1304 C language.

以上の処理の結果、可読性向上処理手段1221は、図12のアセンブラプログラムから、図13のC言語のプログラムを得る。   As a result of the above processing, the readability improvement processing unit 1221 obtains the C language program of FIG. 13 from the assembler program of FIG.

なお、可読性向上処理手段1221は、アセンブラプログラムを中間表現に変換し、中間表現からC言語のプログラムを構成しても良い。例えば、可読性向上処理手段1221は、図12の1201のアセンブラ(図14の1401)を、図14の1402の中間表現1に変換する。そして、1402をtree構造にした図が、1403である。そして、可読性向上処理手段1221は、1403のtree構造を、中間表現2の1404のtree構造に変換する。なお、格納部11には、tree構造間の変換のための情報が格納されている、とする。また、1404のtree構造は、1405の中間表現2に対応する。そして、次に、可読性向上処理手段1221は、1405の中間表現2を1406のC言語のプログラムに変換する。なお、tree構造間の変換を行わずに、中間表現1402をC言語に変換した場合、1407のC言語のプログラムとなる。   The readability improvement processing unit 1221 may convert the assembler program into an intermediate representation and configure a C language program from the intermediate representation. For example, the readability improvement processing unit 1221 converts the assembler 1201 in FIG. 12 (1401 in FIG. 14) into the intermediate representation 1 in 1402 in FIG. A diagram 1404 having a tree structure is 1403. Then, the readability improvement processing unit 1221 converts the tree structure 1403 into a tree structure 1404 of the intermediate representation 2. It is assumed that the storage unit 11 stores information for conversion between tree structures. A tree structure 1404 corresponds to the intermediate representation 2 1405. Then, the readability improvement processing unit 1221 converts the intermediate representation 2 1405 into a C language program 1406. When the intermediate representation 1402 is converted into the C language without converting between the tree structures, a C language program 1407 is obtained.

同様に、可読性向上処理手段1221は、図12の1202のアセンブラ(1501)を、図15の1502の中間表現1に変換する。そして、1502をtree構造にした図が、1503である。そして、可読性向上処理手段1221は、1503のtree構造を、中間表現2の1504のtree構造に変換する。なお、1504のtree構造は、1505の中間表現2に対応する。そして、次に、可読性向上処理手段1221は、1505の中間表現2を1506のC言語のプログラムに変換する。なお、1502をC言語に変換した場合、1505となる。   Similarly, the readability improvement processing unit 1221 converts the assembler (1501) of 1202 of FIG. 12 into the intermediate representation 1 of 1502 of FIG. A diagram 1503 having a tree structure is 1503. Then, the readability improvement processing unit 1221 converts the tree structure 1503 into a tree structure 1504 of the intermediate representation 2. The tree structure 1504 corresponds to the intermediate representation 2 1505. Then, the readability improvement processing unit 1221 converts the intermediate expression 2 1505 into a C language program 1506. When 1502 is converted into C language, 1505 is obtained.

(具体例4)
具体例4も、第一の可読性向上処理の具体例である。具体例4は、ソースパターン情報が、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含む場合である。つまり、具体例4は、上記の(A−5)に該当する。
(Specific example 4)
Specific example 4 is also a specific example of the first readability improving process. Specific example 4 is a case where the source pattern information includes information indicating that two or more loops formed by two or more jump instructions overlap each other. That is, the specific example 4 corresponds to the above (A-5).

また、2以上のジャンプ命令が構成する2以上のループの一部が重なっている箇所が、アセンブラプログラムに存在する場合、変換部122は、(1)「ボトムが起点から最も遠いループを優先する」、(2)「ボトムが同じループが複数ある場合、トップが起点から最も近いループを優先する」の方針により、一のループを優先し、当該一のループをジャンプ命令ではなく、他言語のループのプログラムに変更する。   In addition, when a part where two or more loops formed by two or more jump instructions overlap each other exists in the assembler program, the conversion unit 122 (1) gives priority to the loop whose bottom is farthest from the starting point. ”, (2)“ If there are multiple loops with the same bottom, the top gives priority to the loop closest to the starting point ”gives priority to one loop, and this one loop is not a jump instruction, Change to a loop program.

今、変換部122は、アセンブラプログラムを静的解析し、当該アセンブラプログラムが複数(ここでは、4つ)の基本ブロック間のリンク関係を有する、と判断した、とする。そして、変換部122は、図16(a)に示す、b1、b2、b3、b4の4つの基本ブロック間のリンクを示す情報を得た、とする。なお、基本ブロック間のリンク関係とは、基本ブロック間の処理の流れを示しており、一の基本ブロックから出て行く2以上のリンク(矢印)が存在する場合は分岐があることを示す。また、図16の1601、1602はループを構成するリンクである。そして、図16(a)では、(1)「ボトムが起点から最も遠いループを優先する」の条件に従い、1602のループが優先される。つまり、可読性向上処理手段1221は、1602のループを、C言語の、例えば、「while」文に書き換え、goto文を無くす。なお、基本ブロックb3からb1へのリンク1601を構成するgoto命令は、残ることとなる。   Now, it is assumed that the conversion unit 122 statically analyzes the assembler program and determines that the assembler program has a link relationship between a plurality of (here, four) basic blocks. Then, it is assumed that the conversion unit 122 has obtained information indicating links between the four basic blocks b1, b2, b3, and b4 illustrated in FIG. The link relationship between the basic blocks indicates the flow of processing between the basic blocks, and indicates that there is a branch when there are two or more links (arrows) that go out from one basic block. Also, 1601 and 1602 in FIG. 16 are links constituting a loop. In FIG. 16A, the loop of 1602 is prioritized according to the condition of (1) “prioritize the loop whose bottom is farthest from the starting point”. That is, the readability improvement processing unit 1221 rewrites the loop 1602 into a C language “for example” sentence, for example, and eliminates the goto sentence. Note that the goto instruction constituting the link 1601 from the basic block b3 to b1 remains.

さらに具体的には、変換対象のアセンブラプログラムが、図17のプログラムであった、とする。図17において、L0、L1はラベルである。「BE L0」「BE L1」は、ジャンプ命令である。そして、命令1〜命令8は任意の命令である。   More specifically, it is assumed that the assembler program to be converted is the program of FIG. In FIG. 17, L0 and L1 are labels. “BE L0” and “BE L1” are jump instructions. Instructions 1 to 8 are arbitrary instructions.

そして、変換部122は、図17のアセンブラプログラムを静的解析し、当該アセンブラプログラムからb1〜b4の4つの基本ブロックを取得した、とする。   Then, it is assumed that the conversion unit 122 statically analyzes the assembler program in FIG. 17 and acquires four basic blocks b1 to b4 from the assembler program.

そして、変換部122は、2以上のループの一部が重なっている図17の場合に、(1)「ボトムが起点から最も遠いループを優先する」に基づいて、b4のブロックをボトムとするループ(図16の1602のループ)を優先させた場合、変換部122は、図18(a)のプログラムを取得する。そして、b3のブロックをボトムとするループを構成するgoto文1801はそのまま残る。ただし、図18(a)の1801は、ループから飛び出すgoto文であり、可読性の低下度合いは低い。   Then, in the case of FIG. 17 in which a part of two or more loops overlap, the conversion unit 122 sets the block b4 as the bottom based on (1) “priority is given to the loop whose bottom is farthest from the starting point”. When the loop (the loop 1602 in FIG. 16) is prioritized, the conversion unit 122 acquires the program in FIG. Then, the goto statement 1801 constituting the loop with the b3 block as the bottom remains as it is. However, reference numeral 1801 in FIG. 18A denotes a goto statement that jumps out of the loop, and the degree of decrease in readability is low.

一方、仮に、変換部122は、2以上のループの一部が重なっている図17の場合に、b3のブロックをボトムとするループ(図16の1601のループ)を優先させた場合、変換部122は、図18(b)のプログラムを取得する。そして、b4のブロックをボトムとするループを構成するgoto文1802はそのまま残る。そして、図18(b)の1802は、ループへ飛び込むgoto文であり、可読性は著しく低下し、望ましくない。   On the other hand, if the conversion unit 122 prioritizes the loop having the b3 block as the bottom (the loop 1601 in FIG. 16) in the case of FIG. 122 acquires the program of FIG. Then, the goto statement 1802 constituting the loop with the block b4 as the bottom remains as it is. Reference numeral 1802 in FIG. 18B is a goto statement that jumps into the loop, which is not desirable because it significantly reduces readability.

また、変換部122は、上記とは別のアセンブラプログラムを静的解析し、当該アセンブラプログラムが複数(ここでは、4つ)の基本ブロック間のリンク関係を有する、と判断した、とする。そして、変換部122は、図19(a)に示す、t1、t2、t3、t4の4つの基本ブロック間のリンクを示す情報を得た、とする。また、図19の1901、1902はループを構成するリンクである。そして、図19(a)では、(2)「ボトムが同じループが複数ある場合、トップが起点から最も近いループを優先する」の条件に従い、1901のループが優先される。つまり、可読性向上処理手段1221は、1901のループを、C言語の、例えば、「for」文に書き換え、goto文を無くす。なお、基本ブロックt4からt2へのリンク1902を構成するgoto命令は、残ることとなる。   Further, it is assumed that the conversion unit 122 statically analyzes an assembler program different from the above and determines that the assembler program has a link relationship between a plurality (four in this case) of basic blocks. Then, it is assumed that the conversion unit 122 has obtained information indicating links between the four basic blocks t1, t2, t3, and t4 illustrated in FIG. Further, reference numerals 1901 and 1902 in FIG. 19 denote links forming a loop. In FIG. 19A, the loop of 1901 is prioritized according to the condition of (2) “If there are multiple loops with the same bottom, the top gives priority to the loop closest to the starting point”. That is, the readability improvement processing unit 1221 rewrites the 1901 loop into a C language “for” sentence, for example, and eliminates the goto sentence. Note that the goto instruction constituting the link 1902 from the basic block t4 to t2 remains.

さらに具体的には、変換対象のアセンブラプログラムが、図20のプログラムであった、とする。図20において、L0、L1はラベルである。「BE L1」「B L0」は、ジャンプ命令である。そして、命令1〜命令8は任意の命令である。   More specifically, it is assumed that the assembler program to be converted is the program of FIG. In FIG. 20, L0 and L1 are labels. “BE L1” and “B L0” are jump instructions. Instructions 1 to 8 are arbitrary instructions.

そして、変換部122は、図20のアセンブラプログラムを静的解析し、当該アセンブラプログラムからt1〜t4の4つの基本ブロックを取得した、とする。   Then, it is assumed that the conversion unit 122 statically analyzes the assembler program in FIG. 20 and acquires four basic blocks t1 to t4 from the assembler program.

そして、変換部122は、2以上のループの一部が重なっている図20の場合に、(2)「ボトムが同じループが複数ある場合、トップが起点から最も近いループを優先する」に基づいて、t1のブロックをトップとするループ(図19の1901のループ)を優先させた場合、変換部122は、図21(a)のプログラムを取得する。そして、2101内の他のgoto文はそのまま残る。ただし、図21(a)のgoto文の行き先がループ内に存在するので、可読性はあまり低下しない。   Then, in the case of FIG. 20 where two or more loops overlap each other, the conversion unit 122 is based on (2) “If there are multiple loops with the same bottom, the top gives priority to the loop closest to the starting point”. Thus, when priority is given to the loop with the t1 block at the top (the loop of 1901 in FIG. 19), the conversion unit 122 acquires the program of FIG. Then, other goto statements in 2101 remain as they are. However, since the destination of the goto statement in FIG. 21A exists in the loop, readability does not deteriorate much.

一方、仮に、変換部122は、2以上のループの一部が重なっている図20の場合に、t2のブロックをトップとするループ(図19の1902のループ)を優先させた場合、変換部122は、図21(b)のプログラムを取得する。そして、2102内の他のgoto文はそのまま残る。そして、図21(b)のgoto文の行き先は、プログラムの任意の箇所になり得るので、プログラム全体の中から、goto文の行き先を探す必要があり、可読性は著しく減少する。   On the other hand, if the conversion unit 122 prioritizes the loop with the top of the t2 block (loop 1902 in FIG. 19) in the case of FIG. 122 acquires the program shown in FIG. Then, other goto statements in 2102 remain as they are. Since the destination of the goto sentence in FIG. 21B can be an arbitrary part of the program, it is necessary to search for the destination of the goto sentence from the entire program, and the readability is significantly reduced.

なお、変換部122がすべてのgoto文を他言語のループに変換する場合、図22に示すように、トップにt1 とt2 のどちらを選んでも最終的な変換結果は同じになる。ただし、トップにt1 を選んだ方が、計算量が少なくなる。   When the conversion unit 122 converts all goto sentences into loops in other languages, the final conversion result is the same regardless of which t1 or t2 is selected as the top, as shown in FIG. However, the amount of calculation is smaller when t1 is selected at the top.

(具体例5)
今、コメント元情報格納部114は、図23に示すコメント元情報格管理表を格納している、とする。コメント元情報格管理表は、「ID」「コメント元情報」を有する1以上のレコードを格納している。「ID」はレコードを識別する情報である。「コメント元情報」は、文字列または、変数を有する文字列である。また、変数は、変換元のアセンブラプログラムに含まれる文字列が格納され得る変数、または変換後の他言語に含まれる文字列が格納され得る変数である。
(Specific example 5)
Now, it is assumed that the comment source information storage unit 114 stores the comment source information case management table shown in FIG. The comment source information case management table stores one or more records having “ID” and “comment source information”. “ID” is information for identifying a record. “Comment source information” is a character string or a character string having a variable. The variable is a variable that can store a character string included in the conversion source assembler program, or a variable that can store a character string included in another language after conversion.

また、原ソース格納部111は、図5のアセンブラプログラムを格納している、とする。また、箇所特定条件格納部112は、図6に示す箇所特定条件管理表を格納している、とする。   Further, it is assumed that the original source storage unit 111 stores the assembler program of FIG. Further, it is assumed that the location specifying condition storage unit 112 stores the location specifying condition management table shown in FIG.

そして、かかる状況において、ドキュメント生成装置1は、処理を開始した、とする。すると、具体例1で説明したように、変換部122は、アセンブラプログラム501を用いて、C言語のプログラム701を取得する。   In such a situation, it is assumed that the document generation apparatus 1 has started processing. Then, as described in the first specific example, the conversion unit 122 acquires the C language program 701 using the assembler program 501.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム501を取得する。   Next, the output information configuration unit 124 acquires an assembler program 501 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラム701を取得する。   Next, the output information configuration unit 124 acquires a C language program 701 that is the current target source part.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件に対応するコメント元情報「'DSECT用構造体('$1'DSECT_1)'」をコメント元情報管理表から取得する。なお、かかるコメント元情報は、図23の「ID=図6「ID=1」」のコメント元情報である。   Next, the comment acquisition unit 123 manages the comment source information “'DSECT structure (' $ 1 'DSECT_1)'” corresponding to the location specifying condition used when the target source component is acquired. Get from table. The comment source information is the comment source information of “ID = FIG. 6“ ID = 1 ”” in FIG.

次に、コメント取得部123は、取得したコメント元情報が有する変数「$1」に対応する文字列'PKTDSECT'を原ソース部品または目的ソース部品から取得する。   Next, the comment acquisition unit 123 acquires the character string “PKTDSECT” corresponding to the variable “$ 1” included in the acquired comment source information from the original source component or the target source component.

次に、コメント取得部123は、取得した文字列'PKTDSECT'を、取得したコメント元情報の中に代入し、コメント'DSECT用構造体(PKTDSECT)'を得る。   Next, the comment acquisition unit 123 substitutes the acquired character string “PKTDSECT” into the acquired comment source information to obtain a comment “DSECT structure (PKTDSECT)”.

次に、出力情報構成部124は、原ソース部品、目的ソース部品、およびコメントを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having an original source part, a target source part, and a comment.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図24の2401である。なお、図24の2401の出力情報は、「アセンブラ」「C言語」「コメント」の情報を有する。   Next, the output unit 13 outputs the configured output information. An example of such output is 2401 in FIG. Note that the output information 2401 in FIG. 24 includes information on “assembler”, “C language”, and “comment”.

次に、具体例1で説明したように、変換部122は、アセンブラプログラム502を削除する。   Next, as described in the first specific example, the conversion unit 122 deletes the assembler program 502.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム502を取得する。   Next, the output information configuration unit 124 acquires an assembler program 502 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラムを取得しない。変換時に、アセンブラプログラム502は削除され、C言語は生成されないからである。   Next, the output information configuration unit 124 does not acquire the C language program that is the current target source part. This is because the assembler program 502 is deleted at the time of conversion, and the C language is not generated.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件に対応するコメント元情報'退避コードと判定し削除'をコメント元情報管理表から取得する。なお、かかるコメント元情報は、図23の「ID=図6「ID=2」」のコメント元情報である。なお、かかるコメント元情報は、変数を有しないので、コメント元情報はコメント情報である。   Next, the comment acquisition unit 123 acquires the comment source information “determined as a save code and deleted” corresponding to the location specifying condition used when the target source component is acquired from the comment source information management table. This comment source information is the comment source information of “ID = FIG. 6“ ID = 2 ”” in FIG. Since the comment source information does not have a variable, the comment source information is comment information.

次に、出力情報構成部124は、原ソース部品、空の目的ソース部品、およびコメントを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having an original source part, an empty target source part, and a comment.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図24の2402である。   Next, the output unit 13 outputs the configured output information. An example of such output is 2402 in FIG.

次に、具体例1で説明したように、変換部122は、アセンブラプログラム503を削除する。   Next, as described in the first specific example, the conversion unit 122 deletes the assembler program 503.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム503を取得する。   Next, the output information configuration unit 124 acquires an assembler program 503 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラムを取得しない。   Next, the output information configuration unit 124 does not acquire the C language program that is the current target source part.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件に対応するコメント元情報'復帰コードと判定し削除'をコメント元情報管理表から取得する。なお、かかるコメント元情報は、図23の「ID=図6「ID=3」」のコメント元情報である。なお、かかるコメント元情報は、変数を有しないので、コメント元情報はコメント情報である。   Next, the comment acquisition unit 123 acquires comment source information “determined as a return code and deletion” corresponding to the location specifying condition used when the target source component is acquired from the comment source information management table. The comment source information is the comment source information of “ID = FIG. 6“ ID = 3 ”” in FIG. Since the comment source information does not have a variable, the comment source information is comment information.

次に、出力情報構成部124は、原ソース部品、空の目的ソース部品、およびコメントを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having an original source part, an empty target source part, and a comment.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図24の2403である。   Next, the output unit 13 outputs the configured output information. An example of such output is 2403 in FIG.

以上により、図24の出力情報が出力された。なお、出力部13は、通常、図24の出力情報を格納部11に蓄積する。   Thus, the output information of FIG. 24 is output. Note that the output unit 13 normally accumulates the output information of FIG. 24 in the storage unit 11.

(具体例6)
今、コメント元情報格納部114は、図23に示すコメント元情報格管理表を格納している、とする。また、原ソース格納部111は、図12のアセンブラプログラムを格納している、とする。また、箇所特定条件格納部112は、図11に示す箇所特定条件管理表を格納している、とする。
(Specific example 6)
Now, it is assumed that the comment source information storage unit 114 stores the comment source information case management table shown in FIG. Further, it is assumed that the original source storage unit 111 stores the assembler program of FIG. Further, it is assumed that the location specifying condition storage unit 112 stores the location specifying condition management table shown in FIG.

そして、かかる状況において、ドキュメント生成装置1は、処理を開始した、とする。すると、具体例3で説明したように、変換部122は、アセンブラプログラム1201を用いて、C言語のプログラム1301(図13参照)を取得する。   In such a situation, it is assumed that the document generation apparatus 1 has started processing. Then, as described in the specific example 3, the conversion unit 122 acquires the C language program 1301 (see FIG. 13) using the assembler program 1201.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム1101を取得する。   Next, the output information configuration unit 124 acquires an assembler program 1101 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラム1201を取得する。   Next, the output information configuration unit 124 acquires a C language program 1201 which is the current target source part.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件に対応するコメント元情報をコメント元情報管理表から取得する。なお、かかるコメント元情報は、図23の「ID=10「ID=1」」のコメント元情報である。   Next, the comment acquisition unit 123 acquires comment source information corresponding to the location specifying condition used when the target source component is acquired from the comment source information management table. The comment source information is the comment source information of “ID = 10“ ID = 1 ”” in FIG.

次に、コメント取得部123は、取得したコメント元情報が有する変数「ソースパターン情報.すべての第1文字列」に対応する文字列「CLC」「BE」を原ソース部品から取得する。そして、コメント取得部123は、取得した文字列「CLC」「BE」を、コメント元情報の変数「ソースパターン情報.すべての第1文字列」に代入する。   Next, the comment acquisition unit 123 acquires character strings “CLC” and “BE” corresponding to the variable “source pattern information. All first character strings” included in the acquired comment source information from the original source component. Then, the comment acquisition unit 123 substitutes the acquired character strings “CLC” and “BE” for the variable “source pattern information. All first character strings” of the comment source information.

また、コメント取得部123は、取得したコメント元情報が有する変数「他言語パターン情報.1行目の第1文字列」に対応する文字列「if」を目的ソース部品から取得する。そして、コメント取得部123は、取得した文字列「if」を、コメント元情報の変数「他言語パターン情報.1行目の第1文字列」に代入する。   Further, the comment acquisition unit 123 acquires the character string “if” corresponding to the variable “other language pattern information. First character string on the first line” included in the acquired comment source information from the target source component. Then, the comment acquisition unit 123 substitutes the acquired character string “if” into the variable “other language pattern information. First character string in the first line” of the comment source information.

そして、コメント取得部123は、コメント「2以上のアセンブラ命令(CLC,BE)を1つのC言語命令(if)に変換」を得る。なお、ここでは、例えば、コメント取得部123は、複数の取得した文字列「CLC」「BE」を「,」で区切る、とする。   Then, the comment acquisition unit 123 obtains a comment “convert two or more assembler instructions (CLC, BE) into one C language instruction (if)”. Here, for example, the comment acquisition unit 123 divides a plurality of acquired character strings “CLC” and “BE” with “,”.

次に、出力情報構成部124は、原ソース部品、目的ソース部品、およびコメントを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having an original source part, a target source part, and a comment.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図25の2501である。なお、図25において、出力情報ごとに、ラインで区切られている。一方、図24では、出力情報ごとに、ラインで区切られていなかった。つまり、出力情報をライン等で区切るか否かは問わない。   Next, the output unit 13 outputs the configured output information. An example of such output is 2501 in FIG. In FIG. 25, each output information is divided by a line. On the other hand, in FIG. 24, each output information is not separated by a line. That is, it does not matter whether the output information is divided by lines or the like.

次に、変換部122は、アセンブラプログラム1202を用いて、C言語のプログラム1302を取得する。   Next, the conversion unit 122 acquires a C language program 1302 using the assembler program 1202.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム1202を取得する。   Next, the output information configuration unit 124 acquires an assembler program 1202 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラム1302を取得する。   Next, the output information configuration unit 124 acquires a C language program 1302 that is the current target source part.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件または変換情報に対応するコメント元情報をコメント元情報管理表から取得できなかった、とする。つまり、コメント取得部123は、コメントを取得しない。   Next, it is assumed that the comment acquisition unit 123 cannot acquire the comment source information corresponding to the part specifying condition or conversion information used when the target source component is acquired from the comment source information management table. That is, the comment acquisition unit 123 does not acquire a comment.

次に、出力情報構成部124は、原ソース部品、目的ソース部品のみを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having only the original source component and the target source component.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図25の2502である。   Next, the output unit 13 outputs the configured output information. An example of such output is 2502 in FIG.

次に、変換部122は、アセンブラプログラム1203を用いて、C言語のプログラム1303を取得する。   Next, the conversion unit 122 acquires a C language program 1303 using the assembler program 1203.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム1203を取得する。   Next, the output information configuration unit 124 acquires an assembler program 1203 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラム1303を取得する。   Next, the output information configuration unit 124 acquires a C language program 1303 which is the current target source part.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件に対応するコメント元情報をコメント元情報管理表から取得する。なお、かかるコメント元情報は、図23の「図面11「ID=3」」のコメント元情報である。また、取得されたコメント元情報は変数を有さない。つまり、このコメント元情報は、コメント情報である。   Next, the comment acquisition unit 123 acquires comment source information corresponding to the location specifying condition used when the target source component is acquired from the comment source information management table. The comment source information is the comment source information of “drawing 11“ ID = 3 ”” in FIG. The acquired comment source information does not have a variable. That is, this comment source information is comment information.

次に、出力情報構成部124は、原ソース部品、目的ソース部品、およびコメントを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having an original source part, a target source part, and a comment.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図25の2503である。   Next, the output unit 13 outputs the configured output information. An example of such output is 2503 in FIG.

次に、変換部122は、アセンブラプログラム1204を用いて、C言語のプログラム1304を取得する。   Next, the conversion unit 122 acquires a C language program 1304 using the assembler program 1204.

次に、出力情報構成部124は、カレントの原ソース部品であるアセンブラプログラム1204を取得する。   Next, the output information configuration unit 124 acquires an assembler program 1204 that is the current original source part.

次に、出力情報構成部124は、カレントの目的ソース部品であるC言語のプログラム1304を取得する。   Next, the output information configuration unit 124 acquires a C language program 1304 that is the current target source part.

次に、コメント取得部123は、目的ソース部品が取得される際に使用された箇所特定条件または変換情報に対応するコメント元情報をコメント元情報管理表から取得できなかった、とする。つまり、コメント取得部123は、コメントを取得しない。   Next, it is assumed that the comment acquisition unit 123 cannot acquire the comment source information corresponding to the part specifying condition or conversion information used when the target source component is acquired from the comment source information management table. That is, the comment acquisition unit 123 does not acquire a comment.

次に、出力情報構成部124は、原ソース部品、目的ソース部品のみを有する出力情報を構成する。   Next, the output information configuration unit 124 configures output information having only the original source component and the target source component.

次に、出力部13は、構成された出力情報を出力する。かかる出力例は、図25の2504である。   Next, the output unit 13 outputs the configured output information. An example of such output is 2504 in FIG.

なお、本実施の形態の具体例5、6によれば、ドキュメント生成装置1は、アセンブラ、他言語、およびコメントの3種類の情報を対応付けて出力した。しかし、ドキュメント生成装置1は、アセンブラ、他言語、およびコメントの3種類の情報のうち、2種類以上の情報を対応付けて出力すれば良い。また、本実施の形態において、アセンブラ、他言語を出力する場合に、行番号はあってもなくても良い。   According to specific examples 5 and 6 of the present embodiment, the document generation apparatus 1 outputs three types of information, that is, an assembler, another language, and a comment, in association with each other. However, the document generation apparatus 1 may output two or more types of information in association with each other among the three types of information of assembler, other languages, and comments. In this embodiment, when outputting an assembler or another language, there may or may not be a line number.

以上、本実施の形態によれば、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、他言語のプログラムとコメントとを対応付けて出力できる。   As described above, according to the present embodiment, when migration is performed to convert an assembler program into a program in another language, the program in another language and a comment can be output in association with each other.

また、本実施の形態によれば、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、アセンブラプログラムと他言語のプログラムとコメントとを対応付けて出力できる。   Further, according to the present embodiment, when migration is performed to convert an assembler program into another language program, the assembler program, the other language program, and the comment can be output in association with each other.

また、本実施の形態によれば、保守性を考慮した、可読性の高い目的言語のプログラムを生成できる。   Further, according to the present embodiment, it is possible to generate a target language program with high readability in consideration of maintainability.

また、本実施の形態によれば、予め決められたパターンに合致するアセンブラのプログラムを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   Further, according to the present embodiment, an assembler program matching a predetermined pattern can be converted into a target language program with high readability in consideration of maintainability.

また、本実施の形態によれば、アセンブラのプログラムの中のダミーセクションのプログラムを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   Also, according to the present embodiment, the dummy section program in the assembler program can be converted into a target language program with high readability in consideration of maintainability.

また、本実施の形態によれば、アセンブラのプログラムの中のオフセットを持つ戻り処理のプログラムを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   Furthermore, according to the present embodiment, a return processing program having an offset in the assembler program can be converted into a target language program having high readability in consideration of maintainability.

また、本実施の形態によれば、予め決められたパターンに合致する、アセンブラのプログラムの中の2以上の命令からなるプログラムを、保守性を考慮した、可読性の高い目的言語の一命令のプログラムに変換できる。   In addition, according to the present embodiment, a program consisting of two or more instructions in an assembler program that matches a predetermined pattern, and a one-instruction program of a target language with high readability in consideration of maintainability Can be converted to

また、本実施の形態によれば、アセンブラのプログラムの中の退避コードまたは復帰コードを、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   Further, according to the present embodiment, the save code or the return code in the assembler program can be converted into a target language program with high maintainability in consideration of maintainability.

また、本実施の形態によれば、アセンブラのプログラムの中の2以上のループの一部が重なっている箇所を、保守性を考慮した、可読性の高い目的言語のプログラムに変換できる。   Further, according to the present embodiment, a portion where two or more loops in the assembler program overlap each other can be converted into a target language program with high maintainability in consideration of maintainability.

また、本実施の形態によれば、アセンブラのプログラムの中の予め決められた条件を満たす箇所の範囲を特定し、保守性を考慮して、当該範囲に対応する可読性の高い目的言語のプログラムに変換できる。   In addition, according to the present embodiment, a range of locations that satisfy a predetermined condition in an assembler program is identified, and in consideration of maintainability, a program in a target language with high readability corresponding to the range is provided. Can be converted.

また、本実施の形態によれば、静的解析し、到達できない箇所のアセンブラプログラムを削除することにより、可読性の高い目的言語のプログラムを得ることができる。   Further, according to the present embodiment, it is possible to obtain a target language program with high readability by performing static analysis and deleting an assembler program at a location that cannot be reached.

また、本実施の形態によれば、アセンブラプログラム内の変数の生存区間を特定し、当該変数を当該生存区間におけるローカル変数とすることにより、可読性の高い目的言語のプログラムを得ることができる。   Further, according to the present embodiment, a target language program with high readability can be obtained by specifying a life span of a variable in the assembler program and using the variable as a local variable in the life span.

さらに、本実施の形態によれば、アセンブラ以外の言語のプログラムである他言語プログラムと連結して動作するアセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い目的言語のプログラムを生成できる。   Furthermore, according to the present embodiment, when migrating an assembler program that operates in conjunction with another language program that is a language program other than the assembler, the program in the target language with high readability is considered in consideration of maintainability. Can be generated.

なお、本実施の形態における処理は、ソフトウェアで実現しても良い。そして、このソフトウェアをソフトウェアダウンロード等により配布しても良い。また、このソフトウェアをCD−ROMなどの記録媒体に記録して流布しても良い。なお、このことは、本明細書における他の実施の形態においても該当する。なお、本実施の形態におけるドキュメント生成装置1を実現するソフトウェアは、以下のようなプログラムである。つまり、このプログラムにおいて、コンピュータがアクセス可能な記録媒体は、アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、アセンブラのプログラムを他言語のプログラムに変換するための情報である1以上の変換情報を格納し得る変換情報格納部と、前記1以上の変換情報のいずれかの変換情報に対応付けて、コメントの元になるコメント元情報を格納し得るコメント元情報格納部とを具備し、コンピュータを、前記原ソース格納部に格納されている原ソースを構成する一部のプログラムである1以上の各原ソース部品を、前記各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する変換部と、前記変換部が用いた変換情報に対応するコメント元情報を用いてコメントを取得するコメント取得部と、前記変換部が取得した1以上の各目的ソース部品と、当該各目的ソース部品が取得される際に利用された変換情報に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力する出力部として機能させるためのプログラムである。   Note that the processing in the present embodiment may be realized by software. Then, this software may be distributed by software download or the like. Further, this software may be recorded and distributed on a recording medium such as a CD-ROM. This also applies to other embodiments in this specification. Note that the software that implements the document generation apparatus 1 according to the present embodiment is the following program. That is, in this program, the computer-accessible recording medium is an assembler program written in an assembler language, and an original source storage unit that can store an original source as a migration target program, and an assembler program in another language A conversion information storage unit that can store one or more pieces of conversion information that is information for conversion into the above program, and comment source information that is a source of a comment in association with any one of the conversion information of the one or more pieces of conversion information Each of the original source parts, which is a part of a program constituting the original source stored in the original source storage unit. Using the conversion information corresponding to the source part, convert it to a program in another language, A conversion unit that acquires a target source component, a comment acquisition unit that acquires a comment using comment source information corresponding to the conversion information used by the conversion unit, and one or more each acquired by the conversion unit A program for functioning as an output unit that outputs a target source component and a comment acquired using the comment source information corresponding to the conversion information used when each target source component is acquired. is there.

また、上記プログラムにおいて、前記出力部は、前記1以上の各目的ソース部品と、当該各目的ソース部品に対応するコメントと、当該各目的ソース部品の元になった原ソースを構成する原ソース部品とを対応付けて出力するものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the output unit includes the one or more target source parts, a comment corresponding to the target source part, and a source source part constituting the source source from which the target source part is based. Is a program that causes a computer to function.

また、上記プログラムにおいて、前記記録媒体は、原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部をさらに具備し、前記コメント元情報格納部は、前記変換情報に対応付いているコメント元情報に代えて、または前記変換情報に対応付いているコメント元情報に加えて、前記1以上の箇所特定条件のいずれかの箇所特定条件に対応付いたコメント元情報を格納し得、前記変換部は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する原ソース部品に対して、前記合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得する可読性向上処理手段を具備し、前記コメント取得部は、前記可読性向上処理手段が用いた箇所特定条件に対応するコメント元情報を用いてコメントを取得し、前記出力部は、前記変換部が取得した1以上の各目的ソース部品と、当該各目的ソース部品が取得される際に利用された変換情報または箇所特定条件に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力するものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the recording medium may store one or more location specifying conditions that are conditions for specifying a location for performing processing for improving the readability of the program with respect to the original source. The comment source information storage unit further includes the one or more comment source information instead of the comment source information associated with the conversion information or in addition to the comment source information associated with the conversion information. Comment source information associated with any one of the location specifying conditions can be stored, and the conversion unit specifies each of the one or more locations with respect to the original source stored in the original source storage unit. It is a process corresponding to the matching part specifying condition for the original source part corresponding to the matching part specifying condition by applying the condition, and a process for improving the readability of the program. Readability improvement processing means for acquiring a target source part corresponding to the original source part, and the comment acquisition unit is comment source information corresponding to the location specifying condition used by the readability improvement processing means The output unit corresponds to one or more target source parts acquired by the conversion unit and conversion information or location specifying conditions used when the target source parts are acquired. It is preferable that the program causes a computer to function as an output that is associated with a comment acquired using comment source information.

また、上記プログラムにおいて、前記箇所特定条件は、プログラムのパターンに関する情報であるソースパターン情報であり、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する原ソース部品に対して、前記合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得するものとして、コンピュータを機能させるプログラムであることは好適である。   Further, in the program, the location specifying condition is source pattern information that is information relating to a pattern of the program, and the readability improvement processing unit performs the above-described processing on the original source stored in the original source storage unit. Applying each of the above source pattern information to the source source part corresponding to the matching source pattern information, the processing corresponding to the matching source pattern information, and the readability improving process that is a process for improving the readability of the program It is preferable that the program is a program that causes a computer to function as the target source part corresponding to the original source part.

また、上記プログラムにおいて、前記ソースパターン情報は、ダミーセクションを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、ダミーセクションを含む箇所を決定し、当該箇所に対応するプログラムを、構造体を定義するプログラムに変更するものとして、コンピュータを機能させるプログラムであることは好適である。   Further, in the above program, the source pattern information includes information indicating a dummy section, and the readability improvement processing unit performs the one or more source patterns on the original source stored in the original source storage unit. It is preferable that the program is a program that causes a computer to function as a program that applies information, determines a location including a dummy section, and changes a program corresponding to the location to a program that defines a structure.

また、上記プログラムにおいて、前記ソースパターン情報は、オフセットを持つ戻りであることを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む箇所を決定し、当該箇所に対応するプログラムを、当該プログラムに含まれるオフセットを条件に用いた分岐を示すプログラムに変更するものとして、コンピュータを機能させるプログラムであることは好適である。   Further, in the above program, the source pattern information includes information indicating that the return has an offset, and the readability improvement processing unit performs the above-described processing on the original source stored in the original source storage unit with respect to the source Applying each of the above source pattern information, determining a location including a return having an offset, and changing the program corresponding to the location to a program indicating a branch using the offset included in the program as a condition, It is preferable that the program functions a computer.

また、上記プログラムにおいて、前記ソースパターン情報は、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、前記2以上の命令の箇所を決定し、当該箇所に対応するプログラムを、一命令の他言語のプログラムに変換するものとして、コンピュータを機能させるプログラムであることは好適である。   Further, in the above program, the source pattern information is pattern information for specifying a location of two or more instructions of an assembler that can be converted into a program of another language of one instruction. The one or more pieces of source pattern information are applied to the original source stored in the original source storage unit, the location of the two or more instructions is determined, and the program corresponding to the location is replaced with one instruction. It is preferable that the program is a program that allows a computer to function as a program to be converted into a language program.

また、上記プログラムにおいて、前記ソースパターン情報は、退避コードまたは復帰コードを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの箇所を決定し、当該箇所に対応するプログラムを、前記原ソースから削除するものとして、コンピュータを機能させるプログラムであることは好適である。   Further, in the above program, the source pattern information includes information indicating a save code or a return code, and the readability improvement processing unit performs the one or more of the original source stored in the original source storage unit with respect to the original source. It is preferable that each source pattern information is applied, the location of the save code or the return code is determined, and the program corresponding to the location is deleted from the original source so that the computer functions.

また、上記プログラムにおいて、前記ソースパターン情報は、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、当該箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更するものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the source pattern information includes information indicating that two or more loops formed by two or more jump instructions overlap each other, and the readability improvement processing means includes the original source storage unit. The one or more source pattern information is applied to the original source stored in the file, the part where two or more loops overlap is determined, and the program corresponding to the part is determined in advance. It is preferable that a program that causes a computer to function as a program that gives priority to one loop that satisfies the conditions and changes to a program that indicates a loop that does not have a jump instruction.

また、上記プログラムにおいて、前記箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件であり、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、前記合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source, and the readability improvement processing means stores the source source storage. A process corresponding to the matching range condition for a portion corresponding to the matching range condition by applying each of the one or more range conditions to the original source stored in the section, and the readability of the program It is preferable that the program is a program that causes a computer to function as a process for improving readability, which is a process for improving the image quality.

また、上記プログラムにおいて、前記範囲条件は、実行され得ないプログラムの範囲を判定するための条件であり、前記可読性向上処理手段は、前記原ソースを静的解析し、前記合致する範囲条件に対応する箇所のプログラムを特定し、当該プログラムを削除するものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the range condition is a condition for determining a range of the program that cannot be executed, and the readability improvement processing unit statically analyzes the original source and corresponds to the matching range condition. It is preferable that the program that causes the computer to function as the program that identifies the program to be deleted and deletes the program.

また、上記プログラムにおいて、前記範囲条件は、変数を特定するための条件であり、前記可読性向上処理手段は、前記原ソースまたは目的ソースから変数を取得し、当該変数の生存区間を取得し、当該変数を、当該生存区間におけるローカル変数として定義する可読性向上処理を行うものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the range condition is a condition for specifying a variable, and the readability improvement processing unit acquires a variable from the original source or the target source, acquires a life span of the variable, It is preferable that the program causes a computer to function as a program for improving readability in which a variable is defined as a local variable in the life span.

また、上記プログラムにおいて、前記原ソースは、アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであり、コンピュータを、前記原ソースから、アセンブラプログラムを取得するアセンブラプログラム取得部としてさらに機能させ、前記変換部は、前記アセンブラプログラム取得部が取得したアセンブラプログラムを目的ソースに変換するものとして、コンピュータを機能させるプログラムであることは好適である。   In the above program, the original source is a program having an assembler program and another language program that is a program in a language other than the assembler, and the computer is used as an assembler program acquisition unit that acquires the assembler program from the original source. Further, it is preferable that the conversion unit is a program that causes a computer to function as a program that converts the assembler program acquired by the assembler program acquisition unit into a target source.

また、図26は、本明細書で述べたプログラムを実行して、上述した種々の実施の形態のドキュメント生成装置1等を実現するコンピュータの外観を示す。上述の実施の形態は、コンピュータハードウェア及びその上で実行されるコンピュータプログラムで実現され得る。図26は、このコンピュータシステム300の概観図であり、図27は、システム300のブロック図である。   FIG. 26 shows the external appearance of a computer that executes the program described in this specification to realize the document generation apparatus 1 and the like according to the various embodiments described above. The above-described embodiments can be realized by computer hardware and a computer program executed thereon. FIG. 26 is an overview diagram of the computer system 300, and FIG. 27 is a block diagram of the system 300.

図26において、コンピュータシステム300は、CD−ROMドライブ3012を含むコンピュータ301と、キーボード302と、マウス303と、モニタ304とを含む。   In FIG. 26, the computer system 300 includes a computer 301 including a CD-ROM drive 3012, a keyboard 302, a mouse 303, and a monitor 304.

図27において、コンピュータ301は、CD−ROMドライブ3012に加えて、MPU3013と、MPU3013、CD−ROMドライブ3012に接続されたバス3014と、ブートアッププログラム等のプログラムを記憶するためのROM3015と、MPU3013に接続され、アプリケーションプログラムの命令を一時的に記憶するとともに一時記憶空間を提供するためのRAM3016と、アプリケーションプログラム、システムプログラム、及びデータを記憶するためのハードディスク3017とを含む。ここでは、図示しないが、コンピュータ301は、さらに、LANへの接続を提供するネットワークカードを含んでも良い。   27, in addition to the CD-ROM drive 3012, the computer 301 includes an MPU 3013, a bus 3014 connected to the MPU 3013 and the CD-ROM drive 3012, a ROM 3015 for storing programs such as a boot-up program, and an MPU 3013. And a RAM 3016 for temporarily storing instructions of the application program and providing a temporary storage space, and a hard disk 3017 for storing the application program, the system program, and data. Although not shown here, the computer 301 may further include a network card that provides connection to a LAN.

コンピュータシステム300に、上述した実施の形態のドキュメント生成装置1等の機能を実行させるプログラムは、CD−ROM3101に記憶されて、CD−ROMドライブ3012に挿入され、さらにハードディスク3017に転送されても良い。これに代えて、プログラムは、図示しないネットワークを介してコンピュータ301に送信され、ハードディスク3017に記憶されても良い。プログラムは実行の際にRAM3016にロードされる。プログラムは、CD−ROM3101またはネットワークから直接、ロードされても良い。   A program that causes the computer system 300 to execute the functions of the document generation apparatus 1 and the like of the above-described embodiment may be stored in the CD-ROM 3101, inserted into the CD-ROM drive 3012, and further transferred to the hard disk 3017. . Alternatively, the program may be transmitted to the computer 301 via a network (not shown) and stored in the hard disk 3017. The program is loaded into the RAM 3016 at the time of execution. The program may be loaded directly from the CD-ROM 3101 or the network.

プログラムは、コンピュータ301に、上述した実施の形態のドキュメント生成装置1等の機能を実行させるオペレーティングシステム(OS)、またはサードパーティープログラム等は、必ずしも含まなくても良い。プログラムは、制御された態様で適切な機能(モジュール)を呼び出し、所望の結果が得られるようにする命令の部分のみを含んでいれば良い。コンピュータシステム300がどのように動作するかは周知であり、詳細な説明は省略する。   The program does not necessarily include an operating system (OS), a third party program, or the like that causes the computer 301 to execute the functions of the document generation apparatus 1 according to the above-described embodiment. The program only needs to include an instruction portion that calls an appropriate function (module) in a controlled manner and obtains a desired result. How the computer system 300 operates is well known and will not be described in detail.

また、上記プログラムを実行するコンピュータは、単数であってもよく、複数であってもよい。すなわち、集中処理を行ってもよく、あるいは分散処理を行ってもよい。   Further, the computer that executes the program may be singular or plural. That is, centralized processing may be performed, or distributed processing may be performed.

また、上記各実施の形態において、一の装置に存在する2以上の通信手段は、物理的に一の媒体で実現されても良いことは言うまでもない。   Further, in each of the above embodiments, it goes without saying that two or more communication units existing in one apparatus may be physically realized by one medium.

また、上記各実施の形態において、各処理は、単一の装置によって集中処理されることによって実現されてもよく、あるいは、複数の装置によって分散処理されることによって実現されてもよい。   In each of the above embodiments, each process may be realized by centralized processing by a single device, or may be realized by distributed processing by a plurality of devices.

本発明は、以上の実施の形態に限定されることなく、種々の変更が可能であり、それらも本発明の範囲内に包含されるものであることは言うまでもない。   The present invention is not limited to the above-described embodiments, and various modifications are possible, and it goes without saying that these are also included in the scope of the present invention.

以上のように、本発明にかかるドキュメント生成装置は、アセンブラのプログラムを他言語のプログラムに変換するマイグレーションを行う場合に、他言語のプログラムとコメントとを対応付けて出力できるという効果を有し、マイグレーション装置等として有用である。   As described above, the document generation apparatus according to the present invention has an effect that, when performing migration for converting an assembler program into a program in another language, the program in another language and a comment can be output in association with each other. It is useful as a migration device.

1 ドキュメント生成装置
11 格納部
12 処理部
13 出力部
111 原ソース格納部
112 箇所特定条件格納部
113 変換情報格納部
114 コメント元情報格納部
121 アセンブラプログラム取得部
122 変換部
123 コメント取得部
124 出力情報構成部
1221 可読性向上処理手段
DESCRIPTION OF SYMBOLS 1 Document production | generation apparatus 11 Storage part 12 Processing part 13 Output part 111 Original source storage part 112 Location specific condition storage part 113 Conversion information storage part 114 Comment source information storage part 121 Assembler program acquisition part 122 Conversion part 123 Comment acquisition part 124 Output information Configuration unit 1221 Readability improvement processing means

Claims (15)

アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、
アセンブラのプログラムを他言語のプログラムに変換するための情報である1以上の変換情報を格納し得る変換情報格納部と、
前記1以上の変換情報のいずれかの変換情報に対応付けて、コメントの元になるコメント元情報を格納し得るコメント元情報格納部と、
前記原ソース格納部に格納されている原ソースを構成する一部のプログラムである1以上の各原ソース部品を、前記各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する変換部と、
前記変換部が用いた変換情報に対応するコメント元情報を用いてコメントを取得するコメント取得部と、
前記変換部が取得した1以上の各目的ソース部品と、当該各目的ソース部品が取得される際に利用された変換情報に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力する出力部とを具備するドキュメント生成装置。
An assembler program written in an assembler language, an original source storage unit capable of storing an original source that is a program to be migrated, and
A conversion information storage unit that can store one or more conversion information that is information for converting an assembler program into a program in another language;
A comment source information storage unit that can store comment source information that is a source of a comment in association with any one of the one or more pieces of conversion information;
One or more original source parts, which are a part of programs constituting the original source stored in the original source storage unit, are converted into a program in another language using conversion information corresponding to each original source part. A conversion unit that acquires a target source component that is a program in another language for each of one or more conversion targets;
A comment acquisition unit that acquires a comment using comment source information corresponding to the conversion information used by the conversion unit;
One or more target source parts acquired by the conversion unit and a comment acquired using the comment source information corresponding to the conversion information used when the target source parts are acquired are output in association with each other A document generation device.
前記出力部は、
前記1以上の各目的ソース部品と、当該各目的ソース部品に対応するコメントと、当該各目的ソース部品の元になった原ソースを構成する原ソース部品とを対応付けて出力する請求項1記載のドキュメント生成装置。
The output unit is
2. The one or more target source parts, a comment corresponding to each target source part, and an original source part constituting the original source that is the source of each target source part are output in association with each other. Document generation device.
原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部をさらに具備し、
前記変換部は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する原ソース部品に対して、前記合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得する可読性向上処理手段を具備し、
前記コメント元情報格納部は、
前記変換情報に対応付いてるコメント元情報に代えて、または前記変換情報に対応付いてるコメント元情報に加えて、前記1以上の箇所特定条件のいずれかの箇所特定条件に対応付いたコメント元情報を格納し得、
前記コメント取得部は、
前記可読性向上処理手段が用いた箇所特定条件に対応するコメント元情報を用いてコメントを取得し、
前記出力部は、
前記変換部が取得した1以上の各目的ソース部品と、当該各目的ソース部品が取得される際に利用された変換情報または箇所特定条件に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力する請求項1または請求項2記載のドキュメント生成装置。
A location specifying condition storage unit that can store one or more location specifying conditions that are conditions for specifying a location for performing processing for improving the readability of the program with respect to the original source,
The converter is
The one or more part specifying conditions are applied to the original source stored in the original source storage unit, and the matching part specifying condition is applied to the original source part corresponding to the matching part specifying condition. A process for improving readability, which is a corresponding process, and a process for improving the readability of the program, and obtains a target source part corresponding to the original source part;
The comment source information storage unit
Instead of the comment source information associated with the conversion information, or in addition to the comment source information associated with the conversion information, the comment source information associated with any one of the one or more location identification conditions Can store
The comment acquisition unit
Obtaining a comment using comment source information corresponding to the location specifying condition used by the readability improvement processing means;
The output unit is
One or more target source components acquired by the conversion unit, and conversion information used when each target source component is acquired or a comment acquired using comment source information corresponding to the location specifying condition 3. The document generation apparatus according to claim 1, wherein the document generation apparatus outputs the data in association with each other.
前記箇所特定条件は、プログラムのパターンに関する情報であるソースパターン情報であり、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する原ソース部品に対して、前記合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行い、原ソース部品に対応する目的ソース部品を取得する請求項3記載のドキュメント生成装置。
The location specifying condition is source pattern information which is information related to a program pattern,
The readability improvement processing means includes:
The one or more pieces of source pattern information are applied to the original source stored in the original source storage unit, and the matching source pattern information is applied to the source source part corresponding to the matching source pattern information. The document generation apparatus according to claim 3, wherein the target source part corresponding to the original source part is acquired by performing a readability improving process that is a corresponding process and improving the readability of the program.
前記ソースパターン情報は、
ダミーセクションを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、ダミーセクションを含む原ソース部品を決定し、当該原ソース部品を用いて、構造体を定義する目的ソース部品を取得する請求項4記載のドキュメント生成装置。
The source pattern information is
Including information indicating the dummy section,
The readability improvement processing means includes:
The one or more pieces of source pattern information are applied to the original source stored in the original source storage unit, an original source part including a dummy section is determined, and a structure is formed using the original source part. The document generation apparatus according to claim 4, wherein a target source part to be defined is acquired.
前記ソースパターン情報は、
オフセットを持つ戻りであることを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む原ソース部品を決定し、当該原ソース部品を用いて、当該原ソース部品に含まれるオフセットを条件に用いた分岐を示す目的ソース部品を取得する請求項4記載のドキュメント生成装置。
The source pattern information is
Contains information indicating that the return has an offset,
The readability improvement processing means includes:
Applying each of the one or more source pattern information to an original source stored in the original source storage unit, determining an original source part including a return having an offset, and using the original source part, 5. The document generation apparatus according to claim 4, wherein a target source part indicating a branch using an offset included in the original source part as a condition is acquired.
前記ソースパターン情報は、
一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令を有する原ソース部品を特定するためのパターンの情報であり、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、前記2以上の命令を有する原ソース部品を決定し、当該原ソース部品を用いて、一命令の他言語のプログラムである目的ソース部品を取得する請求項4記載のドキュメント生成装置。
The source pattern information is
Pattern information for specifying an original source part having two or more instructions of an assembler that can be converted into a program of another language of one instruction;
The readability improvement processing means includes:
Applying each of the one or more source pattern information to the original source stored in the original source storage unit, determining an original source part having the two or more instructions, using the original source part, The document generation apparatus according to claim 4, wherein a target source component that is a program in another language of one instruction is acquired.
前記ソースパターン情報は、
退避コードまたは復帰コードを示す情報を含み、、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの原ソース部品を決定し、当該原ソース部品に対応するプログラムを、前記原ソースから削除する請求項4記載のドキュメント生成装置。
The source pattern information is
Including information indicating the evacuation code or return code,
The readability improvement processing means includes:
A program corresponding to the original source part is determined by applying the one or more pieces of source pattern information to the original source stored in the original source storage unit, determining an original source part of the save code or return code, and The document generation device according to claim 4, wherein the document generation device is deleted from the original source.
前記ソースパターン情報は、
2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、当該箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更する請求項4記載のドキュメント生成装置。
The source pattern information is
Including information indicating that a part of two or more loops formed by two or more jump instructions overlap,
The readability improvement processing means includes:
A program that applies the one or more pieces of source pattern information to the original source stored in the original source storage unit, determines a place where a part of two or more loops overlap, and corresponds to the place The document generation apparatus according to claim 4, wherein the first priority is given to a loop satisfying a predetermined condition and the program is changed to a program indicating a loop having no jump instruction.
前記箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件であり、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、前記合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う請求項3記載のドキュメント生成装置。
The location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source,
The readability improvement processing means includes:
A process corresponding to the matching range condition for a portion corresponding to the matching range condition by applying each of the one or more range conditions to the source source stored in the source source storage unit The document generation apparatus according to claim 3, wherein a readability improving process that is a process for improving the readability of the program is performed.
前記範囲条件は、
実行され得ないプログラムの範囲を判定するための条件であり、
前記可読性向上処理手段は、
前記原ソースを静的解析し、前記合致する範囲条件に対応する箇所のプログラムを特定し、当該プログラムを削除する請求項10記載のドキュメント生成装置。
The range condition is
It is a condition for determining the range of programs that cannot be executed,
The readability improvement processing means includes:
The document generation apparatus according to claim 10, wherein the original source is statically analyzed, a program corresponding to the matching range condition is specified, and the program is deleted.
前記範囲条件は、
変数を特定するための条件であり、
前記可読性向上処理手段は、
前記原ソースまたは目的ソースから変数を取得し、当該変数の生存区間を取得し、当該変数を、当該生存区間におけるローカル変数として定義する可読性向上処理を行う請求項10記載のドキュメント生成装置。
The range condition is
It is a condition to specify the variable,
The readability improvement processing means includes:
The document generation apparatus according to claim 10, wherein a variable is acquired from the original source or the target source, a life span of the variable is obtained, and readability improvement processing is performed to define the variable as a local variable in the life span.
前記原ソースは、
アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであり、
前記原ソースから、アセンブラプログラムを取得するアセンブラプログラム取得部をさらに具備し、
前記変換部は、
前記アセンブラプログラム取得部が取得したアセンブラプログラムを目的ソースに変換する請求項1から請求項12いずれか一項に記載のドキュメント生成装置。
The original source is
A program having an assembler program and another language program which is a program in a language other than the assembler,
An assembler program acquisition unit for acquiring an assembler program from the original source;
The converter is
The document generation apparatus according to any one of claims 1 to 12, wherein the assembler program acquired by the assembler program acquisition unit is converted into a target source.
記録媒体は、
アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、
アセンブラのプログラムを他言語のプログラムに変換するための情報である1以上の変換情報を格納し得る変換情報格納部と、
前記1以上の変換情報のいずれかの変換情報に対応付けて、コメントの元になるコメント元情報を格納し得るコメント元情報格納部とを具備し、
変換部、コメント取得部、出力部により実現されるドキュメントの生産方法であって、
前記変換部が、前記原ソース格納部に格納されている原ソースを構成する一部のプログラムである1以上の各原ソース部品を、前記各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する変換ステップと、
前記コメント取得部が、前記変換ステップで用いられた変換情報に対応するコメント元情報を用いてコメントを取得するコメント取得ステップと、
前記出力部が、前記変換ステップで取得された1以上の各目的ソース部品と、当該各目的ソース部品が取得される際に利用された変換情報に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力する出力ステップとを具備するキュメントの生産方法。
The recording medium is
An assembler program written in an assembler language, an original source storage unit capable of storing an original source that is a program to be migrated, and
A conversion information storage unit that can store one or more conversion information that is information for converting an assembler program into a program in another language;
A comment source information storage unit that can store comment source information that is a source of a comment in association with any one of the one or more pieces of conversion information;
A document production method realized by a conversion unit, a comment acquisition unit, and an output unit,
The conversion unit uses one or more original source parts, which are a part of programs constituting the original source stored in the original source storage part, by using conversion information corresponding to each original source part. A conversion step of converting into a language program and obtaining a target source component that is a program in another language for each of one or more conversion objects;
The comment acquisition unit acquires a comment using comment source information corresponding to the conversion information used in the conversion step;
Comments acquired by the output unit using one or more target source components acquired in the conversion step and comment source information corresponding to the conversion information used when the target source components are acquired A document production method comprising: an output step for outputting the information in association with each other.
コンピュータがアクセス可能な記録媒体は、
アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、
アセンブラのプログラムを他言語のプログラムに変換するための情報である1以上の変換情報を格納し得る変換情報格納部と、
前記1以上の変換情報のいずれかの変換情報に対応付けて、コメントの元になるコメント元情報を格納し得るコメント元情報格納部とを具備し、
コンピュータを、
前記原ソース格納部に格納されている原ソースを構成する一部のプログラムである1以上の各原ソース部品を、前記各原ソース部品に対応する変換情報を用いて、他言語のプログラムに変換し、1以上の各変換対象ごとに、他言語のプログラムである目的ソース部品を取得する変換部と、
前記変換部が用いた変換情報に対応するコメント元情報を用いてコメントを取得するコメント取得部と、
前記変換部が取得した1以上の各目的ソース部品と、当該各目的ソース部品が取得される際に利用された変換情報に対応するコメント元情報を用いて取得されたコメントとを対応付けて出力する出力部として機能させるためのプログラム。
Computer-accessible recording media
An assembler program written in an assembler language, an original source storage unit capable of storing an original source that is a program to be migrated, and
A conversion information storage unit that can store one or more conversion information that is information for converting an assembler program into a program in another language;
A comment source information storage unit that can store comment source information that is a source of a comment in association with any one of the one or more pieces of conversion information;
Computer
One or more original source parts, which are a part of programs constituting the original source stored in the original source storage unit, are converted into a program in another language using conversion information corresponding to each original source part. A conversion unit that acquires a target source component that is a program in another language for each of one or more conversion targets;
A comment acquisition unit that acquires a comment using comment source information corresponding to the conversion information used by the conversion unit;
One or more target source parts acquired by the conversion unit and a comment acquired using the comment source information corresponding to the conversion information used when the target source parts are acquired are output in association with each other A program for functioning as an output unit.
JP2015188841A 2015-09-25 2015-09-25 Document generation device, generation method for document, and program Pending JP2017062746A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015188841A JP2017062746A (en) 2015-09-25 2015-09-25 Document generation device, generation method for document, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015188841A JP2017062746A (en) 2015-09-25 2015-09-25 Document generation device, generation method for document, and program

Publications (1)

Publication Number Publication Date
JP2017062746A true JP2017062746A (en) 2017-03-30

Family

ID=58428873

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015188841A Pending JP2017062746A (en) 2015-09-25 2015-09-25 Document generation device, generation method for document, and program

Country Status (1)

Country Link
JP (1) JP2017062746A (en)

Similar Documents

Publication Publication Date Title
US8086618B2 (en) Configuration rule translation mapper
US9405518B2 (en) Leveraging legacy applications for use with modern applications
US20200285454A1 (en) System and method for source code translation using stream expressions
US20130152061A1 (en) Full fidelity parse tree for programming language processing
US20150278231A1 (en) System and method for customizing archive of a device driver generator tool for a user
US20090055421A1 (en) Migration and transformation of data structures
US11029924B2 (en) Program optimization by converting code portions to directly reference internal data representations
US20210389977A1 (en) System migration support apparatus, system migration support method and program
US20110209135A1 (en) Program Change Management Apparatus, Computer Readable Record Medium Storing Program Change Management Program, And Program Change Management Method
Klinbua et al. Translating tosca into docker-compose yaml file using antlr
JP2009169864A (en) Compile method and compile program
JP2017062746A (en) Document generation device, generation method for document, and program
JP2017054277A (en) Migration device, creation method of program and program
Kirchhof et al. Variant and product line co-evolution
US10127034B1 (en) System, method, and computer program for delayed evaluation of condition based trees
JP2014228990A (en) Control program creation apparatus and control program creation method
JP2017126176A (en) Migration apparatus, production method of target source, and program
JP5932707B2 (en) Computer, program, and data generation method
JP4405571B1 (en) program
US9792197B2 (en) Apparatus and program
CN109086043A (en) A kind of method and apparatus for quickly generating WEB project based on configuration
JP2015035174A (en) Control program division device, control program division method, and recording medium therefor
US11789727B2 (en) Conversion apparatus, conversion method and program
WO2015030016A1 (en) System for processing unstructured data, method for processing unstructured data, and recording medium
JP2006126886A (en) Learning device for knowledge for shortening sentence, sentence shortening device, machine translating device and computer program for shortening sentence