JPH0239328A - Literal address allocating device - Google Patents

Literal address allocating device

Info

Publication number
JPH0239328A
JPH0239328A JP19001388A JP19001388A JPH0239328A JP H0239328 A JPH0239328 A JP H0239328A JP 19001388 A JP19001388 A JP 19001388A JP 19001388 A JP19001388 A JP 19001388A JP H0239328 A JPH0239328 A JP H0239328A
Authority
JP
Japan
Prior art keywords
literal
length
registered
address
bytes
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
JP19001388A
Other languages
Japanese (ja)
Inventor
Yoshitaka Kato
加藤 喜隆
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 JP19001388A priority Critical patent/JPH0239328A/en
Publication of JPH0239328A publication Critical patent/JPH0239328A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To improve the literal retrieving efficiency and then the compiling efficiency by registering a literal pool table after dividing it into pieces according to the literal length. CONSTITUTION:A literal retrieving means 3 retrieves successively a literal pool minor table 52 in the case the literal length inputted via a literal input means 2 is less than (n) bytes. While the means 3 retrieves a literal pool major table 53 based on the address stored in a literal control table 51 and uses the coincident address as a literal allocation address in the case the literal length is more than (n) bytes. The new literals are successively registered into the table 52 by a literal register means 4 in the case the literal length is less than (n) bytes. While these literals are registered into the table 53 in the case the literal length is more than (n) bytes. Then the address registered in the table 51 and the literal length are registered.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、ソースプログラム中の手続部にリテラルを記
述できるコンパイラに利用する。特に、リテラルの最適
化手段に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention is applied to a compiler that can write literals in the procedure division of a source program. In particular, it relates to literal optimization means.

〔概要〕〔overview〕

本発明は、コンパイラのテキストファイルの手続部に記
述されたリテラルの最適化手段において、一致する可能
性の高いリテラルを格納したテーブルを検索して割付は
アドレスを定めることにより、 コンパイル性能の向上が図れるようにしたものである。
The present invention improves compilation performance by searching a table that stores literals that are likely to match and determining addresses for allocation in a literal optimization means written in the procedure division of a text file of a compiler. It is designed so that it can be easily understood.

〔従来の技術〕[Conventional technology]

従来の手続部のリテラルの最適化方法は、リテラルの長
さを意識せずに出現順にリテラルプールテーブルにリテ
ラルを登録し、同じリテラルがあるか否かの検索もリテ
ラルプールテーブルを順次検索していた。
The conventional method for optimizing literals in the Procedure Division is to register literals in the literal pool table in the order of their appearance without considering the length of the literal, and to search the literal pool table sequentially to find out whether the same literal exists. Ta.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

nバイト (nとは、リテラル同志を比較した場合にリ
テラルの長さが長ければ長い程他のリテラルと一致する
可能性は低くなるが、リテラルの値が他のリテラルと一
致する可能性が比較的高いリテラルの最大の長さを意味
する。)未満のりチラルとしては、スイッチとしての「
0」あるいは「1」や「1」からrloo Jまでの数
字のような数字リテラルが繰り返し使用されていること
が多い。
n bytes (n means that when comparing literals, the longer a literal is, the less likely it is to match another literal; (means the maximum length of a literal with a high value).
Numerical literals such as ``0'' or ``1'' or numbers from ``1'' to rloo J are often used repeatedly.

また、nバイト以上のリテラルとしては、画面端末装置
上あるいは帳表上に出力させ、人が目で見て確認する文
字リテラルが使用されていることが多い。
Furthermore, as literals of n or more bytes, character literals are often used that are output on a screen terminal device or on a ledger and are visually checked by a person.

ところで、従来例では、リテラルの出現順にリテラルプ
ールテーブルにリテラルを登録し、同じリテラルがある
か否かの検索もリテラルプールテーブルを順次検索して
いるので、nバイト未満の数字リテラルの検索にさいし
て一致する可能性の少ないnバイト以上の文字リテラル
の部分を検索している場合もあり、またnバイト以上の
文字リテラルの検索にさいして一致する可能性のないn
バイト未満の数字リテラルの部分を検索している場合も
あるので、コンパイル性能が低下する欠点がある。
By the way, in the conventional example, literals are registered in the literal pool table in the order in which they appear, and the literal pool table is sequentially searched to see if the same literal exists, so when searching for a numeric literal of less than n bytes, In some cases, you are searching for a character literal of n or more bytes that has a low possibility of matching, and when searching for a character literal of n or more bytes, you are searching for n
This has the disadvantage that compile performance deteriorates because the part of the numerical literal that is less than a byte may be searched.

本発明は、このような欠点を除去するもので、コンパイ
ル性能の低下を招かないリテラルのアドレス割付装置を
提供することを目的とする。
The present invention aims to eliminate such drawbacks and to provide a literal address allocation device that does not cause deterioration in compilation performance.

〔問題点を解決するための手段〕[Means for solving problems]

本発明は、手続部にリテラルが記述されたテキストファ
イルに接続されたリテラルのアドレス割付装置において
、管理テーブル、第一テーブルおよび第二テーブルを格
納する記憶手段と、上記テキストファイルから入力した
リテラルに一致するリテラルが上記第一または第二テー
ブルに格納されていないときに、入力したリテラルの長
さが所定長未満の場合はこのリテラルを上記第一テーブ
ルのひとつの領域に登録し、また、入力したリテラルの
長さが上記所定長以上の場合はこのリテラルを上記第二
テーブルのひとつの領域に登録し、この第二テーブルに
リテラルが登録された領域のアドレスとこのリテラルの
長さとを組にして上記管理テーブルに登録する登録手段
と、上記テキストファイルから入力したリテラルに一致
するリテラルが上記第一または第二テーブルに格納され
ているときに、入力したリテラルの長さが上記所定長未
満の場合は上記第一テーブルを検索し、また、入力した
リテラルの長さが上記所定長以上の場合は上記管理テー
ブルに登録されているこのリテラルと組のアドレスに基
づき上記第二テーブルを検索し、検索された領域のアド
レスをこのリテラルの割付はアドレスに定める検索手段
とを備えたことを特徴とする。
The present invention provides a literal address allocation device connected to a text file in which literals are described in the procedure division, including a storage means for storing a management table, a first table, and a second table, and a literal address assignment device connected to a text file in which literals are written in the procedure division. If a matching literal is not stored in the first or second table above, and the length of the input literal is less than the specified length, this literal is registered in one area of the first table above, and the input If the length of the literal is greater than or equal to the predetermined length, register this literal in one area of the second table, and pair the length of this literal with the address of the area where the literal is registered in this second table. a registration means for registering in the above management table using the above text file; If the length of the input literal is greater than or equal to the predetermined length, the second table is searched based on the address paired with this literal registered in the management table. The present invention is characterized by comprising a search means for determining the address of the searched area as the address for assigning the literal.

〔作用〕[Effect]

手続部に記述されているリテラルを入力し、このリテラ
ルの長さがnバイト未満の場合には、同じリテラルがあ
るか否かをリテラルプール小テーブルを順次検索し、n
バイト以上の場合には、同じリテラルがあるか否かをリ
テラル管理テーブル中に登録されているアドレスからリ
テラルプール大テーブルを検索し、一致した場合には一
致したアドレスをそのリテラルに割付はアドレスとする
When a literal written in the Procedure Division is input and the length of this literal is less than n bytes, the literal pool small table is sequentially searched to see if the same literal exists, and n
If it is more than a byte, the large literal pool table is searched from the address registered in the literal management table to see if the same literal exists, and if there is a match, the matching address is assigned to that literal. do.

また、リテラルプール小テーブルあるいはリテラルプー
ル大テーブルに同じリテラルがなかった場合に、リテラ
ルの長さがnバイト未満のときには、そのリテラルをリ
テラルプール小テーブルに登録し、リテラルの長さがn
バイト以上のときには、そのリテラルをリテラルブール
大テーブルに登録し、登録したアドレスをそのリテラル
の割付はアドレスとし、また、リテラルの長さがnバイ
ト以上の場合には登録したアドレスとリテラルの長さを
リテラル管理テーブルに登録する。
In addition, if the same literal does not exist in the literal pool small table or the literal pool large table, and the length of the literal is less than n bytes, that literal is registered in the literal pool small table, and the literal length is n bytes.
If the length is more than bytes, the literal is registered in the literal Boolean large table, and the registered address is assigned as the address, and if the literal length is n bytes or more, the registered address and the literal length are assigned. Register in the literal management table.

〔実施例〕〔Example〕

以下、本発明の一実施例について図面を参照して説明す
る。第1図はこの実施例の構成を示すブロック構成図、
第2図はリテラル検索手段の動作を示すフローチャート
、第3図はリテラルプール小テーブルの構成の一例を示
す構成図、第4図はリテラル管理テーブルとリテラルプ
ール大テーブルの構成の一例を示す構成図である。
An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a block configuration diagram showing the configuration of this embodiment.
FIG. 2 is a flowchart showing the operation of the literal search means, FIG. 3 is a configuration diagram showing an example of the configuration of a literal pool small table, and FIG. 4 is a configuration diagram showing an example of the configuration of a literal management table and a literal pool large table. It is.

この実施例は、第1図に示すように、中間テキストファ
イル1、リテラル入力手段2、リテラル検索手段3、リ
テラル登録手段4、主記憶装置5から構成され、ここで
、主記憶装置5は、第3図および第4図に示すように、
コンパイルに際しリテラルプール大テーブル53のリテ
ラルを指す°rアドレスリテラルの長さとが登録される
リテラル管理テーブル51と、nバイト未満のリテラル
が登録されるリテラルプール小テーブル52と、nバイ
ト以上のリテラルが登録されるリテラルプール大テーブ
ル53とを備える。すなわち、この実施例は、手続部に
リテラルが記述されたテキストファイルである中間テキ
ストファイル1に接続され、管理テーブルであるリテラ
ル管理テーブル51、第一テーブルであるリテラルプー
ル小テーブル52および第二テーブルであるリテラルプ
ール大テーブル53を格納する記憶手段である主記憶装
置5と、上記テキストファイルから入力したリテラルに
一致するリテラルが上記第一または第二テーブルに格納
されていないときに、入力したリテラルの長さが所定長
未満の場合はこのリテラルを上記第一テーブルのひとつ
の領域に登録し、また、入力したリテラルの長さが上記
所定長以上の場合はこのリテラルを上記第二テーブルの
ひとつの領域に登録し、この第二テーブルにリテラルが
登録された領域のアドレスとこのリテラルの長さとを組
にして上記管理テーブルに登録する登録手段であるリテ
ラル登録手段4と、上記テキストファイルから入力した
リテラルに一致するリテラルが上記第一または第二テー
ブルに格納されているときに、入力したリテラルの長さ
が上記所定長未満の場合は上記第一テーブルを検索し、
また、入力したリテラルの長さが上記所定長以上の場合
は上記管理テーブルに登録されているこのリテラルと組
のアドレスに基づき上記第二テーブルを検索し、検索さ
れた領域のアドレスをこのリテラルの割付はアドレスに
定める検索手段であるリテラル検索手段3とを備える。
As shown in FIG. 1, this embodiment is composed of an intermediate text file 1, a literal input means 2, a literal search means 3, a literal registration means 4, and a main storage device 5. Here, the main storage device 5 includes: As shown in Figures 3 and 4,
When compiling, there is a literal management table 51 in which the length of an address literal pointing to a literal in the large literal pool table 53 is registered, a small literal pool table 52 in which literals of less than n bytes are registered, and a literal of n or more bytes is registered. It also includes a large literal pool table 53 to be registered. That is, this embodiment is connected to an intermediate text file 1 which is a text file in which literals are described in the procedure division, and has a literal management table 51 which is a management table, a literal pool small table 52 which is a first table, and a second table. The main storage device 5 is a storage means for storing a large literal pool table 53, and when a literal that matches the literal input from the text file is not stored in the first or second table, the input literal If the length of is less than the predetermined length, register this literal in one area of the first table above, and if the length of the input literal is greater than the predetermined length, register this literal in one of the areas of the second table above. A literal registration means 4 registers the address of the area in which the literal is registered in the second table and the length of this literal as a pair and registers it in the management table, and inputs from the text file. When a literal matching the entered literal is stored in the first or second table, if the length of the input literal is less than the predetermined length, search the first table;
Additionally, if the length of the input literal is longer than the predetermined length, the second table is searched based on the address paired with this literal registered in the management table, and the address of the searched area is set to the address of this literal. The layout is provided with a literal search means 3 which is a search means defined in the address.

次に、この実施例の動作を説明する。リテラル入力手段
2は、中間テキストファイル1から手続部に記述されて
いるリテラルを入力する。リテラル検索手段3は、入力
したリテラルの長さがnバイト未満の場合には、同じリ
テラルがあるか否かをリテラルプール小テーブル52を
順次検索し、致した場合には一致したアドレスをそのリ
テラルの割付はアドレスにする。nバイト以上の場合に
は、同じリテラルがあるか否かを第2図のフローチャー
トに示す順でリテラル管理テーブル51中に登録されて
いるアドレスからリテラルプール大テーブル53を検索
し、一致した場合には一致したアドレスをそのリテラル
の割付はアドレスとする。
Next, the operation of this embodiment will be explained. The literal input means 2 inputs literals written in the procedure division from the intermediate text file 1. If the length of the input literal is less than n bytes, the literal search means 3 sequentially searches the literal pool small table 52 to see if the same literal exists, and if there is a match, the matching address is searched for the literal. is assigned to an address. If the length is n bytes or more, the large literal pool table 53 is searched from the addresses registered in the literal management table 51 in the order shown in the flowchart of FIG. 2 to see if the same literal exists. makes the matching address the literal assignment to address.

すなわち、はじめに、インデックスをリテラル管理テー
ブル51の最初の位置にする(ステップ31)。
That is, first, the index is set to the first position of the literal management table 51 (step 31).

検索するリテラルの長さとインデックスが指すリテラル
管理テーブル51のリテラルの長さのフィールドの値と
の比較を行い(ステップS2)、検索するリテラルの長
さが長いときにはインデックスを加算しくステップS3
)、インデックスがリテラル管理テーブル51内であれ
ば検索処理を続行する(ステップS4)。検索するリテ
ラルとリテラル管理テーブル51のアドレスフィールド
が指すリテラルブール大テーブル53のリテラルとの比
較を行い(ステップS5)、一致した場合にはリテラル
プール大テーブル53の一致したリテラルのアドレスを
リテラルの割付はアドレスとする(ステップS6)。
The length of the literal to be searched is compared with the value of the literal length field of the literal management table 51 pointed to by the index (step S2), and if the length of the literal to be searched is long, the index is added.Step S3
), if the index is in the literal management table 51, the search process continues (step S4). The literal to be searched is compared with the literal in the literal Boolean large table 53 pointed to by the address field of the literal management table 51 (step S5), and if they match, the address of the matched literal in the literal pool large table 53 is assigned to the literal. is an address (step S6).

リテラル登録手段4は、リテラルプール小テープル52
あるいはリテラルプール大テーブル53に同じリテラル
がなかった場合に、リテラルの長さがnバイト未満のと
きは、そのリテラルをリテラルプール小テーブル52の
空き領域に順次登録し、登録したアドレスをそのリテラ
ルの割付はアドレスとし、リテラルの長さがnバイト以
上のときは、そのリテラルをリテラルプール大テーブル
53の空き領域に順次登録し、登録したアドレスをその
リテラルの割付はアドレスとし、登録したアドレスとリ
テラルの長さとを組にしてリテラル管理テーブル51に
登録する。
The literal registration means 4 is a literal pool small table 52.
Alternatively, if the same literal does not exist in the large literal pool table 53 and the length of the literal is less than n bytes, the literals are registered in the free space of the small literal pool table 52 in sequence, and the registered addresses are assigned to the literal. The assignment is as an address, and when the length of the literal is n bytes or more, the literal is registered in the free area of the literal pool large table 53 in order, and the registered address is assigned as an address, and the registered address and literal are assigned as addresses. and the length of are registered in the literal management table 51 as a pair.

〔発明の効果〕〔Effect of the invention〕

本発明は、以上説明したように、nバイト未満のリテラ
ルが登録されるリテラルプールテーブルとnバイト以上
のリテラルが登録されるリテラルブールテーブルとを作
成し、nバイト未満のリテラルの検索はnバイト未満の
リテラルが登録されているリテラルブールテーブルを順
次検索し、nバイト以上のリテラルの検索はnバイト以
上のリテラルが登録されているリテラルプールテーブル
を、登録されているリテラル単位に、検索するリテラル
の長さ分だけ一度に比較を行うので、検索効率が向上し
、コンパイル性能の向上が図れる効果がある。
As explained above, the present invention creates a literal pool table in which literals of less than n bytes are registered and a literal boolean table in which literals of n bytes or more are registered, and searches for literals of less than n bytes are performed by n bytes. Literal Boolean tables in which literals less than or equal to the number of literals are registered are sequentially searched, and to search for literals of n or more bytes, the literal pool table in which literals of n or more bytes are registered is searched for each registered literal. Since only the length of is compared at once, search efficiency is improved and compilation performance can be improved.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明実施例の構成を示すブロック構成図。 第2図はリテラル検索手段の動作を示すフローチャート
。 第3図はリテラルプール小テーブルの一例を示す構成図
。 第4図はリテラル管理テーブルとリテラルプール大テー
ブルとの相関を示す構成図。 1・・・中間テキストファイル、2・・・リテラル入力
手段、3・・・リテラル検索手段、4・・・リテラル登
録手段、5・・・主記憶装置、51・・・リテラル管理
テーブル、52・・・リテラルプール小テーブル、53
・・・リテラルプール大テーブル。
FIG. 1 is a block configuration diagram showing the configuration of an embodiment of the present invention. FIG. 2 is a flowchart showing the operation of the literal search means. FIG. 3 is a configuration diagram showing an example of a literal pool small table. FIG. 4 is a configuration diagram showing the correlation between the literal management table and the literal pool large table. DESCRIPTION OF SYMBOLS 1... Intermediate text file, 2... Literal input means, 3... Literal search means, 4... Literal registration means, 5... Main storage device, 51... Literal management table, 52. ...Literal pool small table, 53
...literal pool large table.

Claims (1)

【特許請求の範囲】 1、手続部にリテラルが記述されたテキストファイルに
接続されたリテラルのアドレス割付装置において、 管理テーブル(51)、第一テーブル(52)および第
二テーブル(53)を格納する記憶手段(5)と、上記
テキストファイルから入力したリテラルに一致するリテ
ラルが上記第一または第二テーブルに格納されていない
ときに、入力したリテラルの長さが所定長未満の場合は
このリテラルを上記第一テーブルのひとつの領域に登録
し、また、入力したリテラルの長さが上記所定長以上の
場合はこのリテラルを上記第二テーブルのひとつの領域
に登録し、この第二テーブルにリテラルが登録された領
域のアドレスとこのリテラルの長さとを組にして上記管
理テーブルに登録する登録手段(4)と、 上記テキストファイルから入力したリテラルに一致する
リテラルが上記第一または第二テーブルに格納されてい
るときに、入力したリテラルの長さが上記所定長未満の
場合は上記第一テーブルを検索し、また、入力したリテ
ラルの長さが上記所定長以上の場合は上記管理テーブル
に登録されているこのリテラルと組のアドレスに基づき
上記第二テーブルを検索し、検索された領域のアドレス
をこのリテラルの割付けアドレスに定める検索手段(3
)と を備えたことを特徴とするリテラルのアドレス割付装置
[Claims] 1. In a literal address allocation device connected to a text file in which literals are described in the procedure division, a management table (51), a first table (52), and a second table (53) are stored. and a storage means (5) for storing the literal input from the above text file if the length of the input literal is less than a predetermined length when a literal that matches the literal input from the text file is not stored in the first or second table. is registered in one area of the first table above, and if the length of the input literal is greater than the predetermined length above, this literal is registered in one area of the second table above, and the literal is registered in the second table. a registration means (4) for registering a pair of the address of the area where is registered and the length of this literal in the management table; and a literal that matches the literal input from the text file in the first or second table. When stored, if the length of the input literal is less than the predetermined length, the first table is searched, and if the length of the input literal is greater than or equal to the predetermined length, it is registered in the management table. A search means (3
) A literal address allocation device characterized by comprising:
JP19001388A 1988-07-29 1988-07-29 Literal address allocating device Pending JPH0239328A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19001388A JPH0239328A (en) 1988-07-29 1988-07-29 Literal address allocating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP19001388A JPH0239328A (en) 1988-07-29 1988-07-29 Literal address allocating device

Publications (1)

Publication Number Publication Date
JPH0239328A true JPH0239328A (en) 1990-02-08

Family

ID=16250917

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19001388A Pending JPH0239328A (en) 1988-07-29 1988-07-29 Literal address allocating device

Country Status (1)

Country Link
JP (1) JPH0239328A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04351213A (en) * 1991-05-28 1992-12-07 Sumitomo Metal Ind Ltd Method and device for changing roll cross angle and roll bending force in flying

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04351213A (en) * 1991-05-28 1992-12-07 Sumitomo Metal Ind Ltd Method and device for changing roll cross angle and roll bending force in flying

Similar Documents

Publication Publication Date Title
Samelson et al. Sequential formula translation
CN110968593B (en) Database SQL statement optimization method, device, equipment and storage medium
JPH0239328A (en) Literal address allocating device
JP3360693B2 (en) Customer information search method
JPS617936A (en) Information retrieving system
JPH0644309A (en) Data base managing system
JPH0773187A (en) Retrieving system
JP2583879B2 (en) Information retrieval device
JPH0423167A (en) Command retrieving system
JP2735255B2 (en) Hatching treatment method
JPH01298464A (en) Japanese language dictionary access system
JPS63238622A (en) Relation retrieval system
JPH07141195A (en) Literal optimizing system in compiler
JPH0342728A (en) Deciding system for reservation word
JPH06290054A (en) Symbol table in compiler and reserved word table retrieving system
JPS63170742A (en) Retrieval processing system for common character string
JPH01120621A (en) Retrieving/updating system for data base
JPH04241672A (en) Character string retrieving system
JPH1153199A (en) Method and device for controlling hashing
JPH0553820A (en) Compiler
JPH0296838A (en) System for retrieving symbol name and record field name
JPH03177971A (en) Retrieving method by abbreviation
JPH0425970A (en) Identifier registration/retrieval system
JPH04170643A (en) Optimum segmentation determining system
JPH04107738A (en) Optimum allocation system for literal