JPH0954696A - Program generating method and translator, compiler and execution-time library - Google Patents

Program generating method and translator, compiler and execution-time library

Info

Publication number
JPH0954696A
JPH0954696A JP7210308A JP21030895A JPH0954696A JP H0954696 A JPH0954696 A JP H0954696A JP 7210308 A JP7210308 A JP 7210308A JP 21030895 A JP21030895 A JP 21030895A JP H0954696 A JPH0954696 A JP H0954696A
Authority
JP
Japan
Prior art keywords
program
line number
translator
source program
compiler
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
JP7210308A
Other languages
Japanese (ja)
Inventor
Miki Tanaka
美樹 田中
Kazuhiro Aida
一弘 會田
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP7210308A priority Critical patent/JPH0954696A/en
Publication of JPH0954696A publication Critical patent/JPH0954696A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To enable a user to easily judge an error position in an input source program of the translator at the time of debugging. SOLUTION: The translator 10 inputs the source program 100, and adds line number information of the source program 100 to perform conversion into another source program 110. The compiler 20 inputs the source program 110 and generates an object program 120 to which the correspondence relation between the line number information of the input source program 100 of the translator 10 and the line number information of the source program 110 after conversion is added. The execution-time library 30 executes the object program 120 and outputs an execution result 130 including the line number information of the input source program 100 of the translator 10 corresponding to an error position if the error is detected.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、高級言語で記述された
ソースプログラムから他の言語プログラムに変換された
プログラムを入力して機械語の目的プログラムを生成す
る方法、及び、そのためのトランスレータ、コンパイラ
並びに実行時ライブラリに係り、特に、デバッグの容易
化に好適な技術に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for inputting a program converted from a source program written in a high-level language to another language program to generate a machine language target program, and a translator and a compiler therefor. The present invention also relates to a runtime library, and particularly to a technique suitable for facilitating debugging.

【0002】[0002]

【従来の技術】従来は、例えば「FORGE High
Performance Fortran xhpf V
ersion 1.0 User’s Guide Pre
liminary Edition」(Applied
Parallel Research,Dec.199
3)の第3−13頁から第3−14頁に記載のように、
High Performance Fortranソー
スプログラムをFortranプログラムに変換するト
ランスレータにおいては、トランスレータが出力したF
ortranプログラム中に、トランスレータの入力し
たHighPerformance Fortranソ
ースプログラムのライン番号の情報がない。従って、ト
ランスレータが出力したFortranプログラムをコ
ンパイラに入力して目的プログラムを生成し、この目的
プログラムを実行した時、誤りが検出された場合に、誤
りに対するメッセージ情報としてトランスレータの入力
したHigh Performance Fortran
ソースプログラムのライン番号の情報がなく、トランス
レータが出力したFortranプログラムのライン番
号の情報のみのため、利用者は、変換後のプログラムの
実行中に検出された誤りと、利用者がトランスレータに
入力した変換前のHigh Performance F
ortranソースプログラムとの対応付けを行うこと
が困難であった。
2. Description of the Related Art Conventionally, for example, "FORGE High
Performance Fortran xhpf V
version 1.0 User's Guide Pre
minimal Edition "(Applied
Parallel Research, Dec. 199
3) to 3-14 to 3-14,
In a translator that converts a High Performance Fortran source program into a Fortran program, the F output by the translator is
There is no line number information of the High Performance Fortran source program input by the translator in the ortran program. Therefore, when the Fortran program output by the translator is input to the compiler to generate the target program, and when an error is detected when the target program is executed, the High Performance Fortran input by the translator is output as message information for the error.
Since there is no information about the line number of the source program, only the information about the line number of the Fortran program output by the translator, the user has input an error detected during execution of the converted program and the user input to the translator. High Performance F before conversion
It was difficult to associate with the ortran source program.

【0003】[0003]

【発明が解決しようとする課題】上記従来技術は、トラ
ンスレータが、入力ソースプログラムの中の1文を複数
文に展開したり、削除するなどの最適化を行うことによ
って、入力ソースプログラムと出力したプログラムにラ
イン番号のずれが生じる点について配慮されておらず、
コンパイラがトランスレータの出力したライン番号のず
れたプログラムを入力して目的プログラムを生成し、こ
のコンパイラの生成した目的プログラムを実行した時に
誤りが検出された場合、誤りに対するメッセージ情報と
してトランスレータの入力ソースプログラムのライン番
号の情報がないため、利用者は、検出された誤りとトラ
ンスレータの入力ソースプログラムとの対応付けを行う
のが困難であるという問題があった。
In the above prior art, the translator outputs the input source program as an input source program by performing optimization such as expanding one sentence in the input source program into a plurality of sentences or deleting the sentence. No consideration has been given to the fact that the line number shifts in the program,
If an error is detected when the compiler inputs the program with the shifted line numbers output by the translator to generate the target program and executes the target program generated by this compiler, the input source program of the translator is used as message information for the error. Since there is no information on the line number of, the user has a problem that it is difficult to associate the detected error with the input source program of the translator.

【0004】本発明の目的は、コンパイラの生成した目
的プログラムの実行中に検出された誤りに対して、利用
者がトランスレータの入力ソースプログラム及びトラン
スレータの出力プログラム(コンパイラの入力プログラ
ム)に対する誤り位置を容易に判断でき、デバッグ時間
の短縮を図ることにある。
An object of the present invention is to allow a user to determine an error position for an input source program of a translator and an output program of a translator (an input program of a compiler) for an error detected during execution of a target program generated by a compiler. This is to make an easy decision and to reduce the debug time.

【0005】[0005]

【課題を解決するための手段】請求項1の発明は、高級
言語で記述された第1のソースプログラムを他の言語の
第2のソースプログラムに変換し、該第2のソースプロ
グラムから目的プログラム生成する場合、おおもとの第
1のソースプログラムのライン番号の情報を、第2のソ
ースプログラムと目的プログラムに順次伝播して、該第
2のソースプログラム及び目的プログラムに保持するこ
とを特徴とする請求項2の発明は、ソースプログラムを
他の言語プログラムに変換して出力するトランスレータ
において、出力する言語プログラム中に、入力ソースプ
ログラムのライン番号を付加する手段を設けたことを特
徴とする。
According to a first aspect of the present invention, a first source program written in a high-level language is converted into a second source program in another language, and the second source program is used as a target program. When generating, the information of the line number of the original first source program is sequentially propagated to the second source program and the target program, and is held in the second source program and the target program. The invention of claim 2 is characterized in that, in a translator for converting a source program into another language program and outputting the program, a means for adding a line number of the input source program to the language program to be output is provided.

【0006】請求項3の発明は、トランスレータが出力
する言語プログラムを入力して目的プログラムを生成す
るコンパイラにおいて、生成する目的プログラム中にト
ランスレータの入力ソースプログラムのライン番号と、
トランスレータが出力した変換後の言語プログラムのラ
イン番号との対応関係を付加する手段を設けたことを特
徴とする。
According to a third aspect of the present invention, in a compiler for inputting a language program output by a translator to generate a target program, a line number of an input source program of the translator is included in the generated target program.
It is characterized in that means for adding a correspondence relation with the line number of the translated language program output by the translator is provided.

【0007】請求項4の発明は、コンパイラが生成した
目的プログラムの実行を司どる実行時ライブラリにおい
て、目的プログラムの実行時に誤りが検出された場合
に、目的プログラムに付加されているトランスレータの
入力ソースプログラムのライン番号と変換後の言語プロ
グラムのライン番号との対応関係を参照して、誤りが発
生した位置に対する入力ソースプログラムのライン番号
と、変換後の言語プログラムのライン番号とを含む誤り
メッセージ情報を出力する手段を設けたことを特徴とす
る。
According to a fourth aspect of the present invention, in the runtime library that controls the execution of the target program generated by the compiler, when an error is detected during the execution of the target program, the input source of the translator added to the target program. Error message information including the line number of the input source program for the position where the error occurred and the line number of the translated language program by referring to the correspondence between the program line number and the translated language program line number Is provided.

【0008】[0008]

【作用】トランスレータは、出力するソースプログラム
中に入力ソースプログラムのライン番号の情報を埋め込
む。コンパイラは、トランスレータの入力ソースプログ
ラムのライン番号の情報を付加した目的プログラムを生
成する。実行時ライブラリは、誤りが検出された場合、
目的プログラム中のコンパイラと実行時ライブラリのイ
ンタフェース部にあるライン番号設定状態により、目的
プログラムの中にトランスレータの入力ソースプログラ
ムのライン番号の情報があるか否かを判定し、目的プロ
グラムの中にトランスレータの入力ソースプログラムの
ライン番号の情報があると判定すると、トランスレータ
の入力ソースプログラムのライン番号の情報を使用した
メッセージを出力する。
The translator embeds the line number information of the input source program in the output source program. The compiler generates a target program with the line number information of the input source program of the translator added. If the run-time library detects an error,
Based on the line number setting status in the interface part of the compiler and run-time library in the target program, it is determined whether or not the line number information of the input source program of the translator is in the target program, and the translator is included in the target program. If it is determined that there is line number information of the input source program of, the message using the line number information of the input source program of the translator is output.

【0009】[0009]

【実施例】以下、本発明の一実施例を図を参照しつつ詳
細に説明する。なお、実施例では、トランスレータはH
igh Performance Fortranソース
プログラムをFortran90ソースプログラムに変
換する場合を示すが、勿論、本発明はこれに限られるも
のでない。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described in detail below with reference to the drawings. In the embodiment, the translator is H
The case of converting the high performance fortran source program into the fortran 90 source program is shown, but of course, the present invention is not limited to this.

【0010】図1に、本発明の一実施例のトランスレー
タ、コンパイラ、実行時ライブラリの関連図を示す。図
において、トランスレータ10、コンパイラ20および
実行時ライブラリ30は計算機上で動作する。トランス
レータ10は、HighPerformance Fo
rtranソースプログラム100を入力して、For
tran90ソースプログラム110に変換する。コン
パイラ20は、Fortran90ソースプログラム1
10を入力して、目的プログラム120を生成する。目
的プログラム105は、必要に応じて実行時ライブラリ
30を呼び出し、実行結果130を生成する。
FIG. 1 shows a relational diagram of a translator, a compiler and a runtime library according to an embodiment of the present invention. In the figure, a translator 10, a compiler 20, and a runtime library 30 operate on a computer. Translator 10 is High Performance Fo
Enter the rtran source program 100 and enter For
It is converted into the tran90 source program 110. The compiler 20 is a Fortran 90 source program 1
Input 10 to generate the target program 120. The object program 105 calls the runtime library 30 as necessary and generates an execution result 130.

【0011】本発明では、トランスレータ10が入力し
たHigh Performance Fortranソ
ースプログラム100のライン番号の情報を、それぞれ
トランスレータ10、コンパイラ20、実行時ライブラ
リ30の各システムの出力であるFortran90ソ
ースプログラム110、目的プログラム120、実行結
果130に伝搬する。これにより、デバッグを行う時、
利用者は元のHigh Performance For
tranソースプログラム100とトランスレータ1
0、コンパイラ20、実行時ライブラリ30の各システ
ムの出力であるFortran90ソースプログラム1
10、目的プログラム120、実行結果130との対応
付けを容易に判断できる。以下、トランスレータ10、
コンパイラ20、実行時ライブラリ30の詳細動作を説
明する。
In the present invention, the line number information of the High Performance Fortran source program 100 input by the translator 10 is used as the output of the Fortran 90 source program 110, which is the output of each system of the translator 10, the compiler 20, and the runtime library 30, and the target program. 120, and propagates to the execution result 130. As a result, when debugging,
User is the original High Performance For
tran source program 100 and translator 1
0, the compiler 20, and the runtime library 30 are the output of the Fortran90 source program 1 of each system.
The association with 10, the target program 120, and the execution result 130 can be easily determined. Hereinafter, the translator 10,
Detailed operations of the compiler 20 and the runtime library 30 will be described.

【0012】〈トランスレータ〉図2にトランスレータ
10の構成図を示す。トランスレータ10は構文解析部
12と変換部14とからなる。構文解析部12は、Hi
gh Performance Fortranソースプ
ログラム100を入力して、構文解析し中間語105に
変換する。変換部14は、中間語105を入力して、F
ortran90ソースプログラム205を生成する。
この変換部14でFortran90ソースプログラム
110を生成する際、High Performanc
e Fortranソースプログラム100のライン番
号情報を挿入する。
<Translator> FIG. 2 is a block diagram of the translator 10. The translator 10 includes a syntax analysis unit 12 and a conversion unit 14. The parser 12 uses Hi
The gh Performance Fortran source program 100 is input, and is parsed and converted into intermediate language 105. The conversion unit 14 inputs the intermediate word 105 and
The ortran90 source program 205 is generated.
When the conversion unit 14 generates the Fortran 90 source program 110, a High Performance is used.
e Insert the line number information of the Fortran program 100.

【0013】図3に、本発明を適用した変換部14のプ
ログラム生成処理フロー例を示す。変換部14では、入
力ソースプログラムの中間語を入力すると(ステップ1
41)、利用者が外部から与えた情報により、生成する
プログラム中に入力ソースプログラムのライン番号の情
報を挿入するか否かを判定する(ステップ142)。入
力ソースプログラムのライン番号の情報を挿入しないと
判定した場合は、単にソースプログラムを生成する(ス
テップ143)。一方、入力ソースプログラムのライン
番号の情報を、生成するソースプログラム中に挿入する
と判定した場合は、入力ソースプログラムのライン番号
の開始情報の作成(ステップ144)、ソース生成(ス
テップ145)、入力ソースプログラムのライン番号の
終了情報の作成(ステップ146)のルーチンを実行す
る。このステップ144〜146の処理は、入力ソース
プログラムの行単位に繰り返される。なお、ステップ1
44,146で作成する入力ソースプログラムのライン
番号の開始/終了情報は、コンパイラ20において目的
プログラムに変換する際に無視できる表現とする。
FIG. 3 shows an example of a program generation processing flow of the conversion unit 14 to which the present invention is applied. In the conversion unit 14, when an intermediate language of the input source program is input (step 1
41) Based on the information provided from the outside by the user, it is determined whether or not to insert the line number information of the input source program into the program to be generated (step 142). When it is determined that the line number information of the input source program is not inserted, the source program is simply generated (step 143). On the other hand, when it is determined that the line number information of the input source program is to be inserted in the source program to be generated, the start information of the line number of the input source program is created (step 144), the source is generated (step 145), and the input source is generated. The routine for creating the end information of the line number of the program (step 146) is executed. The processing of steps 144 to 146 is repeated for each line of the input source program. In addition, step 1
The start / end information of the line number of the input source program created by 44, 146 is an expression that can be ignored when the compiler 20 converts the line number to the target program.

【0014】図4に、High Performanc
e Fortranソースプログラムの一例を示す。こ
こで、ライン番号5〜7のプログラム部はFORALL
構造と呼ばれ、Fortran90にない構文である。
なお、図4のプログラムは配列計算例であり、READ
文により装置番号5のファイルから変数Nに値を入力
し、FORALL文の指示に従って変数RHSを変数N
で除算し、その結果を配列AのE1要素に代入すること
を示している。FORALL文中のL1は上限値、U1
は下限値、S1は増分値を示し、MASKは代入式A
(E1)=RHS/Nを計算する条件である。
FIG. 4 shows the High Performance.
An example of an eFortran source program is shown. Here, the program part of line numbers 5 to 7 is FORALL
It is called a structure and is a syntax not found in Fortran 90.
The program shown in FIG. 4 is an example of sequence calculation, and READ
Statement, enter a value into the variable N from the file of device number 5, and change the variable RHS to the variable N according to the instruction of the FORALL statement.
It is shown that the result is divided by and the result is substituted into the E1 element of the array A. L1 in the FORALL statement is the upper limit value, U1
Is the lower limit value, S1 is the increment value, and MASK is the substitution formula A.
(E1) = a condition for calculating RHS / N.

【0015】図5は、図4のHigh Perform
ance Fortranソースプログラムを入力した
トランスレータ10が、該入力ソースプログラムのライ
ン番号の情報を、生成するFortran90ソースプ
ログラム中に挿入した場合の出力結果を示したものであ
る。例えば、図4のプログラムにおけるライン番号5及
びライン番号6の各ソースプログラム行は、図5のライ
ン番号9からライン番号16及びライン番号17からラ
イン番号29にそれぞれ対応している。ここで、図5の
プログラム中にある「*LINE START m」及び
「*LINE END m」が、図4の対応するプログラ
ムのライン番号mの開始と終了を表す情報を示してい
る。また、文頭の「*」は、目的プログラムの生成時、
該文頭に「*」の付いている行は無視してよいことを意
味する。なお、図4のプログラムにおけるライン番号7
は、FORALL構造の終了を示し、プログラムの実行
には影響しない文であるため、図5では削除されてい
る。
FIG. 5 is a High Performance of FIG.
FIG. 7 shows an output result when the translator 10 that has input the ance Fortran source program inserts the line number information of the input source program into the generated Fortran 90 source program. For example, each source program line of line number 5 and line number 6 in the program of FIG. 4 corresponds to line number 9 to line number 16 and line number 17 to line number 29 of FIG. 5, respectively. Here, "* LINE START m" and "* LINE END m" in the program of FIG. 5 indicate information indicating the start and end of the line number m of the corresponding program of FIG. In addition, "*" at the beginning of the sentence means that when the target program is generated,
The line with "*" at the beginning of the sentence means that it can be ignored. In addition, line number 7 in the program of FIG.
Indicates the end of the FORALL structure and is a statement that does not affect the execution of the program and is therefore deleted in FIG.

【0016】〈コンパイラ〉図6に、FORTRANコ
ンパイラ20の概略構成図を示す・コンパイラ20は構
文解析部22とコード生成部24からなる。構文解析部
22は、Fortran90ソースプログラム110を
入力して、中間語115に変換する。コード生成部24
は、中間語115を入力して、目的プログラム120を
生成する。
<Compiler> FIG. 6 shows a schematic block diagram of the FORTRAN compiler 20. The compiler 20 comprises a syntax analysis unit 22 and a code generation unit 24. The syntactic analysis unit 22 inputs the Fortran 90 source program 110 and converts it into the intermediate language 115. Code generator 24
Inputs the intermediate language 115 to generate the object program 120.

【0017】図7に、生成する目的プログラム120の
構造例を示す。目的プログラムは命令部122とテーブ
ル部124とインタフェース部126から構成される。
ここで、テーブル部124には、コンパイラの処理単位
である文とコンパイラの入力ソースプログラム上のライ
ン番号の対応を示すライン番号対応テーブル125が存
在する。本発明では、このライン番号対応テーブル12
5に、トランスレータの入力ソースプログラムのライン
番号を設定するフィールドを拡張する。図8に、拡張さ
れたライン番号対応テーブル125の構成例を示す。目
的プログラム中のコンパイラと実行時ライブラリとのイ
ンタフェース部126には、図7に示すように、コンパ
イラの入力ソースプログラムの「*LINE」で始まる
行にトランスレータの入力ソースプログラムのライン番
号の情報があるか否かを示すライン番号設定状態を設け
る。
FIG. 7 shows an example of the structure of the target program 120 to be generated. The target program is composed of a command unit 122, a table unit 124, and an interface unit 126.
Here, in the table section 124, there is a line number correspondence table 125 that shows the correspondence between the statement that is the processing unit of the compiler and the line number on the input source program of the compiler. In the present invention, this line number correspondence table 12
The field for setting the line number of the input source program of the translator is expanded to 5. FIG. 8 shows a configuration example of the extended line number correspondence table 125. In the interface section 126 between the compiler and the runtime library in the target program, as shown in FIG. 7, the line number information of the input source program of the translator is on the line starting with "* LINE" of the input source program of the compiler. A line number setting state indicating whether or not is provided.

【0018】図9に、本発明を適用した場合の図6の構
文解析部22のライン番号の解析処理フロー例を示す。
ライン番号の解析処理では、まず、利用者が外部から与
えた情報により、コンパイラの入力ソースプログラムの
「*LINE」で始まる行の構文解析を行うか否かを判
定する(ステップ211)。「*LINE」で始まる行
の構文解析を行う要求がない場合はステップ222〜2
24をスキップし、次の解析等に進む。一方、「*LI
NE」で始まる行の構文解析を行うと判定した場合、目
的プログラム中のコンパイラと実行時ライブラリとのイ
ンタフェース部126の「*LINE」で始まる行にト
ランスレータの入力ソースプログラムのライン番号の情
報があるか否かを示すライン番号設定状態をライン番号
の情報有りとして(ステップ222)、「*LINE」
で始まる行の構文解析を行い(ステップ223)、目的
プログラム中のテーブル部124のライン番号対応テー
ブル125に、コンパイラの入力ソースプログラムのラ
イン番号に加えて、トランスレータの入力ソースプログ
ラムのライン番号の情報を設定する(ステップ22
4)。
FIG. 9 shows an example of a line number analysis processing flow of the syntax analysis unit 22 of FIG. 6 when the present invention is applied.
In the line number analysis process, first, it is determined whether or not the line beginning with "* LINE" of the input source program of the compiler is parsed based on the information provided by the user (step 211). If there is no request to parse the line starting with "* LINE", steps 222-2
Skip 24 and proceed to the next analysis. On the other hand, "* LI
When it is determined that the line beginning with "NE" is to be parsed, the line number beginning with "* LINE" of the interface 126 between the compiler and the runtime library in the target program contains the line number information of the input source program of the translator. The line number setting state indicating whether or not the line number information is present (step 222), and "* LINE" is set.
The line beginning with "" is parsed (step 223), and the line number correspondence table 125 of the table part 124 in the target program is added to the line number of the input source program of the compiler and the line number information of the input source program of the translator. (Step 22)
4).

【0019】コンパイラ20は、目的プログラムの生成
時、誤りを検出して、該誤りに対してメッセージを出力
する場合、図8に示すライン番号対応テーブル125の
内容により、誤りを検出した文に対応するコンパイラの
入力ソースプログラムのライン番号とトランスレータの
入力ソースプログラムのライン番号を表示することがで
きる。図10は、コンパイラ20が図5のFortra
n90ソースプログラムを入力し、そのコンパイル時に
誤りを検出した時に出力するメッセージの例である。図
10のエラーメッセージリストにおいて、LINE.N
UM欄の表示「31(8)」は、コンパイラの入力ソー
スプログラムのライン番号が31、トランスレータの入
力ソースプログラムのライン番号が8であることを意味
する。即ち、利用者は、デバッグの際、コンパイル時に
検出した誤りが、トランスレータの入力ソースプログラ
ムのライン番号が8に対応していることを容易に判断で
きる。
When the compiler 20 detects an error during the generation of the object program and outputs a message in response to the error, the compiler 20 uses the contents of the line number correspondence table 125 shown in FIG. The line number of the input source program of the compiler and the line number of the input source program of the translator can be displayed. In FIG. 10, the compiler 20 uses the Fortra of FIG.
It is an example of a message output when an n90 source program is input and an error is detected during compilation. In the error message list of FIG. 10, LINE. N
The display “31 (8)” in the UM column means that the line number of the input source program of the compiler is 31, and the line number of the input source program of the translator is 8. That is, at the time of debugging, the user can easily determine that the error detected during compilation corresponds to the line number 8 of the input source program of the translator.

【0020】〈実行時ライブラリ〉図11に、本発明に
よる実行時ライブラリ30の処理例を示す。実行時ライ
ブラリ30は、目的プログラムの実行に必要な各種ソフ
トウェア(これをライブラリという)からなる。いま、
実行制御ライブラリが目的プログラム120の命令部1
22を実行している途中で、誤りを検出した場合、メッ
セージを出力するためにメッセージ出力ライブラリ32
を呼び出す。メッセージ出力ライブラリ32では、メッ
セージ出力部321において、出力するメッセージのテ
キストファイルを作成し、トレースバック出力部322
において、誤りを検出した文番号をキーに目的プログラ
ムのライン番号対応テーブル125を参照して、目的プ
ログラムの誤りが発生した位置に対する情報を作成す
る。
<Runtime Library> FIG. 11 shows a processing example of the runtime library 30 according to the present invention. The runtime library 30 is composed of various software necessary for executing the target program (this is called a library). Now
The execution control library is the instruction part 1 of the target program 120.
When an error is detected during the execution of 22, the message output library 32 is provided to output a message.
Call. In the message output library 32, the message output unit 321 creates a text file of a message to be output, and the traceback output unit 322 is created.
In the above, referring to the line number correspondence table 125 of the target program with the sentence number in which the error is detected as a key, information is created for the position where the error in the target program has occurred.

【0021】図12に、トレースバック出力部322の
トレースバック情報の出力処理フローを示す。図12に
おいて、目的プログラム中のコンパイラと実行時ライブ
ラリとのインタフェース部126にあるライン番号設定
状態127により、参照する目的プログラムのライン番
号対応テーブル125にトランスレータの入力ソースプ
ログラムのライン番号の情報があるか否かを判定する
(ステップ1201)。参照する目的プログラムのライ
ン番号対応テーブル125にトランスレータの入力ソー
スプログラムのライン番号の情報がないと判定した場合
には、単にライン番号対応テーブル125内の該当文番
号のコンパイラ入力ソースプログラムのライン番号を出
力する(ステップ1202)。一方、ライン番号対応テ
ーブル125にトランスレータの入力ソースプログラム
のライン番号の情報をあると判定した場合、ライン番号
対応テーブル125内の該当文番号のコンパイラ入力ソ
ースプログラムのライン番号及びトランスレータ入力ソ
ースプログラムのライン番号を出力する(ステップ12
03)。
FIG. 12 shows an output processing flow of the traceback information of the traceback output unit 322. In FIG. 12, the line number correspondence table 125 of the target program to be referred to has the line number information of the input source program of the translator according to the line number setting state 127 in the interface 126 between the compiler and the runtime library in the target program. It is determined whether or not (step 1201). When it is determined that the line number correspondence table 125 of the target program to be referenced does not have the line number information of the input source program of the translator, the line number of the compiler input source program of the relevant statement number in the line number correspondence table 125 is simply set. Output (step 1202). On the other hand, when it is determined that the line number correspondence table 125 has the line number information of the input source program of the translator, the line number of the compiler input source program and the line of the translator input source program of the corresponding sentence number in the line number correspondence table 125 Output the number (step 12)
03).

【0022】図13は、図5のFortran90ソー
スプログラムについて生成した目的プログラムを実行し
た際、ライン20に対応する文番号の命令実行時に誤り
を検出したときに出力するメッセージの出力例である。
このトレースバック情報において、STM.NO欄の表
示「20(6)」は、コンパイラ20の入力したFor
tran90ソースプログラムのライン番号が20、ト
ランスレータ10の入力したHigh Perform
ance Fortranソースプログラムのライン番
号が6であることを意味する。即ち、デバッグの際、利
用者は、実行時に検出した誤りが、トランスレータ10
の入力ソースプログラムのライン番号が6に対応してい
ることが容易に判断できる。
FIG. 13 shows an output example of a message output when an error is detected when the instruction of the statement number corresponding to the line 20 is executed when the target program generated for the Fortran90 source program of FIG. 5 is executed.
In this traceback information, STM. The display "20 (6)" in the NO column is the For entered by the compiler 20.
The line number of the tran90 source program is 20, and the High Performance entered by the translator 10
The line number of the ance Fortran source program is 6. That is, at the time of debugging, the user can detect that the error
It can be easily determined that the line number of the input source program of 6 corresponds to 6.

【0023】以上、本発明の一実施例について説明した
が、本発明はこれに限定されるものではない。例えば、
トランスレータ10に入力するソースプログラムはHi
ghPerformance Fortranである必
要はなく、また、トランスレータ10から出力するソー
スプログラムもFortran90である必要はない。
また、コンパイラ20で生成する目的プログラムの構造
も図11に示すものである必要はない。要は、トランス
レータ10に入力するソースプログラムのライン番号の
情報が伝搬されていればよい。
Although one embodiment of the present invention has been described above, the present invention is not limited to this. For example,
The source program input to the translator 10 is Hi.
The ghPerformanceFortran does not have to be used, and the source program output from the translator 10 does not need to be the Fortran90.
Further, the structure of the target program generated by the compiler 20 does not have to be the one shown in FIG. In short, it suffices that the line number information of the source program input to the translator 10 is propagated.

【0024】[0024]

【発明の効果】本発明によれば、High Perfo
rmance Fortranソースプログラムなどの
トランスレータに入力される元ソースプログラム中の誤
り位置が、ソースプログラムのコンパイル時や目的プロ
グラムの実行時に明確化されるため、利用者は容易に誤
りの修正を施すことができ、デバッグ時間の短縮化が図
れる効果がある。
According to the present invention, High Perfo
Since the error position in the original source program input to the translator such as the rance Fortran source program is clarified when the source program is compiled or the target program is executed, the user can easily correct the error. There is an effect that the debugging time can be shortened.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の一実施例によるトランスレータ、コン
パイラ、実行時ライブラリの関連図を示す。
FIG. 1 shows an association diagram of a translator, a compiler, and a run-time library according to one embodiment of the present invention.

【図2】本発明の一実施例によるトランスレータの構成
図を示す。
FIG. 2 is a block diagram of a translator according to an embodiment of the present invention.

【図3】本発明の一実施例によるトランスレータのプロ
グラム生成処理フローを示す。
FIG. 3 shows a program generation processing flow of a translator according to an embodiment of the present invention.

【図4】High Performance Fortr
anソースプログラムの一例を示す。
FIG. 4 High Performance Fortr
An example of an source program is shown.

【図5】本発明によるFortran90ソースプログ
ラムの一例を示す。
FIG. 5 shows an example of a Fortran90 source program according to the present invention.

【図6】本発明の一実施例によるFORTRANコンパ
イラの構成図を示す。
FIG. 6 is a block diagram of a FORTRAN compiler according to an embodiment of the present invention.

【図7】目的プログラムの構造の一例を示す。FIG. 7 shows an example of the structure of a target program.

【図8】本発明の一実施例によるライン番号対応テーブ
ルの拡張を示す。
FIG. 8 shows an extension of a line number correspondence table according to an embodiment of the present invention.

【図9】本発明の一実施例によるコンパイラのライン番
号の解析処理フローを示す。
FIG. 9 shows a processing flow of analyzing a line number of a compiler according to an embodiment of the present invention.

【図10】本発明の一実施例によるコンパイル時のメッ
セージ出力例を示す。
FIG. 10 shows an example of message output at the time of compilation according to an embodiment of the present invention.

【図11】本発明の一実施例による実行時ライブラリの
処理説明図を示す。
FIG. 11 shows a processing explanatory diagram of a runtime library according to an embodiment of the present invention.

【図12】本発明の一実施例によるトレースバック情報
の出力処理フローを示す。
FIG. 12 shows an output processing flow of traceback information according to an embodiment of the present invention.

【図13】本発明の一実施例による実行時のメッセージ
出力例を示す。
FIG. 13 shows an example of message output at the time of execution according to an embodiment of the present invention.

【符号の説明】[Explanation of symbols]

10 トランスレータ 20 コンパイラ 30 実行時ライブラリ 100 High Performance Fortr
anソースプログラム 110 Fortran90ソースプログラム 120 目的プログラム 130 実行結果
10 Translator 20 Compiler 30 Runtime Library 100 High Performance Fortr
an source program 110 Fortran90 source program 120 target program 130 execution result

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 高級言語で記述された第1のソースプロ
グラムを他の言語の第2のソースプログラムに変換し、
該第2のソースプログラムから目的プログラム生成する
プログラム生成方法において、前記第1のソースプログ
ラムのライン番号の情報を、前記第2のソースプログラ
ムと前記目的プログラムに順次伝播して、該第2のソー
スプログラム及び目的プログラムに保持することを特徴
とするプログラム生成方法。
1. A first source program written in a high-level language is converted into a second source program in another language,
In a program generation method for generating a target program from the second source program, the line number information of the first source program is sequentially propagated to the second source program and the target program to obtain the second source program. A method of generating a program, which is stored in a program and a target program.
【請求項2】 ソースプログラムを他の言語プログラム
に変換して出力するトランスレータにおいて、出力する
言語プログラム中に、入力ソースプログラムのライン番
号を付加する手段を有することを特徴とするトランスレ
ータ。
2. A translator which converts a source program into another language program and outputs the translated language program, wherein the translator has a means for adding a line number of the input source program to the language program to be output.
【請求項3】 請求項2記載のトランスレータが出力す
る言語プログラムを入力して目的プログラムを生成する
コンパイラにおいて、生成する目的プログラム中に、ト
ランスレータの入力ソースプログラムのライン番号とト
ランスレータが出力した変換後の言語プログラムのライ
ン番号との対応関係を付加する手段を有することを特徴
とするコンパイラ。
3. A compiler for generating a target program by inputting a language program output by the translator according to claim 2, wherein a line number of an input source program of the translator and a conversion output by the translator are included in the generated target program. A compiler having means for adding a correspondence relationship with the line number of the language program of.
【請求項4】 請求項3記載のコンパイラが生成した目
的プログラムの実行を司どる実行時ライブラリにおい
て、目的プログラムの実行時に誤りが検出された場合
に、目的プログラムに付加されているトランスレータの
入力ソースプログラムのライン番号と変換後の言語プロ
グラムのライン番号との対応関係を参照して、誤りが発
生した位置に対する入力ソースプログラムのライン番号
と、変換後の言語プログラムのライン番号とを含む誤り
メッセージ情報を出力する手段を有することを特徴とす
る実行時ライブラリ。
4. The input source of the translator added to the target program when an error is detected during the execution of the target program in the runtime library that controls the execution of the target program generated by the compiler according to claim 3. Error message information including the line number of the input source program for the position where the error occurred and the line number of the translated language program by referring to the correspondence between the program line number and the translated language program line number A runtime library having means for outputting.
JP7210308A 1995-08-18 1995-08-18 Program generating method and translator, compiler and execution-time library Pending JPH0954696A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7210308A JPH0954696A (en) 1995-08-18 1995-08-18 Program generating method and translator, compiler and execution-time library

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7210308A JPH0954696A (en) 1995-08-18 1995-08-18 Program generating method and translator, compiler and execution-time library

Publications (1)

Publication Number Publication Date
JPH0954696A true JPH0954696A (en) 1997-02-25

Family

ID=16587264

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7210308A Pending JPH0954696A (en) 1995-08-18 1995-08-18 Program generating method and translator, compiler and execution-time library

Country Status (1)

Country Link
JP (1) JPH0954696A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011096083A (en) * 2009-10-30 2011-05-12 Nippon Steel Corp Language converting device, language converting method, and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011096083A (en) * 2009-10-30 2011-05-12 Nippon Steel Corp Language converting device, language converting method, and program

Similar Documents

Publication Publication Date Title
JP4822817B2 (en) Compilation system
KR20010106514A (en) Method and system for an extensible macro language
JPH08202545A (en) Object-oriented system and method for generation of target language code
JPS6375835A (en) Apparatus for generating intended code, program, list and design document
JPH05257709A (en) Parallelism discriminating method and parallelism supporting method using the same
JPS61103247A (en) Translation program generation system
JP3972323B2 (en) Schema generation device, data processing device, method thereof, and program
JP2001166949A (en) Method and device for compiling source code by using symbolic execution
JP3196675B2 (en) Language processing method
JPH0954696A (en) Program generating method and translator, compiler and execution-time library
Sasano et al. A text-based syntax completion method using LR parsing and its evaluation
JP3107151B2 (en) Optimized code debugging method
GB2420638A (en) Method of substituting code fragments in Internal Representation
JPH07182179A (en) Object oriented data base managing device
JPS5922140A (en) Interactive compiling system
JP2942414B2 (en) Virtual database method
JP2672968B2 (en) Source list output processing method for debugging
JPH11154093A (en) Program compiler and storage medium recording compiler program
JP2977642B2 (en) FORTRAN compilation processor
JPH05108372A (en) System for outputting compiler optimization processing content
JPH0981411A (en) Compiler
JPH05134854A (en) Software development supporting device
JP3370243B2 (en) Compilation method and apparatus
JPH0922346A (en) Compiler system
JP3196743B2 (en) Apparatus, method and recording medium for generating semantic inspection program