JPH06332719A - Compiler code generating device - Google Patents

Compiler code generating device

Info

Publication number
JPH06332719A
JPH06332719A JP12140693A JP12140693A JPH06332719A JP H06332719 A JPH06332719 A JP H06332719A JP 12140693 A JP12140693 A JP 12140693A JP 12140693 A JP12140693 A JP 12140693A JP H06332719 A JPH06332719 A JP H06332719A
Authority
JP
Japan
Prior art keywords
code
header
generated
generated code
compiler
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
JP12140693A
Other languages
Japanese (ja)
Inventor
Riyouko Kadoki
良子 角木
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.)
Sharp Corp
Original Assignee
Sharp 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 Sharp Corp filed Critical Sharp Corp
Priority to JP12140693A priority Critical patent/JPH06332719A/en
Publication of JPH06332719A publication Critical patent/JPH06332719A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To improve transplantation to plural machines, to increase a compile speed, and to reduce a memory request amount by adding a header to each generated code, and inputting the changed content of the program dependency of the generated code. CONSTITUTION:At first, a code generation pattern is selected (S10). Next, the generation code table of the selected pattern is read (S11). The code is surrounded by a double quote ('') by each line, and the section from the head to a double colon (:) is the header. Successively, the setting of the content of the program dependency of the generated code is operated (S12). Thus, the header is added to each generated code, and the design of the development of the generated code is operated based on the header. Then, the header is added to each code, so that the change or exchange of the design code can be easily operated. Also, the codes are not generated in a batch, but divided and managed one by one, so that the kinds of the patterns of the generated codes can be decreased, and the number of the basic codes can be decreased.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】プログラム開発環境下で用いられ
るコンパイラの開発分野、及びコンピュータ開発分野で
利用できるコンパイラコード発生装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compiler development field for a compiler used in a program development environment and a compiler code generation system usable in a computer development field.

【0002】[0002]

【従来の技術】従来コンパイラの発生するコードは、マ
シンに依存しており、マシンのCPUが変わるたびに発
生コードの再設計をする必要がある。これに伴い、新し
い発生コードに合うように、コンパイラのソースを全面
的に変更する作業が必要となる。変更部分が多岐に渡る
程、変更ミスおよび変更もれも多くなる。同じCPUに
おいても、発生コードの変更を行う場合は、コンパイラ
ソースの全面的見直しが必要となる。そのため、開発に
関する作業工数は多くなる。また、発生コードの持ち方
によっては、コンパイラソースの使用ディスク容量や、
コンパイル実行時のメモリ使用量が多くなる。
2. Description of the Related Art Conventionally, the code generated by a compiler depends on the machine, and it is necessary to redesign the generated code every time the CPU of the machine changes. Along with this, it is necessary to completely change the source code of the compiler to match the new generated code. The more diverse the changes, the more mistakes and omissions. Even in the same CPU, if the generated code is changed, it is necessary to completely review the compiler source. Therefore, the number of man-hours related to development increases. Also, depending on how the generated code is held, the disk space used by the compiler source,
The amount of memory used during compilation is large.

【0003】[0003]

【発明が解決しようとする課題】従来の方法では、マシ
ン依存部分が多く、CPUが変わるたびにコード変更に
伴うソースの変更作業及びデバッグ作業が開発工数のか
なりの部分を占めていた。また、コード設計のみではな
く、それによって派生する変更部分もソース自体の変更
が多くなればそれだけ多岐に渡り、変更ミスや変更もれ
も多くなる。同じCPUにおいても、発生コードの変更
を行う場合、コンパイラソースの全面的見直しが必要と
なる。発生コードの持ち方(コード発生パターンの種類
の分け方)によっては、コンパイラソースの使用ディス
ク容量、およびコンパイル実行時のメモリ使用量が多く
なる。従って、コンパイラの移植という点で以上のよう
な多くの問題点があげられる。
In the conventional method, there are many machine-dependent parts, and the work of changing the source and the work of debugging accompanying a code change occupy a considerable part of the development man-hour each time the CPU changes. In addition, not only the code design, but also the changes that are derived from it increase as the number of changes in the source itself increases, resulting in more mistakes and omissions. Even in the same CPU, when the generated code is changed, it is necessary to completely review the compiler source. Depending on how the generated code is held (classification of types of code generation patterns), the used disk capacity of the compiler source and the memory used during compilation increase. Therefore, there are many problems as described above in porting the compiler.

【0004】本発明は、上記した問題点を克服し、複数
のマシンへの移植性の高い、コンパイルスピードを早
め、メモリ要求量の少ないコンパイラコード生成装置を
提供することを目的とする。
It is an object of the present invention to provide a compiler code generation device which overcomes the above-mentioned problems, is highly portable to a plurality of machines, hastens the compile speed, and has a small memory requirement.

【0005】[0005]

【課題を解決するための手段】本発明のコンパイラコー
ド発生装置は、発生する各コードにヘッダが付けられた
発生コードテーブル、発生コードのプログラム依存の変
更内容を入力とするコンパイラコード発生装置であっ
て、前記ヘッダを解析する手段と、前記ヘッダの種類お
よび前記発生コードのプログラム依存の変更内容に基づ
いてコードを展開する手段とを具備することを特徴とす
る。
A compiler code generator according to the present invention is a compiler code generator which inputs a generated code table in which a header is attached to each generated code and a program-dependent change content of the generated code. And a means for analyzing the header, and a means for expanding the code based on the type of the header and the program-dependent change contents of the generated code.

【0006】[0006]

【作用】発生する各コードにヘッダが付けられた発生コ
ードテーブル、発生コードのプログラム依存の変更内容
が入力される。1コード毎にヘッダが解析され、ヘッダ
の種類および発生コードのプログラム依存の変更内容に
基づいて、コードが展開される。
The generated code table in which a header is attached to each generated code and the program-dependent change contents of the generated code are input. The header is analyzed for each code, and the code is developed based on the header type and the program-dependent change contents of the generated code.

【0007】[0007]

【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。
Embodiments of the present invention will now be described in detail with reference to the drawings.

【0008】図2は本発明の一実施例によるコンパイラ
コード発生装置の構成図である。本装置は、コンパイラ
コード発生処理を含むコンピュータ全体の制御を司る制
御装置10(CPU)、この制御装置を機能させるため
の各種プログラムの格納領域を持つ内部記憶装置13、
外部記憶装置14、上記制御装置の制御の下に、プログ
ラムの表示等を行うディスプレイ装置12(以下表示装
置と称す)、プログラムを含む各種の情報入力に供され
るキーボード等の入力装置11から構成される。制御装
置10には内部記憶装置13、外部記憶装置14、表示
装置12、および入力装置11が接続されている。
FIG. 2 is a block diagram of a compiler code generator according to an embodiment of the present invention. The present device is a control device 10 (CPU) that controls the entire computer including compiler code generation processing, an internal storage device 13 having a storage area of various programs for operating this control device,
An external storage device 14, a display device 12 (hereinafter referred to as a display device) for displaying a program under the control of the control device, and an input device 11 such as a keyboard for inputting various information including the program. To be done. An internal storage device 13, an external storage device 14, a display device 12, and an input device 11 are connected to the control device 10.

【0009】図1は、本装置のコード発生処理を示すフ
ローチャートである。図3は、コード発生の一実施例で
あるプログラムのサンプルである。図4は入出力例であ
る。フローチャート、プログラムのサンプル及び入出力
例を用いて、コード発生処理を説明する。
FIG. 1 is a flow chart showing the code generation processing of this apparatus. FIG. 3 is a sample program that is an example of code generation. FIG. 4 shows an input / output example. The code generation process will be described using a flowchart, a sample program, and an input / output example.

【0010】まず、ステップS10において、コード発
生パターンを選択する。図3の例においては関数cod
egenのclose_genが選択されている。
First, in step S10, a code generation pattern is selected. In the example of FIG. 3, the function cod
The close_gen of the egen is selected.

【0011】次に、ステップS11において、選択され
たパターンの発生コードテーブルを読み込む。図3の例
においては、発生コードテーブルclose_code
を読み込む。コードは、1行ずつダブルクォート(”)
で囲まれており、先頭からダブルコロン(:)までがス
テップS15で用いるヘッダである。それ以降は、発生
コードパターンで、大文字の部分がステップS16にお
いて、ヘッダの種類により展開される部分である。
Next, in step S11, the generation code table of the selected pattern is read. In the example of FIG. 3, the generated code table close_code.
Read. The code is double quotes (") line by line
The header from the beginning to the double colon (:) is a header used in step S15. After that, in the generated code pattern, the upper case part is the part developed according to the type of the header in step S16.

【0012】続いて、ステップS12において、発生コ
ードのプログラム依存の変更内容についての設定を行
う。図3、図4の例においては、関数gen_para
_setが変更内容についての設定を行う。変数f_p
rmに”abc”が、変数c_cmndに数値5がセッ
トされる。これらの値は、コードテーブルの大文字の部
分の展開に用いられる。
Then, in step S12, the contents of program-dependent change of the generated code are set. In the example of FIGS. 3 and 4, the function gen_para
_Set sets the changed content. Variable f_p
“Abc” is set in rm, and the numerical value 5 is set in the variable c_cmnd. These values are used to expand the uppercase part of the code table.

【0013】この段階で前処理が終り、次に発生コード
1部ごとに解析を行い、コードの展開を行う。
At this stage, the preprocessing is completed, and then the generated code is analyzed for each copy to develop the code.

【0014】すなわち、ステップS13において、ステ
ップS11で読み込んだ発生コードテーブルからコード
を1部取り出す。図3の例においては、第1のコード ”F: opr1 F,xxx¥n” が取り出される。
That is, in step S13, one copy of the code is taken out from the generated code table read in step S11. In the example of FIG. 3, the first code "F: opr1 F, xxx \ n" is retrieved.

【0015】次に、ステップS14において、取り出し
たコードがコードテーブルの終了コードであるかどうか
を判定する。終了コードの場合、一連の処理を終了し、
終了コードでなければ、ステップS15に進む。
Next, in step S14, it is determined whether the fetched code is the end code of the code table. If it is an exit code, end the series of processing,
If it is not the end code, the process proceeds to step S15.

【0016】ステップS15では、ヘッダの意味を解析
する。図3の例では、ヘッダの種類を”A”、”
F”、”C”の3パターン用意した。
In step S15, the meaning of the header is analyzed. In the example of FIG. 3, the types of the header are “A” and “
Three patterns of F "and" C "were prepared.

【0017】次に、ステップS16において、必要であ
ればステップS12において設定した内容を反映してコ
ードの展開を行う。ヘッダ”A”は、ダブルコロン以下
のコードをそのまま出力するパターンであり、ステップ
S16のコードの展開はない。ヘッダ”F”は、文字列
に示されている”F”の部分をステップS12の関数g
en_para_setにおいて設定した1つめの引数
に変更し、出力する。ヘッダ”C”は、ヘッダ”F”と
同様に、”C”の部分をステップS12の関数gen_
para_set()において設定した2つめの引数に
変更し、出力する。図3、図4の例においては、第1の
コードは、ヘッダは”F”なので、コード中のヘッダで
はない”F”はステップS12で関数gen_para
_setで設定された値”abc”に置き換えられる。
第3のコードは、ヘッダが”C”なので、コード中のヘ
ッダではない”C”の部分をステップS12で関数ge
n_para_setで設定された値5に置き換えられ
る。第4のコードは、ヘッダが”A”なので、そのまま
出力される。
Next, in step S16, the code is expanded, if necessary, by reflecting the contents set in step S12. The header "A" is a pattern in which the code after the double colon is output as it is, and the code in step S16 is not expanded. As for the header “F”, the part of “F” shown in the character string is replaced with the function g
Change to the first argument set in en_para_set and output. The header “C” is similar to the header “F” in that the portion of “C” is the function gen_ of step S12.
Change to the second argument set in para_set () and output. In the example of FIGS. 3 and 4, the header of the first code is “F”, so “F” that is not the header in the code is the function gen_para in step S12.
It is replaced with the value "abc" set in _set.
In the third code, since the header is "C", the portion of "C" which is not the header in the code is processed by the function ge in step S12.
It is replaced by the value 5 set in n_para_set. The fourth code is output as it is because the header is "A".

【0018】次にステップS17において展開したコー
ドを順次メモリバッファあるいはファイルに出力する。
図3、図4の例においては、第1コードは図4に示す opr1 abc、xxx と出力される。
Next, the code expanded in step S17 is sequentially output to the memory buffer or file.
In the example of FIGS. 3 and 4, the first code is output as opr1 abc, xxx shown in FIG.

【0019】次に、ステップS13に戻り、次のコード
について処理を行う。
Then, the process returns to step S13 to process the next code.

【0020】なお、上記した実施例では、ヘッダのパタ
ーンを3種類用意したが、このパターンは上記実施例に
限定されるものではなく、コードの展開形により、新た
なパターンを用いても良い。
In the above embodiment, three types of header patterns are prepared, but this pattern is not limited to the above embodiment, and a new pattern may be used depending on the expanded form of the code.

【0021】発生コード設計の変更を行う場合は、発生
コードテーブル(close_code[])の変更を
行うのみで他の部分の変更は必要なく、コードの変更、
修正作業が効率的になる。また、部分的に同じコードを
発生する場合、その発生コードテーブルを共用すれば、
ディスクおよびメモリの使用量を減らすことができる。
When the generated code design is changed, only the generated code table (close_code []) is changed and the other parts are not required to be changed.
Correction work becomes efficient. Also, if the same code is generated partially, if the generated code table is shared,
Disk and memory usage can be reduced.

【0022】発生する各コードにヘッダをつけ、そのヘ
ッダをもとに発生コードの展開を行うような設計を行
う。ヘッダは、コードの種類により、様々なパターンを
用意し、そのパターンにより1つ1つのコードの展開形
を作成する。コード1つ毎にヘッダを付けるため、設計
コードの変更や入れ換えなどが容易におこなえる。ま
た、コードをまとめて発生せず、1つずつを分けて管理
するので、発生コードのパターンの種類を減らし、基本
コードの数を減らすことができる。従って、コンパイラ
ソースのディスク使用量、およびコンパイル実行時のメ
モリ使用量を削減することが可能である。
A design is performed in which a header is attached to each generated code and the generated code is expanded based on the header. Various patterns are prepared for the header according to the type of code, and an expanded form of each code is created according to the pattern. Since a header is attached to each code, the design code can be changed or replaced easily. Moreover, since the codes are not generated collectively but managed one by one, it is possible to reduce the types of patterns of generated codes and reduce the number of basic codes. Therefore, it is possible to reduce the disk usage of the compiler source and the memory usage when the compilation is executed.

【0023】これらにより、開発工数を大幅に減らすこ
とが可能となる。また、変更ソース量が減ることによ
り、変更ミス及び変更もれを削減することができる。
As a result, the man-hours for development can be greatly reduced. Further, by reducing the amount of change source, it is possible to reduce change mistakes and change omissions.

【0024】[0024]

【発明の効果】以上説明したように本発明のコンパイラ
コード発生装置は、ヘッダを解析する手段と、ヘッダの
種類および発生コードのプログラム依存の変更内容に基
づいてコードを展開する手段とを具備しているので、複
数のマシンへの移植性の高い、コンパイルスピードを早
め、メモリ要求量の少ないコンパイラコード生成装置を
提供できる。
As described above, the compiler code generating apparatus of the present invention comprises means for analyzing the header and means for expanding the code based on the type of the header and the program-dependent change contents of the generated code. Therefore, it is possible to provide a compiler code generation device that is highly portable to multiple machines, has a high compile speed, and has a small memory requirement.

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

【図1】コード発生処理のフローチャートである。FIG. 1 is a flowchart of a code generation process.

【図2】本発明の一実施例によるコンパイラコード発生
装置の構成図である。
FIG. 2 is a configuration diagram of a compiler code generator according to an embodiment of the present invention.

【図3】コード発生の一実施例であるプログラムのサン
プルである。
FIG. 3 is a sample program that is an example of code generation.

【図4】入出力例であるFIG. 4 is an input / output example.

【符号の説明】[Explanation of symbols]

10 制御装置 11 入力装置 12 表示装置 13 内部記憶装置 14 外部記憶装置 10 Control Device 11 Input Device 12 Display Device 13 Internal Storage Device 14 External Storage Device

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 発生する各コードにヘッダを付けられた
発生コードテーブル、発生コードのプログラム依存の変
更内容を入力とするコンパイラコード発生装置であっ
て、前記ヘッダを解析する手段と、前記ヘッダの種類お
よび前記発生コードのプログラム依存の変更内容に基づ
いてコードを展開する手段とを具備することを特徴とす
るコンパイラコード発生装置。
1. A generated code table in which a header is attached to each generated code, and a compiler code generation device which inputs the program-dependent change contents of the generated code as an input, and means for analyzing the header, A compiler code generation device, comprising means for expanding a code based on a type and a program-dependent change content of the generated code.
JP12140693A 1993-05-24 1993-05-24 Compiler code generating device Pending JPH06332719A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP12140693A JPH06332719A (en) 1993-05-24 1993-05-24 Compiler code generating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP12140693A JPH06332719A (en) 1993-05-24 1993-05-24 Compiler code generating device

Publications (1)

Publication Number Publication Date
JPH06332719A true JPH06332719A (en) 1994-12-02

Family

ID=14810391

Family Applications (1)

Application Number Title Priority Date Filing Date
JP12140693A Pending JPH06332719A (en) 1993-05-24 1993-05-24 Compiler code generating device

Country Status (1)

Country Link
JP (1) JPH06332719A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6305013B1 (en) 1998-04-01 2001-10-16 Nec Corporation Compiling method for generating target program in accordance with target processor type, compiling device, recording medium with compiling program recorded therein and recording medium with conversion table used in compiling recorded therein

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6305013B1 (en) 1998-04-01 2001-10-16 Nec Corporation Compiling method for generating target program in accordance with target processor type, compiling device, recording medium with compiling program recorded therein and recording medium with conversion table used in compiling recorded therein

Similar Documents

Publication Publication Date Title
US5860008A (en) Method and apparatus for decompiling a compiled interpretive code
US5881290A (en) Industrial controller decompiler accommodating an expandable instruction set
US5819097A (en) Industrial controller compiler with expandable instruction set
US5790760A (en) Program generating apparatus and method thereof
CA2010056C (en) Method for improving the efficiency of arithmetic code generation in an optimizing compiler using machine independent update instruction generation
JPH08202545A (en) Object-oriented system and method for generation of target language code
JPH02217926A (en) Compiler
JPH06332719A (en) Compiler code generating device
US6343378B1 (en) Method of making link directive file and tool for making link directive file
GB2420638A (en) Method of substituting code fragments in Internal Representation
JP2672968B2 (en) Source list output processing method for debugging
JPH06161773A (en) Generating device for parallel processing program
JP2004139369A (en) Analysis method for pointer pointing constant address domain
Kumar et al. Revolutionizing Compilation: Lexical Analysis Approaches for Parallel Multi-Core Processing
JPH0689187A (en) Inline expansion optimizing method
JP2990882B2 (en) Functional simulation device
JPH05233748A (en) Simulation method
JPH06242942A (en) Source code level debugging device
JPH1063675A (en) Data retrieving method and data retrieving device applying the method
JP2000081984A (en) Compiling processor and its method
JPH032923A (en) Automatic programming system
Allan Peephole optimization as a targeting and coupling tool
JPS63132335A (en) Executing system for computer language processing system
JPH06309159A (en) Program automatic generator
JPH05233314A (en) System for compilation processing and vocabulary dictionary processing in program execution