JPH0342727A - System for generating name by pre-compiler - Google Patents

System for generating name by pre-compiler

Info

Publication number
JPH0342727A
JPH0342727A JP17886189A JP17886189A JPH0342727A JP H0342727 A JPH0342727 A JP H0342727A JP 17886189 A JP17886189 A JP 17886189A JP 17886189 A JP17886189 A JP 17886189A JP H0342727 A JPH0342727 A JP H0342727A
Authority
JP
Japan
Prior art keywords
compiler
name
language
precompiler
program
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
JP17886189A
Other languages
Japanese (ja)
Inventor
Kazuhiko Noba
和彦 野場
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP17886189A priority Critical patent/JPH0342727A/en
Publication of JPH0342727A publication Critical patent/JPH0342727A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To avoid the coincidence of a name generated by a pre-compiler with a name designated by a user by allowing the pre-compiler to generate the name through the use of characters which can not be used with the user. CONSTITUTION:The source program 1 of a pre-compiler language is the source program whose function is extended by using an SQL language in a COBOL program, for example. The pre-compiler 2 generates the source program 3 of a compiler language by using the characters whose head character is not used in the language concerned as to the name for processing a mentioned part whose function is extended by a library call. A compiler 4 is reorganized so as to recognize the use of the name as to the calling of a library having the name generated by the pre-compiler 2 and the compiler generates a target program 5.

Description

【発明の詳細な説明】 〔概要〕 プリコンパイラによる名前の生成方式に関し、プリコン
パイラが利用者の使用し得ない文字を用いて名前を生成
すると共に既存コンパイラにこの文字の使用を許すよう
に改造し、プリコンパイラが生成した名前と、利用者が
指定した名前との間の衝突を回避し、翻訳エラーが発生
しないようにすることを目的とし、 ある言語で記述したプロラム中でライブラリ呼び出しな
どによって処理するための名前について、先頭の1文字
を当該ある言語で使用しない文字を用いて生成するプリ
コンパイラと、このプリコンパイラによって生成した名
前を持つライブラリ呼び出しなどについて、この名前の
使用を認めるように改造した、ある言語を翻訳するコン
パイラとを備え、この改造したコンパイラがこの名前を
翻訳して目的プログラムを生成するように構成する。
[Detailed Description of the Invention] [Summary] Regarding the name generation method by the precompiler, the precompiler generates names using characters that the user cannot use, and the existing compiler is modified to allow the use of these characters. However, the purpose is to avoid conflicts between the names generated by the precompiler and the names specified by the user, and to prevent translation errors from occurring. Regarding names for processing, the use of this name will be allowed for precompilers that generate names using a character that is not used in a certain language as the first character, and for library calls with names generated by this precompiler. A modified compiler for translating a certain language is provided, and the modified compiler is configured to translate this name and generate a target program.

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

本発明は、プリコンパイラによる名前生戊方式に関する
ものである。
The present invention relates to a name generation method using a precompiler.

〔従来の技術と発明が解決しようとする課題〕近年、既
存コンパイラ言語によるデータベース操作の必要性が増
大するに伴い、既存コンパイラ言語の仕様拡張が行われ
ている。言語仕様の拡張手法として、記述言語のコンパ
イラに機能追加する手法と、既存コンパイラの原始言語
に翻訳するプリコンパイラを作成する手法とがある。デ
ータベース機能などでは、主に後者が採用されることが
多い。このプリコンパイラ方式を採用したとき、利用者
がプログラム上で記述した名前と、プリコンパイラが生
成した名前とが同し名前になって衝突し、既存のコンパ
イラによる翻訳時にエラーとなり、翻訳し得ない事態が
発生するという問題があった。
[Prior Art and Problems to be Solved by the Invention] In recent years, as the need for database operations using existing compiler languages has increased, the specifications of existing compiler languages have been expanded. There are two ways to extend language specifications: one is to add functionality to a compiler for a description language, and the other is to create a precompiler that translates into the source language of an existing compiler. The latter is often used for database functions and the like. When this precompiler method is adopted, the name written by the user in the program and the name generated by the precompiler are the same and conflict, resulting in an error when translated by an existing compiler, making it impossible to translate. There was a problem with things happening.

例えば第5図(イ)原始プログラムについて、プリプロ
セッサが第5図(ロ)に示すように変換し、これをコン
パイラが翻訳するときに、■の名前″X5QL−PAR
A”は、■を参照すべきであるが、■に同名のデータを
プログラマが指定しているため、−意に定まらず、翻訳
時に翻訳エラーとなる。
For example, the preprocessor converts the source program shown in Figure 5 (a) as shown in Figure 5 (b), and when the compiler translates it, the name of
A'' should refer to ■, but since the programmer has specified data with the same name in ■, an error will occur during translation.

本発明は、プリコンパイラが利用者の使用し得ない文字
を用いて名前を生成すると共に既存コンパイラにこの文
字の使用を許すように改造し、プリコンパイラが生威し
た名前と、利用者が指定した名前との間の衝突を回避し
、翻訳エラーが発生しないようにすることを目的として
いる。
In the present invention, a precompiler generates a name using characters that the user cannot use, and an existing compiler is modified to allow the use of these characters. The purpose is to avoid collisions between names and translation errors.

〔課題を解決する手段〕[Means to solve problems]

第1図は、本発明の原理構成図を示す。 FIG. 1 shows a basic configuration diagram of the present invention.

第1図において、プリコンパイラ2は、ある言語で記述
したプロラム中で機能拡張した記述部分をライブラリ呼
び出しなどによって処理するための名前について、先頭
の1文字を当該ある言語で使用しない文字を用いてコン
パイラ言語の原始プログラム3を生成するものである。
In Figure 1, the precompiler 2 uses a character that is not used in the language for the first character of the name used to process the function-enhanced description part of a program written in a certain language by calling a library. This is to generate a source program 3 in a compiler language.

コンパイラ4は、プリコンパイラによって生成した名前
を持つライブラリ呼び出しなどについて、この名前の使
用を認めるように改造したコンパイラであって、コンパ
イラ言語の原始プログラム3を目的プログラム5に翻訳
するものである。
The compiler 4 is a compiler that has been modified to allow the use of a name generated by a precompiler for calling a library, etc., and translates the source program 3 in the compiler language into the target program 5.

〔作用〕[Effect]

本発明は、第1図に示すように、プリコンパイラ2があ
る言語で記述したプロラム(プリコンパイラ言語の原始
プログラム1)中で機能拡張した記述部分をライブラリ
呼び出しなどによって処理するための名前について、先
頭の1文字を当該ある言語で使用しない文字を用いてコ
ンパライ言語の原始プログラム3を生威し、改造したコ
ンパイラ4がこの生成した名前を持つライブラリ呼び出
しなどを翻訳して目的プログラム5を生成するようにし
ている。
As shown in FIG. 1, the present invention provides a name for processing a function-enhanced description part in a program (source program 1 of a precompiler language) written in a certain language by the precompiler 2 by calling a library, etc. A source program 3 in a compiler language is generated by using a character that is not used in the language as the first character, and a modified compiler 4 translates library calls with this generated name to generate a target program 5. That's what I do.

従って、ある言語で記述したプログラム中で機能拡張し
た記述部分についての名前と、利用者が指定した名前と
の間で衝突の発生を回避し、翻訳時のエラー発生を防止
することが可能となる。
Therefore, it is possible to avoid conflicts between the name of the part whose function has been expanded in a program written in a certain language and the name specified by the user, and to prevent errors during translation. .

〔実施例〕〔Example〕

次に、第1図から第4図を用いて本発明の1実施例の構
成および動作を順次詳細に説明する。
Next, the configuration and operation of one embodiment of the present invention will be explained in detail using FIGS. 1 to 4.

第1図において、プリコンパイラ言語の原始プログラム
1は、ある言語で記述しプログラム中で機能拡張した原
始プログラムであって、例えば第2図(イ)に示すよう
に、C0BOLプログラム中でSQL言語を用いて機能
拡張したプログラム部分を含む原始プログラムである。
In FIG. 1, a source program 1 in a precompiler language is a source program written in a certain language and whose functions are expanded in the program. For example, as shown in FIG. This is a source program that includes program parts whose functions have been expanded using

プリコンパイラ2は、ある言語で記述したプロラム中で
機能拡張した記述部分く例えば第2図(イ)COBOL
プログラム中でSQL言語で記述した拡張した部分)を
ライブラリ呼び出しなどによって処理するための名前に
ついて、先頭の1文字を当該ある言語で使用しない文字
(第2図(ロ)の■で示す文字(第3図EBCDICコ
ード中の1の次のコード(X”CA”)))を用いてコ
ンパイラ言語の原始プログラム3(例えば第2図(ロ)
)を生成するものである。
The precompiler 2 is used to write a part of a program written in a certain language with expanded functions, such as COBOL in Figure 2 (a).
For names used to process extended parts written in the SQL language in a program by library calls, etc., the first character must be a character that is not used in the language concerned (the character marked with ■ in Figure 2 (b)). Using the code following 1 (X"CA")) in the EBCDIC code in Figure 3, create the source program 3 in the compiler language (for example, Figure 2 (B)).
).

コンパイラ4ば、プリコンパイラによって生成した名前
を待つライブラリ呼び出しなどについて、この名前の使
用を認めるように改造したコンパイラであって、コンパ
イラ言語の原始プログラム3(例えば第2図(ロ))を
目的プログラム5に翻訳するものである。
Compiler 4 is a compiler that has been modified to allow the use of names generated by the precompiler for library calls that wait for names generated by the precompiler. 5.

次に、第2図を用いてプリコンパイラ言語の原始プログ
ラム1を、コンパイラ言語の原始プログラム2に変換す
る処理を説明する。
Next, the process of converting the source program 1 in the precompiler language into the source program 2 in the compiler language will be explained using FIG.

第2図(イ)は、プリコンパイラ言語の原始プログラム
1を示す。ここで、■の部分は、C0BOL言語で記述
した原始プログラムを示す。
FIG. 2(a) shows a source program 1 in a precompiler language. Here, the part marked ■ indicates a source program written in the C0BOL language.

■の部分は、C0BOL言語で記述した原始プログラム
中で、SQL言語を用いて記述した機能拡張した部分を
示す。
The part (2) indicates a functionally expanded part written using the SQL language in the original program written in the COBOL language.

第2図(口〉は、コンパイラ言語の原始プログラム3を
示す。
FIG. 2 shows a source program 3 in a compiler language.

■の部分は、プリコンパイラ2が、実行時のSQLライ
ブラリ(第3図SQLライブラリ7)を呼び出すために
生威したパラメタ領域を示す。ここて、■は、C0BO
L言語で使用しない文字として、第4図EBCDICコ
ードの英字″I″の次の■を用いて示す文字(コードX
″CA”)を先頭に付与した名前を生成したものである
The part (2) indicates a parameter area used by the precompiler 2 to call the SQL library (SQL library 7 in FIG. 3) during execution. Here, ■ is C0BO
As a character not used in the L language, the character shown using the ■ next to the alphabetic character "I" in the EBCDIC code in Figure 4 (code
"CA") is added to the beginning of the name.

■は、機能拡張したSQL文を、CALL文によるライ
ブラリ呼び出しとして変換したものである。ここで、ラ
イブラリ呼び出しの名前が図示のようにX″CA”を先
頭に付与し、COB OL言語で使用しない文字を先頭
に持つ名前としている。
(2) is a functionally expanded SQL statement converted into a library call using a CALL statement. Here, as shown in the figure, the name of the library call is prefixed with X"CA", and the name is prefixed with a character that is not used in the COB OL language.

これにより、C0BOL言語で利用者が指定した名前と
、このX″CA”を先頭に付与したプリコンパイラ2が
自動生成した名前とが衝突することがない。また、コン
パイラ4ば、C0BOL言語で使用しないこの新たに付
与した文字を先頭に持つ名前について、翻訳可能なよう
に改造する。これにより、コンパイラ4による翻訳時に
、プリコンパイラ2が自動付与した名前と、利用者が付
与した名前とが衝突することがなく、コンパイラ4によ
る翻訳時に翻訳エラーとなることを回避できる。また、
エディタによって操作できない文字を使用する。
This prevents a conflict between the name specified by the user in the COBOL language and the name automatically generated by the precompiler 2, which prefixes the name with "X"CA". In addition, the compiler 4 modifies names starting with the newly added characters that are not used in the COBOL language so that they can be translated. This prevents a conflict between the name automatically assigned by the precompiler 2 and the name assigned by the user during translation by the compiler 4, and avoids a translation error during translation by the compiler 4. Also,
Use characters that cannot be manipulated by the editor.

以上のように、第2図(イ)COBOL言語で記述した
原始プログラム中で機能格納する部分をSQL言語で記
述し、これを第2図(ロ)に示すように、プリコンパイ
ラ2がC0BOL言語で使用しない文字を先頭に持つ名
前を付与したライブライ呼び出しに変換し、更に、コン
パイラ4が目的プログラム5に変換することにより、プ
リコンパイラ2が生成した名前と、利用者が指定した名
前とが重ならないようにし、コンパイラ4による翻訳時
に翻訳エラーとなることを防止することが可能となる。
As described above, the part that stores functions in the source program written in the COBOL language (Figure 2 (a)) is written in the SQL language, and as shown in Figure 2 (b), the precompiler 2 uses the COBOL language. The name generated by the precompiler 2 and the name specified by the user are changed by converting it into a library call with a name starting with an unused character, and then by converting it into the target program 5 by the compiler 4. By avoiding overlap, it is possible to prevent a translation error from occurring during translation by the compiler 4.

第3図は、本発明に係わる実行時の動作説明図を示す。FIG. 3 shows an explanatory diagram of the operation at the time of execution according to the present invention.

これは、第2図(ロ)コンパイラ言語の原始プログラム
3をコンパイラ4が翻訳して目的プログラム5を生威し
、これを実行するときの様子を模式的に表したものであ
る。ここで、CALL・・・”は、第2図(ロ)■のS
QL文の実行部分に対応し、オブジェクトコード6のC
ALL文によってSQLライブライフを呼び出し、所定
の処理を行い、元に復帰するようにしている。
This is a schematic representation of the situation when the compiler 4 translates the source program 3 in the compiler language shown in FIG. Here, CALL...'' is S in Figure 2 (b) ■.
Corresponding to the execution part of the QL statement, object code 6 C
The ALL statement calls SQL Live Life, performs predetermined processing, and returns to the original state.

第4図は、EBCD I Cコードを示す。ここで、■
は、英字″I″の次の位置X″CA″を表す。
FIG. 4 shows the EBCD IC code. Here,■
represents the next position X"CA" of the alphabetic character "I".

これを、プリコンパイラ2が先頭に付与してライブラリ
呼び出しの名前を生成することにより、C0BOL言語
で利用者が指定する名前と同一になることを回避し、コ
ンパイラ4による翻訳時に翻訳エラーとなることを防止
することが可能となる。
By adding this to the beginning of the precompiler 2 and generating the name of the library call, it is possible to avoid the name being the same as the name specified by the user in the C0BOL language, and to avoid a translation error when the compiler 4 translates. This makes it possible to prevent

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

以上説明したように、本発明によれば、プリコンパイラ
2が利用者の使用し得ない文字を用いて名前を生成する
と共に既存のコンパイラ4にこの文字の使用を許すよう
に改造する構成を採用しているため、プリコンパイラ2
が生成した名前と、利用者が指定した名前とが重ならな
いようにし、コンパイラ4による翻訳時に翻訳エラーが
発生しないようにすることができる。また、上記文字を
エディタなどで操作し得ない文字とすることにより、利
用者の立場から既存の言語に対して機能追加していない
かのように見せることができる。
As explained above, according to the present invention, a configuration is adopted in which the precompiler 2 generates a name using characters that the user cannot use, and modifies the existing compiler 4 to allow the use of these characters. Therefore, precompiler 2
It is possible to prevent the name generated by the user from overlapping the name specified by the user, and to prevent a translation error from occurring during translation by the compiler 4. Furthermore, by making the above characters characters that cannot be manipulated by an editor or the like, it can be made to appear as if no functionality has been added to the existing language from the user's perspective.

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

第1図ば本発明の原理構成図、第2図は本発明の動作説
明図、第3図は本発明に係わる実行時の動作説明図、第
4図ばBBCDTCコード、第5図は従来技術の問題点
説明図を示す。 図中、1はプリコンパイラ言語の原始プログラム、2は
プリコンパイラ、3はコンパイラ言語の原始プログラム
、4はコンパイラ、5ば目的プログラムを表す。
Fig. 1 is a diagram showing the principle configuration of the present invention, Fig. 2 is an explanatory diagram of the operation of the present invention, Fig. 3 is an explanatory diagram of the operation at the time of execution related to the present invention, Fig. 4 is a BBCDTC code, and Fig. 5 is a conventional technique. A diagram explaining the problem is shown. In the figure, 1 represents a precompiler language source program, 2 a precompiler, 3 a compiler language source program, 4 a compiler, and 5 a target program.

Claims (1)

【特許請求の範囲】 プリコンパイラによる名前の生成方式において、ある言
語で記述したプロラム中でライブラリ呼び出しなどによ
って処理するための名前について、先頭の1文字を当該
ある言語で使用しない文字を用いて生成するプリコンパ
イラ(2)と、 このプリコンパイラ(2)によって生成した名前を持つ
ライブラリ呼び出しなどについて、この名前の使用を認
めるように改造した、ある言語を翻訳するコンパイラ(
4)とを備え、 この改造したコンパイラ(4)がこの名前を翻訳して目
的プログラムを生成するように構成したことを特徴とす
るプリプロセッサの名前生成方式。
[Claims] In a name generation method by a precompiler, a name for processing by calling a library in a program written in a certain language is generated using a character that is not used in the language as the first character. A precompiler (2) that translates a certain language, which has been modified to allow the use of names generated by this precompiler (2) for library calls with names generated by this precompiler (2).
4), and the modified compiler (4) is configured to translate this name and generate a target program.
JP17886189A 1989-07-10 1989-07-10 System for generating name by pre-compiler Pending JPH0342727A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP17886189A JPH0342727A (en) 1989-07-10 1989-07-10 System for generating name by pre-compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP17886189A JPH0342727A (en) 1989-07-10 1989-07-10 System for generating name by pre-compiler

Publications (1)

Publication Number Publication Date
JPH0342727A true JPH0342727A (en) 1991-02-22

Family

ID=16055968

Family Applications (1)

Application Number Title Priority Date Filing Date
JP17886189A Pending JPH0342727A (en) 1989-07-10 1989-07-10 System for generating name by pre-compiler

Country Status (1)

Country Link
JP (1) JPH0342727A (en)

Similar Documents

Publication Publication Date Title
US5230049A (en) Program source code translator
KR960035260A (en) Method and apparatus for indicating the location of an error detected in a software macro call
JPH01277934A (en) Switching system for parameter list reference method
JPH0342727A (en) System for generating name by pre-compiler
JP2002132502A (en) Automatic creating system and method of distributed object with interpretation of language function
JP2827724B2 (en) Program debug processing method
JP2942414B2 (en) Virtual database method
JPH02205930A (en) Interface check processing method
JPH0358232A (en) Preprocessor calling system
JPH0328932A (en) Compiling system for extended language specifications
JPH02165239A (en) Data access system for large-scale knowledge base
Grouse " Flowblocks" a technique for structured programming
JPH06231181A (en) Distributed database control system
JPH03282935A (en) Compile processor and compile processing system
JPS6139134A (en) Program converting method
JPS58166455A (en) Relational type data base system
JPS63138426A (en) Program production system
JPS63133230A (en) Compiling system for source program
JPH0359726A (en) Program unit batch translation system
JPS63178345A (en) Data base access processing system
JPH03296820A (en) Method and device for assembly processing
JPH03100730A (en) Method for emergency correction data generation processing with high grade language
JPH0279127A (en) Fortran compile processing system
JPH04101226A (en) Interpreter type language processing system
JPH01158534A (en) Generating system for source program