JPS6359632A - Compiler control system - Google Patents

Compiler control system

Info

Publication number
JPS6359632A
JPS6359632A JP20322186A JP20322186A JPS6359632A JP S6359632 A JPS6359632 A JP S6359632A JP 20322186 A JP20322186 A JP 20322186A JP 20322186 A JP20322186 A JP 20322186A JP S6359632 A JPS6359632 A JP S6359632A
Authority
JP
Japan
Prior art keywords
variables
block
blocks
area
text
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
JP20322186A
Other languages
Japanese (ja)
Inventor
Junichi Oda
尾田 順一
Rieko Shimazu
嶋津 理恵子
Norie Murota
室田 紀恵
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.)
PFU Ltd
Original Assignee
PFU 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 PFU Ltd filed Critical PFU Ltd
Priority to JP20322186A priority Critical patent/JPS6359632A/en
Publication of JPS6359632A publication Critical patent/JPS6359632A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce capacities of the second intermediate text area and a dictionary memory by taking variables common to blocks and individual variables of blocks into consideration as variables and dividing a source text into blocks to execute the processing. CONSTITUTION:A designated area 4 is prepared on a dictionary memory 21 and variables common to blocks are stored there, and individual variables of blocks in a function func1 are stored in a rewritable area 5. After the compiling processing, contents of the rewritable area 5 are cleared. In the processing of a block 2, new variables common to blocks do not appear and an object concerning a function func2 is generated, and individual variables of this block are cleared after compiling. In the processing of a block 3, new variables common to blocks appear and are added to the designated area 4, and an object concerning a function func3 is generated, and individual variables of this block are cleared after compiling.

Description

【発明の詳細な説明】 〔概要〕 与えられたソース・テキストから、ターゲット・マシン
に対応したオブジェクト・プログラムを生成するコンパ
イラにおいて、ソース・テキストをブロックの単位で順
次コンパイル処理して全体をコンパイルするよう構成し
、各ブロックを単位としてのコンパイル処理に当たって
、ブロック間共通変数については辞書メモリ上に残すと
共に。
[Detailed Description of the Invention] [Summary] A compiler that generates an object program compatible with a target machine from a given source text, compiles the entire source text by sequentially compiling it in block units. When compiling each block as a unit, common variables between blocks are left in the dictionary memory.

ブロック個別変数については処理後に辞書メモリ上でク
リヤするようにし、外部記憶装置を使用せず小容量の主
メモリを用いて効率よくコンパイル処理を行うコンパイ
ラ制御方式が開示されている。
A compiler control method has been disclosed in which block individual variables are cleared in a dictionary memory after processing, and compiling processing is efficiently performed using a small-capacity main memory without using an external storage device.

〔産業上の利用分野〕[Industrial application field]

本発明は、コンパイラ制御方式、特にソース・テキスト
をブロックの単位で逐次コンパイルしてゆくようにした
コンパイラ制御方式に関する。
The present invention relates to a compiler control method, and particularly to a compiler control method that sequentially compiles source text in blocks.

〔従来の技術〕[Conventional technology]

従来から、与えられたソース・テキストを読込んで、所
望するターゲット・マシンに対応したオブジェクト・プ
ログラムを生成することが行われている。当該オブジェ
クト・プログラムを生成するコンパイラは、構文解析フ
ェーズと最適化フェーズとコード生成フェーズとをそな
えており。
Conventionally, a given source text is read and an object program corresponding to a desired target machine is generated. A compiler that generates the object program has a syntax analysis phase, an optimization phase, and a code generation phase.

ソース・テキストを中間テキストに変換し、当該中間テ
キストを最適化し1次いで最適化された中間テキストを
コード化するようにされている。
The system converts source text into intermediate text, optimizes the intermediate text, and then encodes the optimized intermediate text.

第3図はコンパイラの一般的構成を示しており。Figure 3 shows the general configuration of the compiler.

10はブリプロセッサであって2図示ソース・テキスト
(JEF)16を読み込む第1中間テキスト18をつく
ると共に、EBCplCコード化したソース・テキスト
17をつくる。11は構文解析フェーズであって、第1
中間テキスト18にもとづき、主メモリ15を利用しつ
つ、第2中間テキストをつくる。12は最適化フェーズ
であって。
Reference numeral 10 denotes a pre-processor which reads the illustrated source text (JEF) 16 and creates a first intermediate text 18, and also creates an EBCplC encoded source text 17. 11 is a parsing phase, the first
A second intermediate text is created based on the intermediate text 18 while using the main memory 15. 12 is an optimization phase.

第2中間テキストについて、主メモリ15を利用しつつ
、最適化をはかる。13はコード生成フェーズであって
、最適化されている中間テキストについて5主メモリ1
5を利用しつつ、コード化を行い、オブジェクト・プロ
グラム19を生成する。また14は制御部でありコンパ
イラ全体を制御する。更に20はオブジェクトに関する
プリント出力を表している。なお本発明にいう辞書メモ
リは9図示の如く、主メモリ15内に辞書メモリ21と
して存在していると考えてよい。
The second intermediate text is optimized while using the main memory 15. 13 is a code generation phase in which 5 main memories 1 are used for the intermediate text being optimized.
5, the object program 19 is generated. Further, 14 is a control unit that controls the entire compiler. Furthermore, 20 represents a printout regarding the object. Note that the dictionary memory according to the present invention can be considered to exist as a dictionary memory 21 in the main memory 15, as shown in FIG.

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

従来の場合、与えられたソース・テキストが全体として
ブリプロセッサ10に供給され、当該全体を考慮してコ
ンパイル処理が行われていた。このために、従来の場合
には、変数を格納しておく辞書メモリ21および第2中
間テキストを格納するための領域22として多くの容量
を必要としていた。
In the conventional case, a given source text was supplied as a whole to the pre-processor 10, and the compilation process was performed taking the whole into consideration. For this reason, in the conventional case, a large capacity was required for the dictionary memory 21 for storing variables and the area 22 for storing the second intermediate text.

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

本発明は上記の点を解決しており、変数として。 The present invention solves the above points, and as a variable.

ブロック間共通変数とブロック個別変数とを意識するこ
とによって、ソース・テキストをブロックに区分して、
ブロックを単位として1例えば第3図において、要素1
1、12.13に対応する処理を実行してゆくようにし
ている。
By being aware of inter-block common variables and block individual variables, the source text can be divided into blocks,
Block as unit 1 For example, in Figure 3, element 1
1, 12, and 13 are executed.

第1図は本発明の原理構成図を示す。図中の符号16は
ソース・テキスト、  1. 2. 3.・・・・・・
は夫々ブロック、1−1.3−1は夫々ブロック間共通
変数指定部、1−2.2−2.3−2は夫々関数指定部
、21は辞書メモリ、4は指定領域。
FIG. 1 shows a basic configuration diagram of the present invention. Reference numeral 16 in the figure is the source text; 1. 2. 3.・・・・・・
1-1.3-1 are inter-block common variable specification sections, 1-2.2-2.3-2 are function specification sections, 21 is a dictionary memory, and 4 is a specification area.

5は書替え可能領域を表している。また■、■。5 represents a rewritable area. Also ■, ■.

・・・・・・■は処理の経過順序を表している。. . .■ represents the progress order of processing.

与えられたソース・テキスト16は、少なくとも1つの
関数を含む形に複数のブロック1、2゜3・・・・・・
に区分される。そしてブロックを単位として逐次コンパ
イルされるようにされる。
A given source text 16 is composed of a plurality of blocks 1, 2, 3, etc. containing at least one function.
It is divided into Then, the blocks are compiled sequentially.

本発明の場合、ブロックを単位として処理を進めること
から、コンパイルに当たって必要とする変数として。
In the case of the present invention, since processing proceeds in units of blocks, this is a variable required during compilation.

(i)当該フ゛ロフク以降のフ゛ロックについてのコン
パイル処理に当たって、複数のブロックにわたって共通
に使用される変数(ブロック間共通変数と呼ぶ・・・・
・・5tatic) 。
(i) Variables that are commonly used across multiple blocks (referred to as common variables between blocks...
...5tatic).

(ii)当該ブロックについてのコンパイル処理にのみ
使用される変数(ブロック個別変数と呼ぶ) 02つの概念に分けている。
(ii) Variables used only for compilation processing for the block (referred to as block individual variables) These are divided into two concepts.

そして、成るブロックについてのコンパイル処理に当た
って、ブロック間共通変数については。
And regarding the common variables between blocks when compiling the blocks.

辞書メモリ21における指定領域4に格納し、ブロック
個別変数については、辞書メモリ21における書替え可
能領域(いわば作業領域)に格納した上でコンパイル処
理が行われる。そして、当該コンパイル処理が終了する
と、そのときのブロック個別変数についてはクリヤされ
1次のブロックについてのコンパイル処理に移行するよ
うにされる。当然このとき、第2中間テキストを格納す
る領域も初期化され再利用される。
The data is stored in the specified area 4 in the dictionary memory 21, and the block individual variables are stored in the rewritable area (so to speak, a work area) in the dictionary memory 21, and then the compilation process is performed. When the compiling process is completed, the block individual variables at that time are cleared and the compiling process for the primary block is started. Naturally, at this time, the area for storing the second intermediate text is also initialized and reused.

〔作用〕[Effect]

第1図図示の■において辞書メモリ21上に指定領域4
が用意され、ブロック間共通変数が格納される。次いで
、関数func 1に関連して2図示■において、書替
え可能領域5上に関数func 1におけるブロック個
別変数(func 1のオブジェクト)が格納される。
The designated area 4 on the dictionary memory 21 in
is prepared and common variables between blocks are stored. Next, in relation to the function func 1, block individual variables (objects of func 1) in the function func 1 are stored in the rewritable area 5 as shown in 2 (2).

そして、コンパイル処理が行われた後に1図示■におい
て、書替え可能領域5の内容がクリヤされる(指定領域
4の内容は残り、以後の処理において使用される)。
Then, after the compiling process is performed, the contents of the rewritable area 5 are cleared at (2) in FIG. 1 (the contents of the designated area 4 remain and are used in subsequent processing).

ブロック2についての処理に当たっては、新たにブロッ
ク間共通変数は現れてなく9図示■、■の如(func
 2についてのオブジェクトが作成され。
When processing block 2, no new inter-block common variables appear, as shown in Figure 9 (func).
2 objects are created.

コンパイルの後にクリヤされる。Cleared after compilation.

図示のブロック3についての処理に当たっては。Regarding the processing regarding block 3 shown in the figure.

新たにブロック間共通変数は現れており、指定領域4上
に追加され、 func3についてのオブジェクトが作
成され、コンパイル後にクリヤされる。
A new inter-block common variable appears, is added to designated area 4, an object for func3 is created, and is cleared after compilation.

以上のように処理が行われることから、辞書メそす21
の容量は、ブロック間共通変数と、処理中のブロックに
ついてのブロック個別変数とを格納できる大きさであれ
ば足りる。また第2中間テキスHIT域に関してもソー
ス全体を格納する領域は必要ではなく、1つのブロック
を格納する大きさであれば足りる。
Since the processing is performed as described above, the dictionary method 21
The capacity of is sufficient as long as it can store inter-block common variables and block individual variables for the block being processed. Also, regarding the second intermediate text HIT area, it is not necessary to have an area for storing the entire source, and it is sufficient that the area is large enough to store one block.

〔実施例〕〔Example〕

第2図は実施例を示し3図中の符号1.1−1゜1−2
.2.2−1.2−2.4,5,16.21は第1図に
対応している。また’5tatic int”で示す所
のvar l+ var 2+ var 3. var
 4は数値であって本発明にいうブロック間共通変数を
表し。
Figure 2 shows an example, and the symbol 1.1-1゜1-2 in Figure 3
.. 2.2-1.2-2.4, 5, 16.21 correspond to FIG. Also, var l+ var 2+ var 3. var shown in '5tatic int'
4 is a numerical value and represents an inter-block common variable according to the present invention.

”5hort″、“int”、”long”、“uns
igned”で示す所のa。
"5hort", "int", "long", "uns"
igned”.

b、  1.  u、  *p、 var3は夫々ブロ
ック個別変数を表している。なお図示の場合、変数va
r 3はブロック2におけるブロック個別変数としても
使用されている。
b.1. u, *p, and var3 represent block individual variables, respectively. In addition, in the case shown, the variable va
r3 is also used as a block individual variable in block 2.

ブロックlを受入れた際に、ブロック間共通変数var
 1とvar 2とが指定領域4上に格納される。
When block l is accepted, inter-block common variable var
1 and var 2 are stored on the designated area 4.

またブロック1に定義されている関数mainにおいて
、ブロック個別変数として、  (i ) 5hort
 intとして変数aが、(ii)通常のint  (
整数)として変数すが、  (iii)long in
tとして変数lが夫々与えられていることから、これら
の各変数a、b。
Also, in the function main defined in block 1, as a block individual variable, (i) 5hort
If the variable a is an int, (ii) a normal int (
(iii) long in
Since the variable l is given as t, each of these variables a and b.

lが書替え可能領域5に格納される。この状態の下でブ
ロック1についてのコンパイル処理が行われ、終了する
と、変数a、b、1がクリヤされると共に、第2中間テ
キスト領域22の内容も初期化される。
l is stored in the rewritable area 5. Under this state, the compilation process for block 1 is performed, and when it is completed, variables a, b, and 1 are cleared, and the contents of the second intermediate text area 22 are also initialized.

ブロック2についての処理に対応して、プロ。In response to processing regarding block 2, Pro.

り間共通変数var 3とvar4とが与えられており
Common variables var3 and var4 are given.

指定領域4上に追加される。またブロック2についての
ブロック個別変数として、  (i ) unsign
edintとして変数Uが、(ii)通常のintとし
て変数*pが、  (iii)long intとして
変数var 3が与えられており、書替え可能領域5に
格納される。
It is added on the designated area 4. Also, as a block individual variable for block 2, (i) unsign
A variable U is given as edint, (ii) a variable *p is given as a normal int, and (iii) a variable var 3 is given as a long int, and these are stored in the rewritable area 5.

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

以上説明した如く9本発明によれば、使用する第2中間
テキスト領域および辞書メモリとして比較的小容量のも
のを用いることが可能となる。
As described above, according to the present invention, it is possible to use a relatively small capacity second intermediate text area and dictionary memory.

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

第1図は本発明の原理構成図、第2図は本発明の実施例
、第3図はコンパイラの構成を示す。 図中、1、2.3・・・・・・は夫々ブロック、1−1
゜2−1.3−1は・・・・・・夫々ブロック間共通変
数指定部、4は指定領域、5は書替え可能領域、10は
プリプロセッサ、11は構文解析フェーズ、12は最適
化フェーズ、13はコード生成フェーズ。 16はソース・テキスト、19はオブジェクト・プログ
ラム、21は辞書メモリ、22は第2中間テキスト領域
を表す。 特許出願人 ユーザツク電子工業株式会社代理人弁理士
 森 1)寛 (外2名)フンノマイチ倣づト溝窩 刀 3 口
FIG. 1 shows the principle configuration of the present invention, FIG. 2 shows an embodiment of the invention, and FIG. 3 shows the configuration of a compiler. In the figure, 1, 2.3... are blocks, respectively, and 1-1
゜2-1.3-1 are respectively inter-block common variable specification parts, 4 is a specification area, 5 is a rewritable area, 10 is a preprocessor, 11 is a syntax analysis phase, 12 is an optimization phase, 13 is the code generation phase. Reference numeral 16 represents a source text, 19 an object program, 21 a dictionary memory, and 22 a second intermediate text area. Patent Applicant: Usatsuk Electronic Industry Co., Ltd. Representative Patent Attorney Mori 1) Hiroshi (and 2 others) Funnomichi Imitation Zuto Mizoho Sword 3 Kuchi

Claims (1)

【特許請求の範囲】 与えられたソース・テキスト(16)を読込むプリプロ
セッサ(10)をそなえ、当該読込んだソース・テキス
トについて構文解析を行う構文解析フェーズ(11)と
、当該構文解析フェーズ(11)によって得られた中間
テキストについて最適化を行う最適化フェーズ(12)
と、最通化された中間テキストについてターゲット・マ
シンに対応した形にコード化を行うコード生成フェーズ
(13)とを実行し、上記与えられたソース・テキスト
からオブジェクト・プログラム(19)を生成するコン
パイラにおいて、少なくとも1つの関数を含む所の複数
のブロック(1、2、3)よりなる上記ソース・テキス
ト(16)について、ブロックを単位としてコンパイル
処理を行うよう構成されてなり、 処理対象となっているブロックにおいて定義されたブロ
ック間共通変数(var1など)を辞書メモリ(21)
上の予め定めた指定領域(4)内に格納すると共に、当
該ブロックにおいて定義されたブロック個別変数(a、
bなど)を辞書メモリ(21)上の書替え可能領域(5
)内に格納する第1の処理と、当該処理対象となってい
るブロックについて、上記予め定めた指定領域(4)内
の変数と上記書替え可能領域(5)内の変数とを用いて
コンパイル処理を実行する第2の処理と、 当該処理対象となっているブロックについて、当該コン
パイル処理が終了した後に、上記予め定めた指定領域(
4)内の変数を残しかつ上記書替え可能領域(5)内の
変数をクリヤし、次のブロックについての上記第1の処
理に引継ぐ第3の処理と、が逐次実行される ことを特徴とするコンパイラ制御方式。
[Claims] A parsing phase (11) comprising a preprocessor (10) that reads a given source text (16) and parsing the read source text; Optimization phase (12) in which the intermediate text obtained by 11) is optimized.
and a code generation phase (13) in which the encoded intermediate text is coded in a form compatible with the target machine, and a compiler that generates an object program (19) from the given source text. , the source text (16) consisting of a plurality of blocks (1, 2, 3) including at least one function is configured to be compiled in units of blocks, and is a processing target. The inter-block common variables (var1, etc.) defined in the block are stored in the dictionary memory (21).
The block individual variables (a,
b, etc.) in the rewritable area (5) on the dictionary memory (21).
) and compile processing for the block to be processed using the variables in the predetermined specified area (4) and the variables in the rewritable area (5). The second process executes the above-mentioned predetermined designated area (
and a third process that leaves the variables in 4) and clears the variables in the rewritable area (5), and takes over the first process for the next block. Compiler control method.
JP20322186A 1986-08-29 1986-08-29 Compiler control system Pending JPS6359632A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP20322186A JPS6359632A (en) 1986-08-29 1986-08-29 Compiler control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20322186A JPS6359632A (en) 1986-08-29 1986-08-29 Compiler control system

Publications (1)

Publication Number Publication Date
JPS6359632A true JPS6359632A (en) 1988-03-15

Family

ID=16470462

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20322186A Pending JPS6359632A (en) 1986-08-29 1986-08-29 Compiler control system

Country Status (1)

Country Link
JP (1) JPS6359632A (en)

Similar Documents

Publication Publication Date Title
Aho et al. On finding lowest common ancestors in trees
DE69722138T2 (en) Code optimizer for pipeline computers
DE19815865B4 (en) Compilation system and method for reconfigurable computing
US6725448B1 (en) System to optimally create parallel processes and recording medium
DE69918334T2 (en) GENERATION OF COMPILED PROGRAMS FOR INTERPRETATE TIME ENVIRONMENTS
DE112012000303T5 (en) Dynamic binary optimization
CN102132249A (en) Bulk-synchronous graphics processing unit programming
EP0428560A4 (en) Machine process for translating programs in binary machine language into another binary machine language
DE19524402C2 (en) Program execution control device with addressability according to an M-row pseudo-random number sequence
WO1989001203A1 (en) Mimd computer system
JPH06110703A (en) Method of compilation
Celorrio et al. Computing plans with control flow and procedures using a classical planner
JPS6359632A (en) Compiler control system
Nicolau et al. Register allocation, renaming and their impact on fine-grain parallelism
Goguen et al. The rewrite rule machine
Mogensen Evolution of partial evaluators: removing inherited limits
Dekeyser et al. Supporting irregular and dynamic computations in data parallel languages
Lins On the efficiency of categorical combinators as a rewriting system
Wiedmann Efficiency in the APL environment—a full arsenal for attacking CPU hogs
Karjoth XFSM: A formal model of communicating state machines for implementation specifications
Nöcker Efficient functional programming: Compilation and programming techniques
Chalabine Invasive interactive parallelization
JP3200277B2 (en) Sequence program processing method and apparatus
Napper Some proposals for SNAP, a language with formal macro facilities
JPS63318605A (en) Nc part program generating device