JPH02201541A - Compiling system - Google Patents

Compiling system

Info

Publication number
JPH02201541A
JPH02201541A JP2051489A JP2051489A JPH02201541A JP H02201541 A JPH02201541 A JP H02201541A JP 2051489 A JP2051489 A JP 2051489A JP 2051489 A JP2051489 A JP 2051489A JP H02201541 A JPH02201541 A JP H02201541A
Authority
JP
Japan
Prior art keywords
data
text
program
initial value
section
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
JP2051489A
Other languages
Japanese (ja)
Inventor
Shinji Obara
小原 晋二
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 JP2051489A priority Critical patent/JPH02201541A/en
Publication of JPH02201541A publication Critical patent/JPH02201541A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce the capacity of an object program to reduce the storage cost by discriminating whether data definition description preliminarily has a data substance or not and setting its area information at the time when it has not any data substance. CONSTITUTION:A filing device 2 includes a source program 21, and a filing device 3 includes an intermediate text file 31, and a filing device 4 includes a program control information part 42, a data part 43, and a code part 44. A compiler 1 consists of a front end part 11 including a discriminating means 12 and a back end part 13 having a data part generating means 14. When the discriminating means 12 discriminates that data definition description in the source program 21 does not preliminarily include any data substance, the data part generating means 14 sets information indicating the area of data definition description to the program control information part 42. Thus, the capacity of the object program is reduced to reduce the storage cost.

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明は、ソースプログラムから目的プログラムを生成
するコンパイル方式に関して、特に目的プログラムのデ
ータ部の容量を少なくすることができるコンパイル方式
に関する (従来の技術) ソースプログラムは、一般に、命令部とデータ記述定義
から構成され、コンパイラでコンパイルされ、データ部
、コード部およびこれらを管理する制御情報を含み計算
機で実行可能な目的プログラムが生成されてファイル内
に格納されている。
Detailed Description of the Invention (Field of Industrial Application) The present invention relates to a compilation method for generating a target program from a source program, and particularly relates to a compilation method that can reduce the capacity of the data section of the target program (conventional). (Technology) A source program generally consists of an instruction part and a data description definition, and is compiled by a compiler to generate a target program that can be executed by a computer and includes a data part, a code part, and control information to manage these parts, and is written in a file. is stored in.

ソースプログラムにおけるそれぞれのデータ記述定義に
は一般に実際のデータ(データ実体)を予め含んでいる
場合と、実際のデータは含まず領域だけ確保する場合と
があるが、コンパイラはいずれの場合もデータ記述定義
で指定された領域を目的プログラムのデータ部内に生成
している。
Each data description definition in a source program generally includes actual data (data entity) in advance, and other cases do not include actual data and only secure an area, but in both cases, the compiler uses the data description The area specified by the definition is generated in the data section of the target program.

(発明が解決しようとする課題) 上述したように、データ記述定義が実際のデータを予め
含まず領域だ(ブ確保する場合でも、従来のコンパイラ
は目的プログラムのデータ部内にそのデータ記述定義の
領域を生成しているので、目的プログラムが大きくなり
ファイルの容量などの保管コストが大きくなるという欠
点がある。このように従来のコンパイル方式には解決す
べき課題があった。
(Problem to be Solved by the Invention) As mentioned above, even if the data description definition does not contain actual data and allocates an area, conventional compilers do not allocate the area of the data description definition in the data section of the target program. , the target program becomes large and storage costs such as file capacity increase.As described above, conventional compilation methods have problems that need to be solved.

本発明は、このような事情に鑑みてなされたものであり
、その目的は、実際のデータを予め含んでいないデータ
記述定義に対しては目的プログラムのデータ部にデータ
を生成しないことにより、目的プログラムの容量を少な
くして保管コストを減らすことができるコンパイル方式
を提供することにある。
The present invention has been made in view of the above circumstances, and its purpose is to avoid generating data in the data section of the target program for data description definitions that do not include actual data in advance. The purpose of the present invention is to provide a compilation method that can reduce program capacity and storage costs.

(課題を解決するための手段) 本発明のコンパイル方式は、上記目的を達成するために
、ソースプログラムからコード部、データ部および前記
コード部と前記データ部とを管理する制御情報を含む目
的プログラムを生成するコンパイラにおいて、 前記ソースプログラム内のデータ定義記述がデータ実体
を予め含んでいるか否かを判定する判定手段と、 該判定手段により前記データ定義記述がデータ実体を含
んでいないと判定されると前記プログラム制御情報に前
記データ定義記述の領域を示す情報を設定するデータ部
生成手段とを有する。
(Means for Solving the Problems) In order to achieve the above object, the compilation method of the present invention provides an object program that includes a code section, a data section, and control information for managing the code section and the data section from a source program. A compiler that generates a compiler, comprising: a determining means for determining whether or not a data definition description in the source program includes a data entity in advance; and a determining means that determines that the data definition description does not include a data entity. and data section generation means for setting information indicating the area of the data definition description in the program control information.

(作用) 本発明のコンパイル方式においては、判定手段が、ソー
スプログラム内のデータ定義記述がデータ実体を予め含
んでいないと判定すると、データ部生成手段は、プログ
ラム制御情報にデータ定義記述の領域を示す情報を設定
する。
(Operation) In the compilation method of the present invention, when the determination means determines that the data definition description in the source program does not include a data entity in advance, the data part generation means adds the area of the data definition description to the program control information. Set the information to be displayed.

(実施例) 次に、本発明の実施例について図面を参照して詳細に説
明する。
(Example) Next, an example of the present invention will be described in detail with reference to the drawings.

第1図は本発明の実施例の構成図であり、1はコンパイ
ラ、2,3.4はコンパイラ1に接続されたファイル装
置であり、ファイル装置2はソースプログラム21を、
ファイル装置3は中間テキストファイル31を、ファイ
ル装!4はプログラム制御情報部42とデータ部43と
コード部44とをそれぞれ含む、コンパイラ1は、判定
手段12を含んだフロントエンド部11およびデータ部
生成手段14を有するバックエンド部13から構成され
ている。また、データ部生成手段14はバッファαを含
んでいる。
FIG. 1 is a configuration diagram of an embodiment of the present invention, in which 1 is a compiler, 2, 3.4 are file devices connected to the compiler 1, and the file device 2 stores a source program 21.
The file device 3 stores the intermediate text file 31 as a file! 4 includes a program control information section 42, a data section 43, and a code section 44, respectively.The compiler 1 is composed of a front end section 11 including a determining means 12 and a back end section 13 having a data section generating means 14. There is. Further, the data portion generating means 14 includes a buffer α.

第2図は、データ記述定義の中間テキストの形式を示し
たものである。第2図(a)の初期テキスト51はデー
タ記述定義に実際のデータが予めある場合の中間テキス
トの形式を示したものであり、実際のデータであるデー
タ実体Cとデータ実体Cの長さ(例えばバイト長)であ
る長さBと、データ実体Cを格納する際のアドレスを示
すデータアドレスAとから構成されている。第2図(b
)は初期値なしテキスト52の形式を示したものであり
、同図(a)における初期値テキスト51のデータ実体
Cを取り除いたものと同一である。なお、初期値なしテ
キスト52においては、データ実体Cは例えばプログラ
ム実行時にプログラムにより生成されるか、又は外部か
ら入力される。
FIG. 2 shows the format of the intermediate text of the data description definition. The initial text 51 in FIG. 2(a) shows the format of the intermediate text when the data description definition already contains actual data, and the length of the data entity C (actual data) and the data entity C ( For example, the length B is a byte length), and the data address A is the address at which the data entity C is stored. Figure 2 (b
) shows the format of the text 52 without an initial value, which is the same as the initial value text 51 in FIG. 5(a) with the data entity C removed. Note that in the text 52 without initial values, the data entity C is generated by the program when the program is executed, or input from the outside.

第3図はデータ部生成手段13の処理例を示す流れ図で
ある。
FIG. 3 is a flowchart showing an example of processing by the data section generating means 13.

次に、各図を参照して本発明の実施例の動作を説明する
。外部よりコンパイラ1が起動されると、各手段が動作
を始め、先ず、フロントエンド部11はファイル装置2
内のソースプログラム21を入力してソースプログラム
21を検索してデータ記述定義を見つけ、データ定義記
述を見つける毎に判定手段12を起動する。起動された
判定手段12は、このデータ定義記述がデータ実体を持
つか否かを判定する。
Next, the operation of the embodiment of the present invention will be explained with reference to each figure. When the compiler 1 is started from the outside, each means starts operating. First, the front end section 11 starts the file device 2.
The source program 21 is input, the source program 21 is searched to find a data description definition, and the determining means 12 is activated each time a data definition description is found. The activated determining means 12 determines whether this data definition description has a data entity.

データ実体を持つ場合は、第2図(a)に示す初期値テ
キスト51を生成し、データ実体を持たない場合は同図
(b)に示す初期値なしテキスト52を生成してファイ
ル装置3内の中間テキストファイル31に出力する。こ
のような処理をソースプログラム21内の全てのデータ
記述定義に対して行う、なお、データ記述定義以外たと
えば命令部については従来と同様の処理を行い、処理結
果を中間テキストファイル31に出力する。
If the data entity is present, the initial value text 51 shown in FIG. 2(a) is generated, and if the data entity is not present, the initial value text 52 shown in FIG. is output to an intermediate text file 31. Such processing is performed on all the data description definitions in the source program 21. In addition, for example, the instruction part other than the data description definitions, the same processing as conventional is performed, and the processing results are output to the intermediate text file 31.

次に、バックエンド部13はファイル装置3内の中間テ
キストファイル31を入力し、初期値テキスト51およ
び初期値なしテキスト52を所定のエリアに格納する。
Next, the back end unit 13 inputs the intermediate text file 31 in the file device 3 and stores the initial value text 51 and the text without initial value 52 in a predetermined area.

そして、データ部生成手段14を起動する。起動された
データ部生成手段14は、第3図に示すように、ステッ
プS1で、バックエンド部13が格納したエリアから一
つの中間デキスト(初期値テキスト51および初期値な
しテキスト52)を取り出し、ステップS2で取り出し
た中間テキストが初期値テキスト51か否かを判定する
Then, the data part generation means 14 is activated. As shown in FIG. 3, the activated data part generation means 14 takes out one intermediate text (initial value text 51 and no initial value text 52) from the area stored by the back end part 13 in step S1, and It is determined whether the intermediate text extracted in step S2 is the initial value text 51 or not.

初期値なしテキスト52のときは(ステップS2でNo
)、ステップS7でバッファαに初期値なしテキスト5
2が格納されているか否かを判定する。バッファαに初
期値なしテキスト52が格納されていないときは(ステ
ップS7でNo)、ステップS9で取り出した初期値な
しテキスト52をバッファαに格納してステップ310
に進む0反対に、バッファαに初期値なしテキスト52
が格納されているときは(ステップS7でYES)、ス
テップS8でバッファαに格納されている初期値なしテ
キスト52を更新する。即ち、バッファαに格納されて
いる初期値なしテキスト52および今取り出した初期値
なしテキスト52のデータアドレスAと長さBにより次
の処理を行う。
When the text 52 has no initial value (No in step S2)
), in step S7, text 5 with no initial value is stored in buffer α.
2 is stored. If the text 52 without an initial value is not stored in the buffer α (No in step S7), the text 52 without an initial value retrieved in step S9 is stored in the buffer α, and step 310
Proceed to 0 Conversely, buffer α has no initial value text 52
is stored (YES in step S7), the text 52 without initial value stored in the buffer α is updated in step S8. That is, the following processing is performed using the data address A and length B of the text 52 without an initial value stored in the buffer α and the text 52 without an initial value just taken out.

■データアドレスが連続している場合 バッファαに格納されている初期値なしテキスト52の
データアドレスAに長さBを加えた値と今回取り出した
初期値なしテキスト52のデータアドレスAの値とが連
続しているときは、バッファαに格納されている長さB
に今回取り出しな初期値なしテキスト52の長さBを加
える。
■If the data addresses are consecutive The value obtained by adding the length B to the data address A of the text 52 without an initial value stored in the buffer α and the value of the data address A of the text 52 without an initial value extracted this time are If it is continuous, the length B stored in buffer α
Add the length B of the text 52 without an initial value to be extracted this time.

■データアドレスが連続していない場合■のようにデー
タアドレスAに長さBを加えた値が今回取り出した初期
値なしテキスト52のアドレスAの値とが連続していな
いときは、バッファαに格納されている長さBに今回取
り出した初期値なしテキスト52のアドレスAと長さB
とを加える。
■When the data addresses are not consecutive As in ■, when the value of data address A plus length B is not consecutive with the value of address A of text 52 with no initial value retrieved this time, the buffer α is The stored length B is the address A and length B of the text 52 with no initial value extracted this time.
and add.

ステップS2で初期値アドレス51と判定したときは、
ステップS3でファイル装置4内の目的プログラム41
のデータ部のデータを生成する。
When it is determined in step S2 that the initial value address is 51,
In step S3, the target program 41 in the file device 4
Generate data for the data section of.

そして、ステップS4でバッファαに初期値なしテキス
ト52か格納されているか否かを判定し、格納されてい
ないときは、ステップS10に進む。
Then, in step S4, it is determined whether or not the text 52 without an initial value is stored in the buffer α, and if it is not stored, the process advances to step S10.

反対にバッファαに初期値なしテキスト52が格納され
ているときは、バッファα内の初期値なしテキスト52
に基づいてプログラム制御情報部42に領域(例えばア
ドレスおよび長さ)情報を設定し、バッファαをクリア
し、ステップ910へ進む、ステップS10でバックエ
ンド部13により格納された全てのテキストに対して処
理が終了したか否かを判定し、まだ処理していないテキ
ストがあるときは上述した処理を繰り返す、処理するデ
キスト52がなくなったら(ステップS10でYES)
ステップSllでバッファαに初期値なしテキスト52
が格納されているか否かを判定し、バッファαに格納さ
れていないときは処理を終了する。一方、バッファαに
初期値なしテキスト52が格納されているときはステッ
プS5と同様の処理を行なってプログラム制御情報部4
2に情報を設定し、処理を終える。なお、命令部は従来
と同様に処理されコード部44に格納される。
On the other hand, when the text 52 without an initial value is stored in the buffer α, the text 52 without an initial value in the buffer α is
Set area (for example, address and length) information in the program control information section 42 based on , clear the buffer α, and proceed to step 910. It is determined whether or not the processing has been completed, and if there is text that has not been processed yet, the above-mentioned processing is repeated, and when there is no more text 52 to be processed (YES in step S10).
Text 52 with no initial value in buffer α in step Sll
is stored in the buffer α, and if it is not stored in the buffer α, the process ends. On the other hand, when the text 52 without an initial value is stored in the buffer α, the program control information section 4 performs the same process as step S5.
2, and complete the process. Note that the instruction part is processed and stored in the code part 44 in the same manner as before.

(発明の効果) 以上に説明したように、本発明のコンパイル方式は、デ
ータ記述定義にデータ実体を予め持つか否かを判定して
データ実体を持たないときは、その領域情報(アドレス
および長さ)を設定することにより目的プログラムの容
量を小さくすることができ、ファイルの容量などの保管
コストを大幅に削減することができる。
(Effects of the Invention) As explained above, the compilation method of the present invention determines whether or not a data description definition has a data entity in advance, and when the data entity does not exist, the area information (address and length) is determined. By setting the size of the target program, the capacity of the target program can be reduced, and storage costs such as file capacity can be significantly reduced.

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

第1図は本発明の実施例の構成図、 第2図は中間テキストの構成例を示す図、第3図はデー
タ部生成手段13の処理例を示す流れ図である。 1・・・コンパイラ、2.3.4・・・ファイル装置、
11・・・フロントエンド部、12・・・判定手段、1
3・・・バックエンド部、14・・・データ部生成手段
、21・・・ソースプログラム、31・・・中間テキス
トファイル、42・・・プログラム制御情報部、43・
・・データ部、44・・・コード部。
FIG. 1 is a block diagram of an embodiment of the present invention, FIG. 2 is a diagram showing an example of the structure of intermediate text, and FIG. 3 is a flowchart showing an example of processing by the data section generating means 13. 1... Compiler, 2.3.4... File device,
11... Front end section, 12... Judgment means, 1
3... Back end section, 14... Data section generation means, 21... Source program, 31... Intermediate text file, 42... Program control information section, 43.
...Data section, 44...Code section.

Claims (1)

【特許請求の範囲】 ソースプログラムからコード部、データ部および前記コ
ード部と前記データ部とを管理する制御情報を含む目的
プログラムを生成するコンパイラにおいて、 前記ソースプログラム内のデータ定義記述がデータ実体
を予め含んでいるか否かを判定する判定手段と、 該判定手段により前記データ定義記述がデータ実体を含
んでいないと判定されると前記プログラム制御情報に前
記データ定義記述の領域を示す情報を設定するデータ部
生成手段と を設けたことを特徴とするコンパイル方式。
[Claims] In a compiler that generates a target program including a code section, a data section, and control information for managing the code section and the data section from a source program, a data definition description in the source program defines a data entity. determining means for determining in advance whether or not the data definition description includes the data entity; and when the determining means determines that the data definition description does not include the data entity, setting information indicating the area of the data definition description in the program control information. A compilation method characterized by comprising a data part generation means.
JP2051489A 1989-01-30 1989-01-30 Compiling system Pending JPH02201541A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2051489A JPH02201541A (en) 1989-01-30 1989-01-30 Compiling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2051489A JPH02201541A (en) 1989-01-30 1989-01-30 Compiling system

Publications (1)

Publication Number Publication Date
JPH02201541A true JPH02201541A (en) 1990-08-09

Family

ID=12029267

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2051489A Pending JPH02201541A (en) 1989-01-30 1989-01-30 Compiling system

Country Status (1)

Country Link
JP (1) JPH02201541A (en)

Similar Documents

Publication Publication Date Title
JPH02201541A (en) Compiling system
JP2556148B2 (en) Vector register allocation method
JP4260895B2 (en) Multiple format addressing in microcontrollers
JP2764358B2 (en) Data driven information processor
JPH08272411A (en) Ladder instruction processor
JPH06266562A (en) Object code size optimizing system in object-oriented language processing system
JPH07129408A (en) Executing system for language processing program
JP2721377B2 (en) BASIC program compression method
JP3237591B2 (en) Compiling device, compiling method, and recording medium recording compiler
JPH0239242A (en) Temporary work area allocation system for electronic computer system
JPH0991151A (en) Compiler and processor system
JPH0778087A (en) Compiler device
JPH02178847A (en) System for generating data table for reexecution of program
JPH06324882A (en) Compiler device
JPH02130637A (en) Source code translating system
JPH0390931A (en) Generation of rom transformation program
JPH07160512A (en) Compile system
JPH0285931A (en) Intensifying system for optimization of function call
JPS62182843A (en) Fast compiling/linking system
JPH07141189A (en) Overlay linking system
JPH0792757B2 (en) Optimal data allocation method
JPH08123692A (en) Method and device for register allocation
JPH0362238A (en) Back-up system for decision of file capacity
JPS60200341A (en) Virtual head addressing system of character data
JPH11175344A (en) Knowledge base system