Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPH0695309B2 - Reuse method of intermediate language text - Google Patents
[go: Go Back, main page]

JPH0695309B2 - Reuse method of intermediate language text - Google Patents

Reuse method of intermediate language text

Info

Publication number
JPH0695309B2
JPH0695309B2 JP63305346A JP30534688A JPH0695309B2 JP H0695309 B2 JPH0695309 B2 JP H0695309B2 JP 63305346 A JP63305346 A JP 63305346A JP 30534688 A JP30534688 A JP 30534688A JP H0695309 B2 JPH0695309 B2 JP H0695309B2
Authority
JP
Japan
Prior art keywords
text
intermediate language
storage area
input
reuse
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.)
Expired - Fee Related
Application number
JP63305346A
Other languages
Japanese (ja)
Other versions
JPH02151931A (en
Inventor
幸恵 松田
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP63305346A priority Critical patent/JPH0695309B2/en
Publication of JPH02151931A publication Critical patent/JPH02151931A/en
Publication of JPH0695309B2 publication Critical patent/JPH0695309B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は中間言語テキストの再利用方式に関し、特にコ
ンピュータシステムにおいてコンパイラなどが原始プロ
グラムから目的プログラムを生成する過程で生成される
中間言語テキストの再利用方式に関する。
Description: TECHNICAL FIELD The present invention relates to a method of reusing intermediate language text, and more particularly to a method of reusing intermediate language text generated in the process of a compiler or the like generating an object program from a source program in a computer system. Reuse method.

〔従来の技術〕[Conventional technology]

従来、コンパイラなどが原始プログラムから目的プログ
ラムを生成する過程で生成される中間言語テキストは順
次生成されるのみで、中間言語テキストの再利用は行わ
れていなかった。
Conventionally, intermediate language texts generated in the process of a compiler or the like generating an object program from a source program are only sequentially generated, and the intermediate language texts have not been reused.

〔発明が解決しようとする課題〕[Problems to be Solved by the Invention]

上述した従来の中間言語テキストの生成方式では、原始
プログラム中に同一内容の命令が出現するしないにかか
わらず、中間言語テキストを順次生成しているので、処
理速度が遅いとともに、ファイルやメモリ上などに中間
言語テキストを格納するときに必要となる領域が大きく
なるという欠点がある。
In the conventional intermediate language text generation method described above, the intermediate language texts are sequentially generated regardless of the fact that the same instruction does not appear in the source program. There is a drawback that the area required for storing intermediate language text becomes large.

本発明の目的は、上述の点に鑑み、原始プログラム中に
同一内容の命令が出現したときにすでに生成されている
中間言語テキストを再利用することにより、処理速度を
向上させるとともにファイルやメモリなどを有効に使用
することができるようにした中間言語テキストの再利用
方式を提供することにある。
In view of the above-mentioned point, an object of the present invention is to improve the processing speed by reusing the intermediate language text that has already been generated when an instruction of the same content appears in the source program, and to improve the file and memory. It is to provide a method of reusing intermediate language texts that enables effective use of.

〔課題を解決するための手段〕[Means for Solving the Problems]

本発明の中間言語テキストの再利用方式は、原始プログ
ラムを入力し解析してトークンに分解しトークン列を内
部形式テキストとして内部形式テキスト格納域に出力す
る原始プログラム解析部と、この原始プログラム解析部
から出力された内部形式テキストを前記内部形式テキス
ト格納域から入力しすでに処理済の内部形式テキストで
ある検索用テキストの中に現在処理テキストのトークン
列と同じトークン列をもつ検索用テキストがあるか否か
を検索し、現在処理テキストのトークン列と同じ内容の
トークン列をもつ検索用テキストがない場合には現在処
理テキストのトークン列から中間言語テキストを生成し
て中間言語テキスト格納域に出力しこの中間言語テキス
トが前記中間言語テキスト格納域のどこに格納されたか
を示す格納位置情報を現在処理テキストに対応する内部
形式テキストに中間言語格納位置情報領域として追加
し、現在処理テキストのトークン列と同じ内容のトーク
ン列をもつ検索用テキストがある場合には中間言語テキ
ストを新たには生成せずに検索した検索用テキストに対
応する格納位置情報を前記内部形式テキスト格納域から
取り出しその格納位置情報と中間言語テキストの再利用
を示す情報とを中間言語再利用テキストとして生成して
前記中間言語テキスト格納域に出力し、内部形式テキス
トが終了するまで前記現在処理テキストの入力,検索用
テキストの検索,中間言語テキストの生成および前記中
間言語テキスト格納域への出力ならびに現在処理テキス
トへの格納位置情報の追加を繰り返す中間言語生成部
と、この中間言語生成部により出力された中間言語テキ
ストを前記中間言語テキスト格納域から入力し入力した
中間言語テキストが中間言語再利用テキストであるか否
かを判定し、入力した中間言語テキストが中間言語再利
用テキストでなかった場合には入力した中間言語テキス
トに相当する目的プログラムを生成して目的プログラム
保持部に出力し、入力した中間言語テキストが中間言語
再利用テキストであった場合にはこの中間言語再利用テ
キストから格納位置情報を取り出してこれを用いて前記
中間言語テキスト格納域から順に再利用する中間言語テ
キストを入力し入力した中間言語テキストに相当する目
的プログラムを生成して目的プログラム保持部に出力
し、中間言語テキストが終了するまで前記中間言語テキ
ストの入力,入力した中間言語テキストが中間言語再利
用テキストか否かの判定,中間言語テキストに相当する
目的プログラムの生成または再利用する中間言語テキス
トに相当する目的プログラムの生成および生成した目的
プログラムの前記目的プログラム保持部への出力を繰り
返す目的プログラム生成部と、前記原始プログラム解析
部,前記中間言語生成部および前記目的プログラム生成
部を制御する制御部とを有する。
The intermediate language text reuse method of the present invention is a source program analysis unit that inputs a source program, analyzes it, decomposes it into tokens, and outputs a token string as internal format text to an internal format text storage area, and this source program analysis unit. Is the search text having the same token string as the token string of the currently processed text in the search text which is the internal format text that has already been processed by inputting the internal format text output from the above from the internal format text storage area? If there is no search text that has a token string with the same contents as the token string of the currently processed text, an intermediate language text is generated from the token string of the currently processed text and output to the intermediate language text storage area. Storage location information indicating where the intermediate language text is stored in the intermediate language text storage area. Is added as an intermediate language storage location information area to the internal format text corresponding to the currently processed text, and if there is a search text having a token string with the same content as the token string of the currently processed text, the intermediate language text is newly added. The storage position information corresponding to the search text searched without being generated is extracted from the internal format text storage area, and the storage position information and information indicating reuse of the intermediate language text are generated as an intermediate language reuse text Output to the intermediate language text storage area, input the currently processed text, search text for search, generate intermediate language text, output to the intermediate language text storage area, and output to the currently processed text until the internal format text ends. The intermediate language generator that repeats adding storage location information and the output by this intermediate language generator The intermediate language text is input from the intermediate language text storage area, it is determined whether the input intermediate language text is an intermediate language reuse text, and if the input intermediate language text is not an intermediate language reuse text, Generates a target program corresponding to the input intermediate language text and outputs it to the target program holding unit. If the input intermediate language text is intermediate language reuse text, the storage location information is output from this intermediate language reuse text. The intermediate language text to be reused is sequentially retrieved from the intermediate language text storage area by using this, the target program corresponding to the input intermediate language text is generated and output to the target program holding unit, and the intermediate language text ends. Until the input of the intermediate language text, the input intermediate language text is the intermediate language reuse text Stroke determination, generation of a target program corresponding to intermediate language text or generation of a target program corresponding to reused intermediate language text, and generation of a target program corresponding to the generated target program to the target program holding unit And a control unit that controls the source program analysis unit, the intermediate language generation unit, and the target program generation unit.

〔作用〕[Action]

本発明の中間言語テキストの再利用方式では、原始プロ
グラム解析部が原始プログラムを入力し解析してトーク
ンに分解しトークン列を内部形式テキストとして内部形
式テキスト格納域に出力し、中間言語生成部が原始プロ
グラム解析部から出力された内部形式テキストを内部形
式テキスト格納域から入力しすでに処理済の内部形式テ
キストである検索用テキストの中に現在処理テキストの
トークン列と同じトークン列をもつ検索用テキストがあ
るか否かを検索し、現在処理テキストのトークン列と同
じ内容のトークン列をもつ検索用テキストがない場合に
は現在処理テキストのトークン列から中間言語テキスト
を生成して中間言語テキスト格納域に出力しこの中間言
語テキストが中間言語テキスト格納域のどこに格納され
たかを示す格納位置情報に現在処理テキストに対応する
内部形式テキストに中間言語格納位置情報領域として追
加し、現在処理テキストのトークン列と同じ内容のトー
クン列をもつ検索用テキストがある場合には中間言語テ
キストを新たには生成せずに検索した検索用テキストに
対応する格納位置情報を内部形式テキスト格納域から取
り出しその格納位置情報と中間言語テキストの再利用を
示す情報とを中間言語再利用テキストとして生成して中
間言語テキスト格納域に出力し、内部形式テキストが終
了するまで現在処理テキストの入力,検索用テキストの
検索,中間言語テキストの生成および中間言語テキスト
格納域への出力ならびに現在処理テキストへの格納位置
情報の追加を繰り返し、目的プログラム生成部が中間言
語生成部により出力された中間言語テキストを中間言語
テキスト格納域から入力し入力した中間言語テキストが
中間言語再利用テキストであるか否かを判定し、入力し
た中間言語テキストが中間言語再利用テキストでなかっ
た場合には入力した中間言語テキストに相当する目的プ
ログラムを生成して目的プログラム保持部に出力し、入
力した中間言語テキストが中間言語再利用テキストであ
った場合には中間言語再利用テキストから格納位置情報
を取り出してこれを用いて中間言語テキスト格納域から
順に再利用する中間言語テキストを入力し入力した中間
言語テキストに相当する目的プログラムを生成して目的
プログラム保持部に出力し、中間言語テキストが終了す
るまで中間言語テキストの入力,入力した中間言語テキ
ストが中間言語再利用テキストか否かの判定,中間言語
テキストに相当する目的プログラムの生成または再利用
する中間言語テキストに相当する目的プログラムの生成
および生成した目的プログラムの目的プログラム保持部
への出力を繰り返し、制御部が原始プログラム解析部,
中間言語生成部および目的プログラム生成部を制御す
る。
In the intermediate language text reuse method of the present invention, the source program analysis unit inputs the source program, analyzes it, decomposes it into tokens, and outputs the token string as internal format text to the internal format text storage area. The search text that has the same token string as the token string of the currently processed text in the search text that is the internal format text that has already been processed by inputting the internal format text output from the source program analysis unit from the internal format text storage area If there is no search text having a token string with the same content as the token string of the currently processed text, an intermediate language text is generated from the token string of the currently processed text and the intermediate language text storage area is searched. The storage location that is output to and indicates where this intermediate language text is stored in the intermediate language text storage area. Information is added to the internal format text corresponding to the currently processed text as an intermediate language storage location information area, and if there is a search text having a token string with the same content as the token string of the currently processed text, the intermediate language text is newly added. Does not generate the storage location information corresponding to the search text retrieved from the internal format text storage area, and generates the storage location information and information indicating the reuse of the intermediate language text as intermediate language reuse text Output to the language text storage area, input the currently processed text, search the search text, generate intermediate language text, output to the intermediate language text storage area, and store position information to the currently processed text until the internal format text ends , The target program generator outputs the intermediate language output by the intermediate language generator. The text is input from the intermediate language text storage area, it is determined whether the input intermediate language text is intermediate language reuse text, and if the input intermediate language text is not intermediate language reuse text, the intermediate text that is input Generates the target program corresponding to the language text and outputs it to the target program holding unit. If the input intermediate language text is intermediate language reuse text, the storage location information is extracted from the intermediate language reuse text and this is stored. The intermediate language texts to be reused are sequentially input using the intermediate language texts, the target program corresponding to the input intermediate language texts is generated and output to the target program holding unit, and the intermediate language texts are stored until the intermediate language texts are finished. Input, determining whether the input intermediate language text is an intermediate language reuse text, intermediate language Generating or reusing a target program corresponding to text Generation of a target program corresponding to an intermediate language text and output of the generated target program to a target program holding unit are repeated, and the control unit is a source program analysis unit,
It controls the intermediate language generation unit and the target program generation unit.

〔実施例〕〔Example〕

次に、本発明について図面を参照して詳細に説明する。 Next, the present invention will be described in detail with reference to the drawings.

第1図は、本発明の一実施例に係る中間言語テキストの
再利用方式の構成を示すブロック図である。本実施例の
中間言語テキストの再利用方式は、各部を呼び出して制
御する制御部10と、原始プログラム保持部50から原始プ
ログラムを行単位に入力して解析し内部形式テキストを
生成して内部形式テキスト格納域60に格納する原始プロ
グラム解析部20と、原始プログラム解析部20により生成
された内部形式テキストを内部形式テキスト格納域60か
ら入力し入力した内部形式テキスト(以下、現在処理テ
キストという)と同一内容のすでに処理済の内部形式テ
キスト(以下、検索用テキストという)を検索すること
によって中間言語テキストの再利用の可否を判定し中間
言語テキストまたは中間言語再利用テキストを生成して
中間言語テキスト格納域70に出力し出力した中間言語テ
キストの中間言語テキスト格納域70での開始位置および
終了位置を内部形式テキストに設定して内部形式テキス
ト格納域60に格納する中間言語生成部30と、中間言語テ
キスト格納域70より入力した中間言語テキストから直接
目的プログラム(オブジェクト)を生成するか中間言語
テキストの再利用を行って目的プログラムを生成するか
して目的プログラム保持部80に出力する目的プログラム
生成部40とから構成されている。
FIG. 1 is a block diagram showing a structure of a reuse system of an intermediate language text according to an embodiment of the present invention. The reuse method of the intermediate language text of the present embodiment is such that the control unit 10 that calls and controls each unit and the source program holding unit 50 inputs the source program line by line and analyzes it to generate an internal format text and generate an internal format. The source program analysis unit 20 to be stored in the text storage area 60, the internal format text generated by the source program analysis unit 20 from the internal format text storage area 60, and the input internal format text (hereinafter referred to as currently processed text) Intermediate language text or intermediate language text is generated by determining whether or not intermediate language text can be reused by searching already processed internal format text (hereinafter referred to as search text) having the same content. The start position and end position in the intermediate language text storage area 70 of the intermediate language text output to the storage area 70 and output An intermediate language generation unit 30 that sets the partial format text and stores it in the internal format text storage area 60, and directly generates the target program (object) from the intermediate language text input from the intermediate language text storage area 70 or The target program generating unit 40 is configured to reuse the target program to generate the target program and output the target program to the target program holding unit 80.

第2図を参照すると、制御部10における処理は、原始プ
ログラム解析部呼出しステップ21と、中間言語生成部呼
出しステップ22と、目的プログラム生成部呼出しステッ
プ23とからなる。
Referring to FIG. 2, the processing in the control unit 10 includes a source program analysis unit calling step 21, an intermediate language generation unit calling step 22 and a target program generation unit calling step 23.

第3図を参照すると、原始プログラム解析部20における
処理は、原始プログラム終了検出ステップ31と、原始プ
ログラム入力ステップ32と、内部形式テキスト生成ステ
ップ33と、内部形式テキスト出力ステップ34とからな
る。
Referring to FIG. 3, the processing in the source program analysis unit 20 includes a source program end detection step 31, a source program input step 32, an internal format text generation step 33, and an internal format text output step 34.

第4図を参照すると、中間言語生成部30における処理
は、内部形式テキスト終了検出ステップ41と、内部形式
テキスト入力ステップ42と、中間言語格納開始位置設定
ステップ43と、検索用テキスト終了検出ステップ44と、
検索用テキスト入力ステップ45と、検索用テキストと現
在処理テキストとの同一内容判定ステップ46と、中間言
語テキスト生成ステップ47と、中間言語再利用テキスト
生成ステップ48と、中間言語格納終了位置設定ステップ
49とからなる。
Referring to FIG. 4, the processing in the intermediate language generation unit 30 is performed by an internal format text end detection step 41, an internal format text input step 42, an intermediate language storage start position setting step 43, and a search text end detection step 44. When,
Search text input step 45, same content determination step 46 for search text and currently processed text, intermediate language text generation step 47, intermediate language reuse text generation step 48, intermediate language storage end position setting step
It consists of 49 and.

第5図を参照すると、目的プログラム生成部40おける処
理は、中間言語テキスト終了検出ステップ51と、中間言
語テキスト入力ステップ52と、中間言語再利用テキスト
判定ステップ53と、再利用開始位置および終了位置取出
しステップ54と、再利用する中間言語テキスト入力ステ
ップ55と、目的プログラム生成ステップ56と、再利用終
了判定ステップ57と、目的プログラム生成ステップ58と
からなる。
Referring to FIG. 5, the processing in the object program generation unit 40 is performed by detecting an intermediate language text end step 51, an intermediate language text input step 52, an intermediate language reuse text determination step 53, a reuse start position and an end position. It comprises a take-out step 54, an intermediate language text input step 55 for reuse, a target program generation step 56, a reuse end determination step 57, and a target program generation step 58.

第6図(a)〜(d)は、原始プログラム,内部形式テ
キスト,中間言語テキストおよび目的プログラムの一例
をそれぞれ示す図である。
FIGS. 6 (a) to 6 (d) are diagrams showing examples of the source program, the internal format text, the intermediate language text, and the target program, respectively.

次に、このように構成された本実施例の中間言語テキス
トの再利用方式の動作について説明する。
Next, an operation of the intermediate language text reusing method of the present embodiment configured as described above will be described.

まず、制御部10は、原始プログラム解析部20を起動する
(ステップ21)。
First, the control unit 10 activates the source program analysis unit 20 (step 21).

原始プログラム解析部20は、原始プログラム保持部50中
の原始プログラムが終了したか否かを判定し(ステップ
31)、終了していない場合には、原始プログラム保持部
50から、例えば第6図(a)に示すような原始プログラ
ムを行単位に入力する(ステップ32)。次に、入力され
た原始プログラムを解析して言語要素(以下、トークン
という)に分解して、例えば第6図(b)に示すような
トークン列と中間言語格納位置情報領域とからなる内部
形式テキストを生成し(ステップ33)、生成された内部
形式テキストを内受形式テキスト格納域60に出力する
(ステップ34)。ステップ31で原始プログラム保持部50
中の原始プログラムの終了が検出されるまで、ステップ
31〜34を繰り返し、原始プログラムの終了が検出される
と、原始プログラム解析部20は処理を終了する。
The source program analysis unit 20 determines whether or not the source program in the source program storage unit 50 has finished (step
31), if not finished, the source program holding section
From 50, for example, a source program as shown in FIG. 6 (a) is input line by line (step 32). Next, the input source program is analyzed and decomposed into language elements (hereinafter referred to as tokens), for example, an internal format composed of a token string and an intermediate language storage location information area as shown in FIG. 6 (b). The text is generated (step 33), and the generated internal format text is output to the internal reception format text storage area 60 (step 34). In step 31, the source program holding unit 50
Until the end of the source program inside is detected
When 31 to 34 are repeated and the end of the source program is detected, the source program analysis unit 20 ends the process.

次に、制御部10は、中間言語生成部30を起動する(ステ
ップ22)。
Next, the control unit 10 activates the intermediate language generation unit 30 (step 22).

中間言語生成部30は、原始プログラム解析部20により生
成され内部形式テキスト格納域60に格納された内部形式
テキストが終了したか否かを判定し(ステップ41)、終
了していない場合には内部形式テキスト格納域60から内
部形式テキストを入力して現在処理テキストとする(ス
テップ42)。次に、生成される中間言語テキストが中間
言語テキスト格納域70のどこから格納されるかを示す開
始位置(from)を内部形式テキストの中間言語格納位置
情報領域に設定する(ステップ43)。続いて、検索用テ
キストがあるか否かを判定し(ステップ44)、検索用テ
キストがある場合には検索用テキストを入力し(ステッ
プ45)、現在処理テキストのトークン列と検索用テキス
トのトークン列とが同じ内容であるか否かを判定し(ス
テップ46)、同じ場合には、例えば第6図(c)に示す
ような中間言語再利用テキストを生成し、検索用テキス
トの中間言語格納位置情報領域からこの検索用テキスト
のトークン列に相当する中間言語テキストの中間言語テ
キスト格納域70での開始位置(from)および終了位置
(to)を取り出し、生成した中間言語再利用テキストに
設定し、中間言語テキスト格納域70に出力する(ステッ
プ48)。
The intermediate language generation unit 30 determines whether or not the internal format text generated by the source program analysis unit 20 and stored in the internal format text storage area 60 has ended (step 41). The internal format text is input from the format text storage area 60 and used as the currently processed text (step 42). Next, a start position (from) indicating from where in the intermediate language text storage area 70 the generated intermediate language text is stored is set in the intermediate language storage location information area of the internal format text (step 43). Then, it is determined whether or not there is a search text (step 44), and if there is a search text, the search text is input (step 45), and the token string of the currently processed text and the search text token are entered. It is determined whether or not the contents of the columns are the same (step 46), and if they are the same, an intermediate language reuse text, for example, as shown in FIG. The start position (from) and end position (to) in the intermediate language text storage area 70 of the intermediate language text corresponding to the token string of this search text are retrieved from the position information area and set as the generated intermediate language reuse text. , To the intermediate language text storage area 70 (step 48).

ステップ46で現在処理テキストのトークン列と検索用テ
キストのトークン列とが同じ内容でないと判定された場
合には、検索用テキストの終了が検索されるか(ステッ
プ44)、次に入力した検索用テキストのトークン列が現
在処理テキストのトークン列と同じ内容であると判定さ
れるまで(ステップ46)、ステップ44〜46が繰り返され
る。
If it is determined in step 46 that the token string of the currently processed text and the token string of the search text do not have the same content, the end of the search text is searched (step 44) or the next input search text is used. Steps 44-46 are repeated until it is determined that the text token string has the same content as the currently processed text token string (step 46).

ステップ44で検索用テキストの終了が検出されると、現
在処理テキストに相当する中間言語テキストを生成して
中間言語テキスト格納域70に格納する(ステップ47)。
When the end of the search text is detected in step 44, an intermediate language text corresponding to the currently processed text is generated and stored in the intermediate language text storage area 70 (step 47).

ステップ47またはステップ48で中間言語テキストまたは
中間言語再利用テキストを生成して中間言語テキスト格
納域70に格納したならば、生成された中間言語テキスト
が中間言語テキスト格納域70のどこまで格納されたかを
示す終了位置(to)を現在処理テキストに対応する内部
形式テキストの中間言語格納位置情報領域に設定し(ス
テップ49)、ステップ41で内部形式テキストの終了が検
出されるまで、ステップ41〜49が繰り返される。ステッ
プ41で内部形式テキストの終了が検出されると、中間言
語生成部30は処理を終了する。
After generating the intermediate language text or the intermediate language reuse text in step 47 or step 48 and storing it in the intermediate language text storage area 70, how much of the generated intermediate language text is stored in the intermediate language text storage area 70. The end position (to) shown is set in the intermediate language storage position information area of the internal format text corresponding to the currently processed text (step 49), and steps 41 to 49 are executed until the end of the internal format text is detected in step 41. Repeated. When the end of the internal format text is detected in step 41, the intermediate language generation unit 30 ends the process.

続いて、制御部10は、目的プログラム生成部40を起動す
る(ステップ23)。
Subsequently, the control unit 10 activates the target program generation unit 40 (step 23).

目的プログラム生成部40は、中間言語生成部30により生
成され中間言語テキスト格納域70に格納された中間言語
テキストが終了したか否かを判定し(ステップ51)、終
了していない場合には中間言語テキスト格納域70から中
間言語テキストを入力する(ステップ52)。次に、入力
した中間言語テキストが中間言語再利用テキストである
か否かを判定し(ステップ53)、中間言語再利用テキス
トである場合には入力した中間言語テキストから再利用
する中間言語テキストの中間言語テキスト格納域70での
開始位置(from)および終了位置(to)を取り出し(ス
テップ54)、中間言語テキスト格納域70の開始位置から
順に中間言語テキストを入力し(ステップ55)、再利用
するために入力した中間言語テキストに相当する、例え
ば第6図(d)に示すような目的プログラムを生成して
目的プログラム保持部80に出力し(ステップ56)、取り
出した終了位置の中間言語テキストまで再利用が終了し
たか否かを判定する(ステップ57)。終了していなけれ
ば、終了したと判定されるまでステップ55〜57を繰り返
す。
The object program generation unit 40 determines whether or not the intermediate language text generated by the intermediate language generation unit 30 and stored in the intermediate language text storage area 70 has ended (step 51). The intermediate language text is input from the language text storage area 70 (step 52). Next, it is judged whether or not the input intermediate language text is the intermediate language reuse text (step 53), and if it is the intermediate language reuse text, the intermediate language text to be reused from the input intermediate language text is determined. The start position (from) and end position (to) in the intermediate language text storage area 70 are retrieved (step 54), the intermediate language text is input in order from the starting position in the intermediate language text storage area 70 (step 55), and reused. The intermediate language text corresponding to the input intermediate language text, for example, as shown in FIG. 6 (d), is generated and output to the target program holding unit 80 (step 56), and the intermediate language text at the extracted end position is extracted. It is determined whether or not the reuse has been completed (step 57). If it is not completed, steps 55 to 57 are repeated until it is determined that it is completed.

ステップ53で中間言語再利用テキストでないと判定され
た場合には、ステップ52で入力された中間言語テキスト
に相当する目的プログラム生成して目的プログラム保持
部80に出力する(ステップ58)。ステップ57で再利用終
了と判定されるか、ステップ58で目的プログラムが生成
および出力された場合には、ステップ51に戻って処理を
繰り返す。
When it is determined in step 53 that the text is not the intermediate language reuse text, the target program corresponding to the intermediate language text input in step 52 is generated and output to the target program holding unit 80 (step 58). If it is determined in step 57 that the reuse is completed, or if the target program is generated and output in step 58, the process returns to step 51 to repeat the processing.

ステップ51で中間言語テキストの終了を検出すると、目
的プログラム生成部40は処理を終了し、制御部10も処理
を終了する。
When the end of the intermediate language text is detected in step 51, the target program generation unit 40 ends the process, and the control unit 10 also ends the process.

〔発明の効果〕〔The invention's effect〕

以上説明したように本発明は、原始プログラム中に同一
内容の命令が出現したときにすでに生成されている中間
言語テキストを再利用することにより、以下に示すよう
な効果がある。
As described above, the present invention has the following effects by reusing the intermediate language text that has already been generated when the instruction having the same content appears in the source program.

(1) 中間言語テキストを生成する処理そのものを省
くことができるので、処理速度が向上する。
(1) Since the processing itself for generating the intermediate language text can be omitted, the processing speed is improved.

(2) 中間言語テキストを格納するファイルやメモリ
などが少なくてすむので、ファイルやメモリなどを有効
に使用することができる。
(2) Since the number of files and memories for storing intermediate language texts is small, the files and memories can be effectively used.

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

第1図は本発明の一実施例に係る中間言語テキストの再
利用方式の構成を示すブロック図、 第2図は第1図中の制御部における処理を示す流れ図、 第3図は第1図中の原始プログラム解析部における処理
を示す流れ図、 第4図は第1図中の中間言語生成部における処理を示す
流れ図、 第5図は第1図中の目的プログラム生成部における処理
を示す流れ図、 第6図(a)〜(d)は原始プログラム,内部形式テキ
スト,中間言語テキストおよび目的プログラムの一例を
それぞれ示す図である。 図において、 10……制御部、 20……原始プログラム解析部、 30……中間言語生成部、 40……目的プログラム生成部、 50……原始プログラム保持部、 60……内部形式テキスト格納域、 70……中間言語テキスト格納域、 80……目的プログラム保持部である。
FIG. 1 is a block diagram showing the configuration of an intermediate language text reuse system according to an embodiment of the present invention, FIG. 2 is a flow chart showing processing in a control unit in FIG. 1, and FIG. 3 is FIG. FIG. 4 is a flow chart showing the processing in the source program analysis section in FIG. 4, FIG. 4 is a flow chart showing the processing in the intermediate language generation section in FIG. 1, and FIG. 5 is a flow chart showing the processing in the target program generation section in FIG. FIGS. 6A to 6D are diagrams showing examples of the source program, the internal format text, the intermediate language text, and the target program, respectively. In the figure, 10 ... control unit, 20 ... source program analysis unit, 30 ... intermediate language generation unit, 40 ... target program generation unit, 50 ... source program storage unit, 60 ... internal format text storage area, 70: Intermediate language text storage area, 80: Object program storage section.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】原始プログラムを入力し解析してトークン
に分解しトークン列を内部形式テキストとして内部形式
テキスト格納域に出力する原始プログラム解析部と、 この原始プログラム解析部から出力された内部形式テキ
ストを前記内部形式テキスト格納域から入力しすでに処
理済の内部形式のテキストである検索用テキストの中に
現在処理テキストのトークン列と同じトークン列をもつ
検索用テキストがあるか否かを検索し、現在処理テキス
トのトークン列と同じ内容のトークン列をもつ検索用テ
キストがない場合には現在処理テキストのトークン列か
ら中間言語テキストを生成して中間言語テキスト格納域
に出力しこの中間言語テキストが前記中間言語テキスト
格納域のどこに格納されたかを示す格納位置情報を現在
処理テキストに対応する内部形式テキストに中間言語格
納位置情報領域として追加し、現在処理テキストのトー
クン列と同じ内容のトークン列をもつ検索用テキストが
ある場合には中間言語テキストを新たには生成せずに検
索した検索用テキストに対応する格納位置情報を前記内
部形式テキスト格納域から取り出しその格納位置情報と
中間言語テキストの再利用を示す情報とを中間言語再利
用テキストとして生成して前記中間言語テキスト格納域
に出力し、内部形式テキストが終了するまで前記現在処
理テキストの入力,検索用テキストの検索,中間言語テ
キストの生成および前記中間言語テキスト格納域への出
力ならびに現在処理テキストへの格納位置情報の追加を
繰り返す中間言語生成部と、 この中間言語生成部により出力された中間言語テキスト
を前記中間言語テキスト格納域から入力し入力した中間
言語テキストが中間言語再利用テキストであるか否かを
判定し、入力した中間言語テキストが中間言語再利用テ
キストでなかった場合には入力した中間言語テキストに
相当する目的プログラムを生成して目的プログラム保持
部に出力し、入力した中間言語テキストが中間言語再利
用テキストであった場合にはこの中間言語再利用テキス
トから格納位置情報を取り出してこれを用いて前記中間
言語テキスト格納域から順に再利用する中間言語テキス
トを入力し入力した中間言語テキストに相当する目的プ
ログラムを生成して目的プログラム保持部に出力し、中
間言語テキストが終了するまで前記中間言語テキストの
入力,入力した中間言語テキストが中間言語再利用テキ
ストか否かの判定,中間言語テキストに相当する目的プ
ログラムの生成または再利用する中間言語テキストに相
当する目的プログラムの生成および生成した目的プログ
ラムの前記目的プログラム保持部への出力を繰り返す目
的プログラム生成部と、 前記原始プログラム解析部,前記中間言語生成部および
前記目的プログラム生成部を制御する制御部と を有する特徴とする中間言語テキストの再利用方式。
1. A source program analysis unit for inputting and analyzing a source program, decomposing it into tokens, and outputting a token string as internal format text to an internal format text storage area, and an internal format text output from this source program analysis section. Search for whether or not there is a search text having the same token string as the token string of the currently processed text in the search text which is the text of the internal format that has already been processed by inputting from the internal format text storage area, If there is no search text having a token string having the same content as the token string of the currently processed text, an intermediate language text is generated from the token string of the currently processed text and output to the intermediate language text storage area. Corresponds to the currently processed text with storage location information indicating where it was stored in the intermediate language text storage area If the search text has a token string with the same contents as the token string of the currently processed text, it is searched without creating a new intermediate language text. The storage location information corresponding to the search text is taken out from the internal format text storage area and the storage location information and information indicating reuse of the intermediate language text are generated as intermediate language reuse text and stored in the intermediate language text storage area. Input the current processed text, search the search text, generate intermediate language text, output to the intermediate language text storage area, and add storage location information to the currently processed text until the output and output of the internal format text are completed. The repeating intermediate language generation unit and the intermediate language text output by this intermediate language generation unit It is determined whether the intermediate language text input from the inter-language text storage area is the intermediate language reuse text, and if the input intermediate language text is not the intermediate language reuse text, the intermediate language text is input. When the input intermediate language text is an intermediate language reuse text, the storage location information is extracted from this intermediate language reuse text and used. The intermediate language text to be reused is sequentially input from the intermediate language text storage area, a target program corresponding to the input intermediate language text is generated and output to the target program holding unit, and the intermediate language is stored until the intermediate language text ends. Input text, judge whether the input intermediate language text is intermediate language reuse text, intermediate language Generating or reusing an object program corresponding to text, generating an object program corresponding to an intermediate language text, and repeating outputting the generated object program to the object program holding section; and the source program analyzing section, And a control unit for controlling the intermediate language generation unit and the target program generation unit.
JP63305346A 1988-12-02 1988-12-02 Reuse method of intermediate language text Expired - Fee Related JPH0695309B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63305346A JPH0695309B2 (en) 1988-12-02 1988-12-02 Reuse method of intermediate language text

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63305346A JPH0695309B2 (en) 1988-12-02 1988-12-02 Reuse method of intermediate language text

Publications (2)

Publication Number Publication Date
JPH02151931A JPH02151931A (en) 1990-06-11
JPH0695309B2 true JPH0695309B2 (en) 1994-11-24

Family

ID=17944007

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63305346A Expired - Fee Related JPH0695309B2 (en) 1988-12-02 1988-12-02 Reuse method of intermediate language text

Country Status (1)

Country Link
JP (1) JPH0695309B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE69924857T2 (en) 1998-10-10 2006-03-02 Transitive Ltd., Hanging Ditch PROGRAM CODE CONVERSION

Also Published As

Publication number Publication date
JPH02151931A (en) 1990-06-11

Similar Documents

Publication Publication Date Title
JPH05197562A (en) Yacc program editing device
JPH0695309B2 (en) Reuse method of intermediate language text
JP2811804B2 (en) Variable output range specification method
JP2641768B2 (en) Sentence processing equipment
JPH02308355A (en) Input procedure management system for interpreter
JPS63156254A (en) Control method for intermediate text by interpreter
JPH0588872A (en) Program structure diagram preparation processing system
JPS63254533A (en) Register equivalence information management method
JPH06314221A (en) Compile method
JPH0498544A (en) Data limit control system
JPH0449421A (en) File editing system
JPH08234995A (en) Program converter
JPH0895763A (en) Method for fetching component program in original program
JPH0581008A (en) Indentation processing system
JPH0731594B2 (en) Program information analysis processor
JPH0495128A (en) Instuction pattern extraction processing device
JPH036627A (en) Job starting system
JPH04149636A (en) Cross-reference processing system
JPH0962538A (en) Efficiency supporting device
JPS63201833A (en) Reference settling system for unsettled label
JPH07141178A (en) Object access device
JPH04167129A (en) Creation system for data area specifications
JPH0325529A (en) Job control language generator
JPH045757A (en) Table calculating formula automatic discriminating system
JPH06175862A (en) Electronic computer

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees