JPH0399329A - Objective program generating system - Google Patents

Objective program generating system

Info

Publication number
JPH0399329A
JPH0399329A JP23597889A JP23597889A JPH0399329A JP H0399329 A JPH0399329 A JP H0399329A JP 23597889 A JP23597889 A JP 23597889A JP 23597889 A JP23597889 A JP 23597889A JP H0399329 A JPH0399329 A JP H0399329A
Authority
JP
Japan
Prior art keywords
program
intermediate code
objective
code
generation
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
JP23597889A
Other languages
Japanese (ja)
Inventor
Takao Sato
孝夫 佐藤
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 JP23597889A priority Critical patent/JPH0399329A/en
Publication of JPH0399329A publication Critical patent/JPH0399329A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To simplify the change of a target machine and the addition and change of an objective program by selecting an objective program generating program in accordance with an intermediate code and interpreting the selected program to generate the objective program. CONSTITUTION:An intermediate code input means 3 inputs the intermediate code 11 from a storage device 1 and an objective program selecting means 4 analyzes the code 11, recognizes an instruction and selects a corresponding objective program generating program 21 from a storage device 2. An objective program description language interpreter 5 interprets the selected program 21 and generates a code corresponding to the objective program to generate the objective program 6. In the case of changing the target machine or partially adding or changing the objective program, only the objective program formation program 21 is changed without changing the contents of the interpreter 5 or the like, so that the change can be simplified.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は原始プログラムから目的プログラムを生成する
言語処理システムにおいて、解析済み中間コードを目的
プログラムに変換する目的プログラム生成方式に関する
ものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a target program generation method for converting an analyzed intermediate code into a target program in a language processing system that generates a target program from a source program.

〔従来の技術〕[Conventional technology]

第3図は従来の目的プログラム生成方式の構成例を示し
たものであり、原始プログラムの各命令を目的プログラ
ム生成単位に変換した中間命令である解析済みの中間コ
ード11を格納した記憶装置1と、記憶装置1から中間
コード11を入力する中間コード入力手段3と、中間コ
ード入力手段3で入力した中間コードを解析して中間コ
ード対応目的プログラム生成手段群8から対応する中間
コード対応目的プログラム生成手段81.・・・を選択
する中間コード選択手段7と、中間コード選択手段7に
より選択された際に動作し、人力した中間コードを解析
してデータおよびレジスタ番号の設定等を行うと共に、
命令コード生成手段群9から個々の命令コードの種類に
対応する命令コード生成手段91.・・・の起動を行う
中間コード対応目的プログラム生成手段81.・・・と
、中間コード対応目的プログラム生成手段81.・・・
により起動されて動作し、命令コードを生成して目的プ
ログラム6を生成する命令コード生成手段91.・・・
とから構成されている。
FIG. 3 shows an example of the configuration of a conventional target program generation method, in which a storage device 1 stores an analyzed intermediate code 11, which is an intermediate instruction obtained by converting each instruction of a source program into a unit of target program generation. , an intermediate code input means 3 which inputs the intermediate code 11 from the storage device 1, and generates a corresponding intermediate code corresponding objective program from the intermediate code corresponding objective program generation means group 8 by analyzing the intermediate code inputted by the intermediate code input means 3. Means 81. An intermediate code selection means 7 selects ..., and operates when selected by the intermediate code selection means 7, analyzes the manually generated intermediate code and sets data and register numbers, etc.
An instruction code generation means 91 corresponding to each type of instruction code from the instruction code generation means group 9. . . . Intermediate code corresponding purpose program generation means 81. . . . and intermediate code corresponding objective program generation means 81. ...
instruction code generation means 91 which is activated and operated by and generates instruction codes to generate the target program 6; ...
It is composed of.

第4図は上記の従来例の動作例を示したものであり、中
間コード11として ADD DATA−A、 DATA−B、 DATA−
Cが与えられた場合を想定している。なお、この中間コ
ードは、DATA−Aの値とDATA−Bの値とを加算
してDATA−Cの値とする命令である。
FIG. 4 shows an example of the operation of the above conventional example, and the intermediate code 11 includes ADD DATA-A, DATA-B, DATA-
Assume that C is given. Note that this intermediate code is an instruction to add the value of DATA-A and the value of DATA-B to obtain the value of DATA-C.

しかして、第3図および第4図において、中間コード入
力手段3は記憶装置1から中間コード11を入力しくス
テップS1)、中間コード選択手段7は入力した中間コ
ード11を解析し、“ADD”という命令を認識して中
間コード対応目的プログラム生成手段群8から対応する
中間コード対応目的プログラム生成手段、例えば84を
選択する(ステップ52)0選択された中間コード対応
目的プログラム生成手段84は、目的プログラムの可変
部の設定、すなわちレジスタGRIにレジスタ番号°“
1′を設定すると共にメモリアドレス参照MEMIにデ
ータ参照DATA−Aを対応させ(ステップS3)、続
いて命令コード生成手段群9から対応する命令コード生
成手段、例えば94を起動して LOAD GRI、MEMI という命令コードを生成させる(ステップS4)。
3 and 4, the intermediate code input means 3 inputs the intermediate code 11 from the storage device 1 (step S1), and the intermediate code selection means 7 analyzes the input intermediate code 11 and selects "ADD". Recognizes this command and selects a corresponding intermediate code compatible objective program generating means, for example 84, from the intermediate code compatible objective program generating means group 8 (step 52) 0 The selected intermediate code compatible objective program generating means 84 is Setting the variable part of the program, i.e. register number °“ in register GRI
1' and make the data reference DATA-A correspond to the memory address reference MEMI (step S3). Then, the corresponding instruction code generation means from the instruction code generation means group 9, for example 94, is activated to LOAD GRI, MEMI. An instruction code is generated (step S4).

なお、この命令コードはメモリMBM1の値をレジスタ
GRIに転送することを内容とするものである。そして
、同様の処理を繰り返しくステップ35〜5IO)、入
力した中間コード11に対して最終的に LOAD GRI、MEMI LOAD  GR2,MEM2 ADD GRl、GR2 STORE GR2,MEM3 という内容のコードである目的プログラム6を生成する
。なお、第3行目の命令コードはレジスタGRIO値を
レジスタGR2の値に加えるものであり、第4行目の命
令コードはレジスタGR2の値をメモリMEM3に格納
するものである。
Note that this instruction code is intended to transfer the value of the memory MBM1 to the register GRI. Then, the same process is repeated (steps 35 to 5IO), and the final target program 6 is a code with the contents LOAD GRI, MEMI LOAD GR2, MEM2 ADD GRl, GR2 STORE GR2, MEM3 for the input intermediate code 11. generate. Note that the instruction code on the third line is for adding the value of the register GRIO to the value of the register GR2, and the instruction code on the fourth line is for storing the value of the register GR2 in the memory MEM3.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来の目的プログラム生成方式は上述したように行われ
ており、目的プログラムの生成に関しては何ら問題がな
かったが、生成した目的プログラム6を実行する電子計
算機(ターゲットマシン)の変更や目的プログラム60
部分的な追加・変更に対して柔軟性に欠けるという欠点
があった。
The conventional target program generation method was performed as described above, and there were no problems with the generation of the target program, but there were problems such as changing the computer (target machine) that executes the generated target program 6
The drawback was that it lacked flexibility when it came to partial additions and changes.

すなわち、第3図および第4図に示した従来例では、レ
ジスタ番号やアドレス情報の設定および命令コードの生
成が中間コード対応目的プログラム生成手段81.・・
・および命令コード生成手段91、・・・内の手続きに
全て依存するため、ターゲットマシンの変更にあっては
中間コード対応目的プログラム生成手段群8および命令
コード生成手段群9を原始プログラムの段階から全て作
り直さなければならず、非常に手間がかかるものであっ
た。
That is, in the conventional examples shown in FIGS. 3 and 4, the setting of register numbers and address information and the generation of instruction codes are performed by the intermediate code corresponding objective program generation means 81.・・・
- and the instruction code generation means 91, etc., so when changing the target machine, the intermediate code compatible objective program generation means group 8 and the instruction code generation means group 9 must be changed from the source program stage. Everything had to be recreated, which was extremely time-consuming.

また、目的プログラム6の部分的な追加・変更にあって
も、対応する中間コード対応目的プログラム生成手段お
よび命令コード生成手段を原始プログラムの段階から作
り直さなければならず、よって保守性が非常に悪いもの
であった。
Furthermore, even if there is a partial addition or change to the object program 6, the corresponding intermediate code corresponding object program generation means and instruction code generation means must be recreated from the source program stage, resulting in very poor maintainability. It was something.

本発明は上記の点に鑑み提案されたものであり、その目
的とするところは、ターゲットマシンの変更や目的プロ
グラムの部分的な追加・変更に対して容易に対処できる
目的プログラム生成方式を提供することにある。
The present invention has been proposed in view of the above points, and its purpose is to provide a target program generation method that can easily deal with changes in the target machine and partial additions and changes to the target program. There is a particular thing.

〔課題を解決するための手段〕[Means to solve the problem]

本発明は上記の目的を達成するため、記憶装置から解析
済み中間コードを入力する中間コード入力手段と、 目的プログラム記述言語で記述されデータ定義部および
コード生成手続き部を有する複数の目的プログラム生成
プログラムを格納した記憶装置から、前記入力手段によ
り入力された中間コードに対応する目的プログラム生成
プログラムを選択する目的プログラム選択手段と、 選択された目的プログラム生成プログラムをインタブリ
ートして目的プログラムを生成する目的プログラム記述
言語インタプリタとを備えるようにしている。
In order to achieve the above object, the present invention includes intermediate code input means for inputting an analyzed intermediate code from a storage device, and a plurality of object program generation programs written in an object program description language and having a data definition section and a code generation procedure section. an object program selecting means for selecting an object program generation program corresponding to the intermediate code inputted by the input means from a storage device storing the object program; and an object program for generating an object program by interleaving the selected object program generation program. A program description language interpreter is also provided.

〔作用〕[Effect]

本発明の目的プログラム生成方式にあっては、中間コー
ド入力手段が記憶装置から解析済み中間コードを入力し
、目的プログラム選択手段が、目的プログラム記述言語
で記述されデータ定義部およびコード生成手続き部を有
する複数の目的プログラム生成プログラムを格納した記
憶装置から、入力手段により入力された中間コードに対
応する目的プログラム生成プログラムを選択し、目的プ
ログラム記述言語インタプリタが選択された目的プログ
ラム生成プログラムをインクブリートして目的プログラ
ムを生成する。
In the object program generation method of the present invention, the intermediate code input means inputs the analyzed intermediate code from the storage device, and the object program selection means includes a data definition section and a code generation procedure section written in an object program description language. A target program generation program corresponding to the intermediate code input by the input means is selected from a storage device storing a plurality of target program generation programs, and the target program description language interpreter inks the selected target program generation program. generate the target program.

〔実施例〕〔Example〕

以下、本発明の実施例につき図面を参照して説明する。 Embodiments of the present invention will be described below with reference to the drawings.

第1図は本発明の目的プログラム生成方式の一実施例を
示す構成図である。第1図において、本実施例は、原始
プログラムの各命令を目的プログラム生成単位に変換し
た中間命令である解析済みの中間コード11を格納した
記憶装置lと、記憶装置1から中間コードエ1を入力す
る中間コード入力手段3と、目的プログラム記述言語で
記述されデータ定義部およびコード生成手続き部を有す
る複数の目的プログラム生成プログラム21を格納した
記憶装置2と、入力手段3により人力された中間コード
11に対応する目的プログラム生成プログラム21を選
択する目的プログラム選択手段4と、選択された目的プ
ログラム生成プログラム21をインタブリートして目的
フ゛ログラム6を生成する目的プログラム記述言語イン
タプリタ5とから構成されている。
FIG. 1 is a block diagram showing an embodiment of the target program generation method of the present invention. In FIG. 1, this embodiment has a storage device 1 that stores an analyzed intermediate code 11, which is an intermediate instruction obtained by converting each instruction of a source program into a target program generation unit, and an intermediate code 1 that is input from the storage device 1. intermediate code input means 3, a storage device 2 storing a plurality of object program generation programs 21 written in an object program description language and having a data definition section and a code generation procedure section; and intermediate code 11 manually input by the input means 3. The target program selection means 4 selects the target program generation program 21 corresponding to the target program generation program 21, and the target program description language interpreter 5 generates the target program 6 by interleaving the selected target program generation program 21. .

第2図は第1図の実施例の動作例を示したものであり、
中間コード11として MOVB DATA−A DATA−Bが与えられた場
合を想定している。なお、この中間コードは、DATA
−Aの内容をDATA−Bの内容として転記する命令で
ある。
FIG. 2 shows an example of the operation of the embodiment shown in FIG.
It is assumed that MOVB DATA-A DATA-B is given as the intermediate code 11. Note that this intermediate code is DATA
This is an instruction to transfer the contents of -A as the contents of DATA-B.

しかして、第1図および第2図において、中間コード人
力手段3は記憶装置1から中間コード11を入力しくス
テップS1)、目的プログラム選択手段4は中間コード
11を解析し、“’MOVE″という命令を認識して記
憶装置2から対応する目的プログラム生成プログラム2
1を選択する(ステップS2)。
1 and 2, the intermediate code manual means 3 inputs the intermediate code 11 from the storage device 1 (step S1), and the target program selection means 4 analyzes the intermediate code 11 and selects "'MOVE". A target program generation program 2 that recognizes the command and generates a corresponding target program from the storage device 2
1 is selected (step S2).

ここで、目的プログラム生成プログラム21は“M O
V B ”命令に対して例えば図示のような記述となっ
ており、データ宣言部21aとコード生成手続き部21
bとを有している。すなわち、データ宣言部21aでは
パラメータPAPI、PAR2として受は渡されたデー
タDATA−A、DATA−Bを宣言文“D CL ”
によりトークンTOKEN−A、TOKEN−Bと対応
付けると共に、レジスタGRI、GR2,GR3にレジ
スタ番号を割り付ける。また、コード生成手続き部21
bでは、トークンTOKEN−Aが数字である場合とそ
れ以外とに分け、数字の場合はMVD TOKEN−A
 TOKEN−B。
Here, the target program generation program 21 is “M O
For example, the description for the "VB" instruction is as shown in the figure, and the data declaration section 21a and code generation procedure section 21
It has b. That is, in the data declaration section 21a, the data DATA-A and DATA-B received as parameters PAPI and PAR2 are declared in the declaration statement "D CL".
The tokens are associated with the tokens TOKEN-A and TOKEN-B, and register numbers are assigned to the registers GRI, GR2, and GR3. In addition, the code generation procedure section 21
In b, the token TOKEN-A is divided into cases where it is a number and cases where it is not, and if it is a number, it is MVD TOKEN-A.
TOKEN-B.

を生成し、数字以外の場合には AGIP  G9LY”n”! LOAD  GR2,$LENGTH(TOKEN−^
);LO^D G)13.$LENGT)l(TOにU
N−B);?’1VLCL TOKEN−A(GR2)
、TOKEN−B(GR3)、GRI;を生成するよう
にしている。ここで、MVDは通常の転送命令であり、
MVLCLは括弧内で指定した長さ(LENGTH)の
データの転送命令である。ACIPは値を設定する命令
である。
, and if it is not a number, AGIP G9LY"n"! LOAD GR2, $LENGTH (TOKEN-^
);LO^D G)13. $LENGT)l(U to TO
N-B);? '1VLCL TOKEN-A (GR2)
, TOKEN-B (GR3), GRI; Here, MVD is a normal transfer command,
MVLCL is a data transfer command of the length (LENGTH) specified in parentheses. ACIP is an instruction to set a value.

次いで、選択された目的プログラム生成プログラム21
は目的プログラム記述言語インタプリタ5によりインタ
ブリート(翻訳および実行)され(ステップS3)、デ
ータDATA−A、DATA−Bが数字であるか否かに
よって、上記の目的プログラムに対応するコードが生成
され、目的プログラム6が生成される。
Next, the selected target program generation program 21
is interleaved (translated and executed) by the target program description language interpreter 5 (step S3), and a code corresponding to the target program is generated depending on whether the data DATA-A and DATA-B are numbers. A target program 6 is generated.

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

以上説明したように、本発明の目的プログラム生成方式
にあっては、目的プログラム生成プログラムを中間コー
ドに応じて選択し、インクブリートすることにより目的
プログラムを得るため、ターゲ、Iトマ・シン8座−す
ス福呑tごL土日的780グらム記述言語インタプリタ
等はそのままで目的プログラム生成プログラムを変更す
るだけでよく、この際、目的プログラム生成プログラム
は目的プログラム記述言語で記述されデータ定義部およ
びコード生成手続き部を有し構造が理解しやすいため、
変更(書き直し)が非常に簡単であり、対処が容易であ
るという効果がある。また、目的プログラムの部分的な
追加・変更に対しても同様に変更が簡単であり、対処が
容易である。
As explained above, in the object program generation method of the present invention, in order to obtain the object program by selecting the object program generation program according to the intermediate code and inking it, -Susu Fukuten GoL Saturday and Sunday 780 Grams You only need to change the target program generation program without changing the description language interpreter, etc. In this case, the target program generation program is written in the target program description language and the data definition section It has a code generation procedure section and an easy-to-understand structure.
It has the advantage of being very easy to change (rewrite) and easy to deal with. Furthermore, partial additions and changes to the target program are similarly easy to make and can be handled easily.

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

第1図は本発明の目的プログラム生成方式の一実施例を
示す構成図、 第2図は第1図の実施例の動作説明図、第3図は従来の
目的プログラム生成方式を示す構成図および、 第4図は第3図の従来例の動作説明図である。 図において、 ■・・・・・・・・・記憶装置 11・・・・・・中間コード 2・・・・・・・・・記憶装置 21・・・・・・目的プログラム生成プログラム21a
・・・データ宣言部 21b・・・コード生成手続き部 3・・・・・・・・・中間コード入力手段4・・・・・
・・・・目的プログラム選択手段5・・・・・・・・・
目的プログラム記述言語インクプリ6・・・・・・・・
・目的ブログラム タ
FIG. 1 is a block diagram showing an embodiment of the object program generation method of the present invention, FIG. 2 is an explanatory diagram of the operation of the embodiment of FIG. 1, and FIG. 3 is a block diagram showing a conventional object program generation method. , FIG. 4 is an explanatory diagram of the operation of the conventional example shown in FIG. In the figure, ■......Storage device 11...Intermediate code 2...Storage device 21...Target program generation program 21a
...Data declaration section 21b...Code generation procedure section 3...Intermediate code input means 4...
...Objective program selection means 5...
Objective Program Description Language Inkpuri 6...
・Purpose blog

Claims (1)

【特許請求の範囲】 記憶装置から解析済み中間コードを入力する中間コード
入力手段と、 目的プログラム記述言語で記述されデータ定義部および
コード生成手続き部を有する複数の目的プログラム生成
プログラムを格納した記憶装置から、前記入力手段によ
り入力された中間コードに対応する目的プログラム生成
プログラムを選択する目的プログラム選択手段と、 選択された目的プログラム生成プログラムをインタプリ
ードして目的プログラムを生成する目的プログラム記述
言語インタプリタとを備えたことを特徴とする目的プロ
グラム生成方式。
[Scope of Claims] An intermediate code input means for inputting an analyzed intermediate code from a storage device, and a storage device storing a plurality of object program generation programs written in an object program description language and having a data definition section and a code generation procedure section. an object program selection means for selecting an object program generation program corresponding to the intermediate code inputted by the input means from the input means; and an object program description language interpreter for interpreting the selected object program generation program to generate an object program. An objective program generation method characterized by comprising:
JP23597889A 1989-09-12 1989-09-12 Objective program generating system Pending JPH0399329A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP23597889A JPH0399329A (en) 1989-09-12 1989-09-12 Objective program generating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP23597889A JPH0399329A (en) 1989-09-12 1989-09-12 Objective program generating system

Publications (1)

Publication Number Publication Date
JPH0399329A true JPH0399329A (en) 1991-04-24

Family

ID=16994013

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23597889A Pending JPH0399329A (en) 1989-09-12 1989-09-12 Objective program generating system

Country Status (1)

Country Link
JP (1) JPH0399329A (en)

Similar Documents

Publication Publication Date Title
JPH05197535A (en) Computer system for dynamically generating display screen panel, which provides conversational interface for application program step
JPH0399329A (en) Objective program generating system
Ichbiah et al. General concepts of the simula 67 programming language
Popović et al. PTB-FLA development paradigm adaptation for ChatGPT
Berthold et al. High-level process control in eden
JP3057904B2 (en) Vectorization method
JP2554169B2 (en) Relative Rank Analysis Method for Data Driven Processor
JPH04286031A (en) Parallel execution processing method for loop of program
López-Rubio Instruction set and language for chemical nomenclature
JPS63138427A (en) Processing system for scheduling instruction to array
JPH02230330A (en) Inference device
JPH04340628A (en) Fuzzy inference process compile system
JPH07129408A (en) Executing system for language processing program
JPH05224943A (en) Source program converter
JPH0226244B2 (en)
JPH03248230A (en) Parameter analyzing system
JPH0264739A (en) Do type and output system
JPH0291766A (en) Control dependence analyzing system
JPH0231208A (en) Programming unit
Terekhov et al. Academic vs. industrial software engineering: Closing the gap
JPH01270135A (en) System for taking over compilation variable
JPH03269638A (en) Control processing system for allocation of register
JPS6162141A (en) Logic-type information processing device
JPH05233241A (en) Program forming device
JPS63280335A (en) Language processing system