JPH0328932A - Compiling system for extended language specifications - Google Patents

Compiling system for extended language specifications

Info

Publication number
JPH0328932A
JPH0328932A JP16267089A JP16267089A JPH0328932A JP H0328932 A JPH0328932 A JP H0328932A JP 16267089 A JP16267089 A JP 16267089A JP 16267089 A JP16267089 A JP 16267089A JP H0328932 A JPH0328932 A JP H0328932A
Authority
JP
Japan
Prior art keywords
compiler
general
special
language
information
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
JP16267089A
Other languages
Japanese (ja)
Inventor
Onori Yokozuka
横塚 大典
Shigeyuki Yamanaka
重幸 山中
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.)
Hitachi Software Engineering Co Ltd
Hitachi Ltd
Original Assignee
Hitachi Software Engineering Co Ltd
Hitachi 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 Hitachi Software Engineering Co Ltd, Hitachi Ltd filed Critical Hitachi Software Engineering Co Ltd
Priority to JP16267089A priority Critical patent/JPH0328932A/en
Publication of JPH0328932A publication Critical patent/JPH0328932A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To improve the operability, the extension properties, and the maintenance properties of a system by providing a general-purpose compiler which translates a general-purpose language and a special compiler which translates an extended language to a special purpose and outputting the information en bloc after synthesizing them. CONSTITUTION:A special compiler 13 is provided to translate only the language used for a special purpose in addition to a general-purpose compiler which translates a general-purpose language. When a source program incorporating the language used to the special purpose is inputted, the compiler 12 starts the compiler 13. Then the information on the input source program, a diagnostic message, an object program, etc., are exchanged between both compilers 12 and 13 while they are performing the translating tasks. Simultaneously, both compilers translate the input source program is accordance with each partial charge. The compiler 12 synthesizes the results of translation of both compilers and outputs these synthesized information en bloc. Thus the operability is improved for users and simultaneously can easily package the extended specifications.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は、拡張された言語仕様のコンパイル方式に係り
、特に、COBOL,PL/I等の汎用的な言語の中に
データベース操作言語,データ通信操作言語等の特殊な
用途に対する言語が埋め込まれた形式の拡張された言語
仕様のソースプログラムを翻訳する拡張された言語仕様
のコンパイル方式に関する. [従来の技術] データベース操作言語、データ通信操作言語等の特殊な
用途に対する言語が埋め込まれた、すなわち、拡張され
た言語仕様で記述されたCOBOL,PL/I等の汎用
的高級言語の翻訳に関する従来技術として、例えば、特
開昭62−216040号公報等に記載された技術が知
られている.この従来技術は、ブリコンパイラとフンバ
イラとを備え、これらのコンパイラの直列的な分担によ
り言語翻訳を行うものである. また、他の従来技術として、COBOLやPL/Iなど
の汎用的高級言語のコンパイラの機能を拡張し、拡張さ
れた言語仕様を扱えるようにし、これにより前述のよう
な拡張された言語仕様で記述された汎用高級言語を翻訳
可能とした技術が知られている。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a compiling method for extended language specifications, and in particular, the present invention relates to a compilation method for extended language specifications, and in particular, a database operation language and a data processing language in general-purpose languages such as COBOL and PL/I. This paper relates to an extended language specification compilation method for translating an extended language specification source program in a format in which a language for special purposes such as a communication operation language is embedded. [Prior Art] Translation of general-purpose high-level languages such as COBOL and PL/I that are embedded with languages for special purposes such as database operation languages and data communication operation languages, that is, written with extended language specifications. As a conventional technique, for example, a technique described in Japanese Patent Laid-Open No. 62-216040 is known. This conventional technology includes a burric compiler and a funbaira, and performs language translation by serially dividing the work between these compilers. In addition, as another conventional technology, the functions of compilers for general-purpose high-level languages such as COBOL and PL/I are expanded so that they can handle extended language specifications. There is a known technology that makes it possible to translate general-purpose high-level languages.

以下、これらの従来技術によるコンパイル方式を図面に
より説明する。
Compilation methods according to these conventional techniques will be explained below with reference to the drawings.

第16図は、プリコンパイラとコンパイラとを用いる従
来技術を説明する図である。第16図において、11は
拡張された言語仕様で記述された汎用的高級言語のソー
スプログラム、34はプリコンパイラ、35はプリコン
パイラによりコンパイラが処理できる形式に変換された
中間ソースプログラム、36はプリコンパイラが出力す
る診断メッセージ、利用者の記述したソースプログラム
のリスト等の各種リスト、l2は汎用的高級言語のコン
パイラ、l6は目的プログラム、17はコンパイラが出
力する診断メッセージ、コンパイラの入力した中間ソー
スプログラムのリスト等の各種リストである. 第16図に示す従来技術おいて、例えば、拡張された言
語仕様で記述された汎用的高級言語のソースプログラム
11が,データベース操作言語が埋め込まれたPL/I
ソースプログラムであるものとし、このソースプログラ
ムを翻訳する場合の動作を説明する. 利用者は、まず、ブリコンパイラ34を起動する.ブリ
コンパイラ34は、これにより、利用者が記述したソー
スプログラム1lを解析し、該プログラム11内にエラ
ーがあれば診断メッセージ36を出力する.また、ソー
スプログラム11がエラーの無い正しいものであれば、
ブリコンパイラ34は、ソースプログラム11をPL/
I汎用コンパイラで処理できる形式、すなわちPL/I
の言語仕様の範囲内の記述に変換し、中間ソースプログ
ラム35を出力する.利用者は、次に、PL/I汎用コ
ンパイラl2を起動する,PL/I汎用コンパイラl2
は、この中間ソースプログラム35を解析し、該中間ソ
ースプログラム35にエラーがあれば診断メッセージl
7を出力する.また、中間ソースプログラム35がエラ
ーの無い正しいものであれば,PL/I汎用コンパイラ
l2は、目的プログラム16を出力する。
FIG. 16 is a diagram illustrating a conventional technique using a precompiler and a compiler. In FIG. 16, 11 is a general-purpose high-level language source program written in an extended language specification, 34 is a precompiler, 35 is an intermediate source program converted by the precompiler into a format that can be processed by a compiler, and 36 is a precompiler. Diagnostic messages output by the compiler, various lists such as a list of source programs written by the user, l2 is a general-purpose high-level language compiler, l6 is the target program, 17 is a diagnostic message output by the compiler, intermediate source input by the compiler These are various lists such as a list of programs. In the prior art shown in FIG. 16, for example, a source program 11 in a general-purpose high-level language written in an extended language specification is written in a PL/I program in which a database operation language is embedded.
Assuming that this is a source program, we will explain the operation when translating this source program. The user first starts up the bricompiler 34. The precompiler 34 thereby analyzes the source program 1l written by the user, and outputs a diagnostic message 36 if there is an error in the program 11. Also, if the source program 11 is correct without errors,
The precompiler 34 converts the source program 11 into PL/
I format that can be processed by a general-purpose compiler, i.e. PL/I
The intermediate source program 35 is output. The user then starts the PL/I general-purpose compiler l2.
analyzes this intermediate source program 35, and if there is an error in the intermediate source program 35, a diagnostic message l is sent.
Outputs 7. Furthermore, if the intermediate source program 35 is correct without any errors, the PL/I general-purpose compiler l2 outputs the target program 16.

第16図に示す従来技術は、前述したように、ブリコン
パイラと汎用コンパイラとを、直列的に用いて翻訳を行
うものであり、以降、この従来技術による方式をブリコ
ンパイラ方式と呼ぶ。
As described above, the conventional technique shown in FIG. 16 performs translation using a precompiler and a general-purpose compiler in series, and hereinafter, the method according to this conventional technique will be referred to as a precompiler method.

第17図は拡張された言語仕様を扱えるようにした従来
技術によるコンパイル方式を説明する図である。第17
図において、各符号は第16図の場合と同一である。
FIG. 17 is a diagram illustrating a compilation method according to the prior art that can handle extended language specifications. 17th
In the figure, each reference numeral is the same as in FIG. 16.

第17図に示す従来技術おいて、例えば、拡張された言
語仕様で記述された汎用的高級言語のソースプログラム
11が、前述した第16図の従来技術の場合と同様に、
データベース操作言語が埋め込まれたPL/Iソースプ
ログラムであるものとし、このソースプログラムを翻訳
する場合の動作を説明する. この従来技術における汎用コンパイラl2は、データベ
ース操作言語が埋め込まれたPL/Iソースプログラム
11内のデータベース操作言語を扱えるように機能を拡
張されたPL/I汎用コンパイラである。この汎用コン
パイラl2は、利用者の記述したソースプログラムl1
を解析し、該ソースプログラム11内にエラーがあれば
診断メッセージl7を出力し、また、ソースプログラム
1lがエラーの無い正しいソースプログラムであれば,
目的プログラムl6を出力する。
In the prior art shown in FIG. 17, for example, the source program 11 of a general-purpose high-level language written in an extended language specification is similar to the prior art shown in FIG. 16 described above.
Assuming that this is a PL/I source program with a database operation language embedded in it, we will explain the operation when translating this source program. The general-purpose compiler l2 in this prior art is a PL/I general-purpose compiler whose functions have been expanded so that it can handle the database operation language in the PL/I source program 11 in which the database operation language is embedded. This general-purpose compiler l2 is a source program l1 written by the user.
is analyzed, and if there is an error in the source program 11, a diagnostic message 17 is output, and if the source program 1l is a correct source program with no errors,
Output the target program l6.

第17図に示す従来技術は、データベース操作言語が埋
め込まれたソースプログラムll内のデータベース操作
言語等の特殊な用途のための言語を扱えるように機能が
拡張された汎用コンパイラl2を用いるものであり、以
降、この従来技術による方式をコンパイラ独自方式と呼
ぶ.[発明が解決しようとする問題点] 前記プリコンパイラ方式による従来技術は、次に示すよ
うな問題点を有している. すなわち、この従来技術は、第16図により説明したよ
うに、ブリコンパイラにより発見されたエラーとコンパ
イラにより発見されたエラーとが、それぞれ、別のリス
トとして出力されることになるため、リストが見にくい
という問題点を有する。
The conventional technology shown in FIG. 17 uses a general-purpose compiler l2 whose functions have been expanded to be able to handle languages for special purposes such as a database manipulation language in a source program l in which a database manipulation language is embedded. ,Hereafter, this method based on the conventional technology will be referred to as the compiler-specific method. [Problems to be Solved by the Invention] The conventional technology using the precompiler method has the following problems. In other words, in this prior art, as explained using FIG. 16, errors discovered by the precompiler and errors discovered by the compiler are output as separate lists, making the list difficult to read. There is a problem.

また、この従来技術は、コンパイラが出力する診断メッ
セージが、プリコンパイラの出力した中間ソースプログ
ラムに対するものであり、利用者の記述したソースプロ
グラムに対するものでないため、診断メッセージに付け
られた文番号や、埋め字などの情報が利用者にとって分
かりにくく、デバッグの効率を向上することができない
という問題点を有している。
Furthermore, in this prior art, the diagnostic message output by the compiler is for the intermediate source program output by the precompiler, and not for the source program written by the user. This has the problem that information such as padding characters is difficult for users to understand, and debugging efficiency cannot be improved.

さらに、プリコンパイラ方式の従来技術は、ジョブステ
ップが二つになるため、その操作性が悪いという問題点
を有している.この問題点は、前述した特開昭62−2
16040号公報に記載された技術を利用することによ
り解決でき、操作性の向上を図ることができるが、しか
し、字句切出し、構文解析、名前解決等のコンパイラの
内部処理が、プリコンパイラとコンパイラの双方で行な
われるため、翻訳に必要な時間、及び、CPU、記憶域
などの計算機資源の損失が大きくなるという問題点を生
じさせてしまう. 一般に、プリコンパイラは、プリコンパイラ自身が処理
すべき部分の解析しか行わないため、ソースプログラム
内で宣言された名標の属性に関する詳細な情報などを持
っていない.従って、前記従来技術は、意味解析の処理
において厳密なエラーチェックが出来ず、利用者が記述
したプログラムを実行してみないと、プログラムの不良
が発見されないことが多いという問題点を有している.
また、一般に、プリコンパイラは、対象となる高級言語
のすべての仕様を満足し得ないので、言語仕様に不自然
な制約がつくことが多い.例えば、コンパイラが、ソー
スプログラムを生成,変更できるマクロ機能を持ってい
る場合、前記従来技術は、プリコンパイラの対象となる
拡張された言語仕様に関する部分を、このマクロ機能を
使って生成することができないという問題点を有する.
さらにまた、プリコンパイラ方式の従来技術は、プリコ
ンパイラを、前述の拡張仕様を埋め込む対象となる汎用
的高級言語(COBOL,PL/I1FORTRAN.
PASCAL等)の数だけ作成しておかなければならな
いという問題点を有している. また、前記コンパイラ独自方式による従来技術は、次に
示すような問題点を有している。
Furthermore, the conventional precompiler-based technology has the problem of poor operability because it requires two job steps. This problem is solved by the above-mentioned Japanese Patent Application Laid-Open No.
This can be solved by using the technology described in Publication No. 16040, and operability can be improved. Since translation is performed on both sides, the problem arises that the time required for translation and the loss of computer resources such as CPU and storage area become large. In general, precompilers do not have detailed information about the attributes of names declared in the source program because they only analyze the part that should be processed by the precompiler itself. Therefore, the above-mentioned conventional technology has the problem that strict error checking cannot be performed in the semantic analysis process, and program defects are often not discovered until the program written by the user is executed. There is.
Additionally, since precompilers generally cannot satisfy all specifications of the target high-level language, unnatural constraints are often placed on the language specifications. For example, if a compiler has a macro function that can generate and modify a source program, the above-mentioned conventional technology can use this macro function to generate a part related to an extended language specification that is targeted by a precompiler. The problem is that it cannot be done.
Furthermore, in the conventional precompiler technology, the precompiler is used in a general-purpose high-level language (COBOL, PL/I1FORTRAN.
PASCAL, etc.) must be created in advance. Further, the conventional technology based on the compiler-specific method has the following problems.

すなわち、この従来技術は、既存の汎用的高級言語コン
パイラに,データベース操作言語などの拡張仕様を実装
するのが困難であり、拡張仕様を提供するすべての汎用
的高級言語(COBOL、PL/I%FORTRAN.
PASCAL等)のコンパイラに、該拡張仕様について
の同様の処理を実装しなくてはならず、各コンパイラの
開発工数が多く、無駄であるという問題点を有している
In other words, with this conventional technology, it is difficult to implement extended specifications such as database manipulation languages in existing general-purpose high-level language compilers, and all general-purpose high-level languages that provide extended specifications (COBOL, PL/I% FORTRAN.
Similar processing for the extended specification must be implemented in a compiler (such as PASCAL, etc.), which poses a problem in that the development time for each compiler is large and wasteful.

例えば、データベース操作言語は、データベース管理シ
ステムの機能拡張に伴って言語仕様も機能を拡張しなく
てはならない場合が多いが、このような拡張を行った方
式は、該拡張仕様の対象となるシステム、すなわち、前
述の例ではデータベース管理システムの機能拡張と、コ
ンパイラの機能拡張のタイミングを必ず合せなければな
らないという問題点を生じる6 本発明の目的は、前述したような従来技術の問題点の解
決を図り、利用者にとっての操作性を向上させるととも
に、コンパイラにとって拡張仕様の実装を容易化させる
ことを可能にした拡張された言語仕様のコンパイル方式
を提供することにある。
For example, when it comes to database operation languages, the functionality of the language specifications often has to be expanded as the functionality of the database management system is expanded. In other words, in the above example, there is a problem in that the timing of the enhancement of the functionality of the database management system and the enhancement of the functionality of the compiler must be matched.6 The purpose of the present invention is to solve the problems of the prior art as described above. The purpose of this invention is to provide a method for compiling extended language specifications that improves operability for users and makes it easier for compilers to implement extended specifications.

[課題を解決するための手段] 本発明によれば前記目的は、汎用言語を翻訳する汎用コ
ンパイラとは別個に、特殊な用途に対する言語だけを翻
訳する特殊コンパイラを設け、特殊な用途に対する言語
が埋め込まれたソースプログラムが入力された汎用コン
パイラが、この特殊コンパイラを起動し、この同者が翻
訳動作中に入力ソースプログラム、診断メッセージ、目
的プログラム等の情報を交換しながら、それぞれの分担
にしたがって入力ソースプログラムを翻訳し、汎用コン
パイラがこの両者の翻訳結果の情報を合成し、一括して
出力するようにすることによって達成される. [作 用] 汎用コンパイラは、ソースプログラムが入力されると、
そのソースプログラムが拡張された仕様で記述されたソ
ースプログラムであれば、特殊コンパイラを起動し、特
殊コンパイラと情報の交換を行いながらソースプログラ
ムの翻訳を行い、翻訳の結果を、目的プログラム、各種
リストと共に汎用コンパイラが合成してただひとつだけ
出力する。このため、本発明によるコンパイル方式は、
利用者にとって、あたかも、汎用コンパイラだけが動作
しているように扱うことができる。
[Means for Solving the Problems] According to the present invention, the above object is to provide a special compiler that only translates languages for special uses, separate from a general-purpose compiler that translates general-purpose languages, and to translate languages for special uses. The general-purpose compiler to which the embedded source program is input starts this special compiler, and during the translation process, the compiler exchanges information such as the input source program, diagnostic messages, target program, etc. This is achieved by translating the input source program, and having the general-purpose compiler combine the information from both translation results and output it all at once. [Operation] When a general-purpose compiler inputs a source program,
If the source program is a source program written with expanded specifications, a special compiler is started, the source program is translated while exchanging information with the special compiler, and the translation results are sent to the target program and various lists. A general-purpose compiler synthesizes and outputs only one. Therefore, the compilation method according to the present invention is
The user can treat it as if only the general-purpose compiler is running.

また、特殊コンパイラを複数必要とする場合、コントロ
ーラが、これらの特殊コンパイラ群を総括し、汎用コン
パイラと特殊コンパイラとの間のインターフエイスを全
て行なうので、汎用コンパイラは、コントローラだけを
意識して動作すればよく、拡張仕様や特殊コンパイラな
どの追加、変更に対して柔軟に対処することができ、シ
ステムとしての拡張性、保守性が向上する。
In addition, if multiple special compilers are required, the controller integrates these special compilers and performs all the interfaces between the general-purpose compiler and the special compiler, so the general-purpose compiler operates with only the controller in mind. This allows for flexible handling of additions and changes to extended specifications, special compilers, etc., and improves the extensibility and maintainability of the system.

また、特殊な用途に対する言語仕様が、その埋め込まれ
る汎用言語の種類に関わりなく共通であれば、この共通
な拡張された言語仕様の翻訳は、この1つの特殊コンパ
イラが行なうことができるので、各汎用言語のコンパイ
ラは、特殊コンパイラとのインターフエイスの機能だけ
を実装すれば良く、実際に拡張された仕様の翻訳に関す
る全ての機能をもつ必要がなく、従って、COBOL,
FORTRAN,PL/Iなどの様々な汎用言語につい
て、この拡張仕様を翻訳する機能を持たせることが容易
となる. [実施例コ 以下、本発明による拡張された言語仕様のコンパイル方
式の実施例を図面により詳細に説明する。
Furthermore, if the language specifications for special purposes are common regardless of the type of general-purpose language in which they are embedded, this one specialized compiler can translate this common extended language specification. A compiler for a general-purpose language only needs to implement the function of interfacing with a special compiler, and does not need to have all the functions related to actually translating the extended specifications.
This makes it easy to provide a function to translate this extended specification into various general-purpose languages such as FORTRAN and PL/I. [Embodiment] Hereinafter, an embodiment of the extended language specification compilation method according to the present invention will be described in detail with reference to the drawings.

第1図は本発明の第1の実施例の基本構成を示すブロッ
ク図である.第1図において、l1は拡張された言語仕
様で記述されたソースプログラム、l2は汎用的高級言
語のコンパイラ(以降、汎用コンパイラと呼ぶ)、1・
3は拡張された言語仕様の部分だけを翻訳する特殊コン
パイラ、16はソースプログラムを翻訳した結果の目的
プログラム、l7は診断メッセージ、ソー−スプログラ
ムリスト、相互参照リスト等の各種リストである。また
、4は汎用コンパイラから特殊コンパイラへ渡す情報で
あり、l5は特殊コンパイラから汎用コンパイラへ渡す
情報である。
FIG. 1 is a block diagram showing the basic configuration of the first embodiment of the present invention. In FIG. 1, l1 is a source program written in an extended language specification, l2 is a general-purpose high-level language compiler (hereinafter referred to as a general-purpose compiler), 1.
3 is a special compiler that translates only the part of the extended language specification; 16 is the target program as a result of translating the source program; and 17 is various lists such as diagnostic messages, source program list, cross reference list, etc. Further, 4 is information passed from the general-purpose compiler to the special compiler, and l5 is information passed from the special compiler to the general-purpose compiler.

利用者は、拡張言語仕様で記述されたソースプログラム
11を翻訳しようとする場合、まず、汎用コンパイラ1
2を起動する。起動された汎用コンパイラ12は、ソー
スプログラム11を取り込み、その解析を行なう.汎用
コンパイラl2は、この過程で拡張仕様で記述された部
分を発見すると、特殊コンパイラl3を起動し、その拡
張仕様部分に関わる情報l4を特殊コンパイラl3へ渡
す。
When a user attempts to translate a source program 11 written in the extended language specification, the user first uses the general-purpose compiler 1.
Start 2. The activated general-purpose compiler 12 takes in the source program 11 and analyzes it. When the general-purpose compiler l2 discovers a part described in the extended specification during this process, it starts the special compiler l3 and passes information l4 related to the extended specification part to the special compiler l3.

特殊コンパイラl3は、汎用コンパイラl2から受けと
った情報をもとに拡張された言語仕様の部分だけの翻訳
を行ない、目的プログラム、診断メッセージ等の翻訳結
果の情報l5を汎用コンパイラ12へ返送する. 汎用コンパイラl2は、自分の翻訳処理の結果である目
的プログラム、診断メッセージ等と、特殊コンパイラl
3から返された目的プログラム、診断メッセージ等とを
合成して、目的プログラム16、各種リストl7として
出力する。
The special compiler l3 translates only the extended language specification part based on the information received from the general-purpose compiler l2, and returns information l5 of the translation results such as the target program and diagnostic messages to the general-purpose compiler 12. The general-purpose compiler l2 outputs the target program, diagnostic messages, etc. that are the results of its own translation process, and the special compiler l2.
The target program, diagnostic message, etc. returned from 3 are combined and output as a target program 16 and various lists 17.

このような本発明の第1の実施例によれば、翻訳の結果
は、目的プログラム、各種リストと共に汎用コンパイラ
が合成してただひとつだけ出力されるので、利用者にと
っては、あたかも、汎用コンパイラだけが動作している
ように見える。また、出力される診断結果のリストは、
利用者の記述したソースプログラムから直接得られたと
同一の形式で出力されるので、利用者にとって判り易い
ものとなる. 第2図は本発明の第2の実施例の基本構成を示すブロッ
ク図、第3図はコントローラの処理動作を説明するフロ
ーチャートである。第2図において、13a,13bは
特殊コンパイラ、18はコントローラである.また、1
4a〜14c,15a−+5bはコンパイラとコントロ
ーラとの間で送受信される情報であり、他の符号は第1
図の場合と同一である。
According to the first embodiment of the present invention, the translation result is synthesized by the general-purpose compiler together with the target program and various lists and only one output is output. appears to be working. In addition, the list of diagnostic results that are output is
The output is in the same format as if it were directly obtained from the source program written by the user, making it easier for the user to understand. FIG. 2 is a block diagram showing the basic configuration of a second embodiment of the present invention, and FIG. 3 is a flow chart explaining the processing operation of the controller. In FIG. 2, 13a and 13b are special compilers, and 18 is a controller. Also, 1
4a to 14c, 15a-+5b are information sent and received between the compiler and the controller, and other codes are the first
This is the same as the case shown in the figure.

第2図に示す本発明の第2の実施例において、ソースプ
ログラム11は、例えば、データベース操作言語及びデ
ータ通信操作言語のような、複数の拡張された言語仕様
を含むものとする。従って、この本発明の第2の実施例
は、これら複数の拡張された言語仕様のそれぞれを翻訳
するための特殊コンパイラ13a,13bを備え、これ
らの特殊コンパイラ13a,13bと汎用コンパイラ1
2との間のインターフェース制御を行うコントローラ1
8を備えて構威されている。
In a second embodiment of the invention shown in FIG. 2, the source program 11 includes a plurality of extended language specifications, such as a database manipulation language and a data communication manipulation language. Therefore, the second embodiment of the present invention includes special compilers 13a and 13b for translating each of these multiple extended language specifications, and these special compilers 13a and 13b and the general-purpose compiler 1
controller 1 that controls the interface between
It is equipped with 8.

利用者は、拡張言語仕様で記述されたソースプログラム
1lを翻訳しようとする場合、まず、汎用コンパイラ1
2を起動する。起動された汎用コンパイラl2は、ソー
スプログラムl1を取り込み、その解析を行なう。汎用
コンパイラ12は、この過程で拡張仕様で記述された部
分を発見すると、その拡張仕様部分に関わる情報14a
をコントローラl8へ渡す。
When a user wants to translate a source program 1l written in the extended language specification, the user must first use a general-purpose compiler 1l.
Start 2. The activated general-purpose compiler l2 takes in the source program l1 and analyzes it. When the general-purpose compiler 12 discovers a part described in the extended specification during this process, it generates information 14a related to the extended specification part.
is passed to controller l8.

コントローラ18は、汎用コンパイラ12から受け取っ
た情報を複数存在する拡張仕様のそれぞれの部分に分割
し、また必要なら編集を行ない,それぞれの翻訳を受け
持つ特殊コンパイラ13a、13bを起動し、翻訳に必
要な拡張仕様部分の情報を情報14b,14cとしてこ
れらのコンパイラ13a.]3bに送出する。
The controller 18 divides the information received from the general-purpose compiler 12 into each part of a plurality of extended specifications, edits it if necessary, activates the special compilers 13a and 13b in charge of each translation, and creates the necessary information for the translation. These compilers 13a . ]3b.

特殊コンパイラ13a,13bは、与えられた拡張仕様
部分に関する情報の翻訳を行い、目的プログラム、診断
メッセージ等の翻訳結果の情報l5b,15cをコント
ローラl8に送出する。コントローラ18は,これらの
情報15b.15cを必要があれば編集、統合し、情報
15aとして汎用コンパイラl2に送出する. 汎用コンパイラ12は、自分の翻訳処理の結果である日
的プログラム、診断メッセージ等と、コントローラl8
から返送された目的プログラム、診断メッセージ等とを
合成して、目的プログラムl6、各種リスト17として
出力する,前述した本発明の第2の実施例におけるコン
トローラ18の処理フローが第3図に示されており、以
下、これについて説明する。
The special compilers 13a, 13b translate information regarding the given extended specification part, and send information 15b, 15c of the translation results, such as the target program and diagnostic messages, to the controller 18. The controller 18 stores these pieces of information 15b. 15c is edited and integrated if necessary, and sent to the general-purpose compiler l2 as information 15a. The general-purpose compiler 12 outputs daily programs, diagnostic messages, etc. that are the results of its own translation processing, and the controller l8.
FIG. 3 shows the processing flow of the controller 18 in the second embodiment of the present invention, which synthesizes the object program, diagnostic message, etc. sent back from the computer and outputs it as the object program l6 and various lists 17. This will be explained below.

(1)汎用コンパイラl2から受け取った情報14aの
全てについて、特殊コンパイラ13aに渡すべき情報か
、特殊コンパイラ!3bに渡すべき情報かを識別分類し
、それぞれの特殊コンパイラに渡す情報を設定する(ス
テップ31〜34)。
(1) Regarding all of the information 14a received from the general-purpose compiler l2, is it information that should be passed to the special compiler 13a?Special compiler! The information to be passed to 3b is identified and classified, and the information to be passed to each special compiler is set (steps 31 to 34).

(2)全ての情報14aについて、ステップ33、34
の情報の設定が終了すると、次に、特殊コンパイラ13
aを起動し、該コンパイラ13aに翻訳処理を行わせ、
該コンパイラ13aから返送される情報を,汎用コンパ
イラl2に返送する情報として設定する(ステップ35
、36)。
(2) Steps 33 and 34 for all information 14a
After completing the setting of the information, the special compiler 13
a, and cause the compiler 13a to perform translation processing,
The information returned from the compiler 13a is set as information to be returned to the general-purpose compiler l2 (step 35).
, 36).

(3)ステップ35、36と同様に、特殊コンパイラ1
3bを起動し、該コンパイラ13bに翻訳処理を行わせ
、該コンパイラ13bから返送される情報を、汎用コン
パイラl2に返送する情報として設定する(ステップ3
7、38)。
(3) Similar to steps 35 and 36, special compiler 1
3b, the compiler 13b performs translation processing, and the information returned from the compiler 13b is set as information to be returned to the general-purpose compiler l2 (step 3).
7, 38).

なお、第3図により説明したコントローラ18の前述の
処理フローにおいて、ステップ37、38の処理は、ス
テップ35、36と並列に行われてもよい. 前述の本発明の第2の実施例によれば、汎用コンパイラ
と特殊コンパイラの間のインターフエイスが、コントロ
ーラにより一括して行われるので、汎用コンパイラは、
コントローラだけを意識して動作すれば良く、拡張仕様
、特殊コンパイラ等の追加、変更に対して柔軟に対処す
ることができ、システムとしての拡張性、保守性を向上
させることができる. 第4図は本発明の第3の実施例の基本構成を示すブロッ
ク図である.第41!Iにおいて、lla、1lbは共
通の拡張された言語仕様を含み、異なった汎用言語で記
述されたソースプログラム、l2a,12bはそれぞれ
の汎用言語を翻訳する汎用コンパイラ、16a、16b
はソースプログラムを翻訳した結果の目的プログラム,
17a.17bは診断メッセージ、ソースプログラムリ
スト、相互参照リストなどの各種リストであり、他の符
号は第1図、第2図の場合と同一である.第4図に示す
本発明の第3の実施例は、それぞれが共通の特殊操作言
語を内部に備える、異なる言語で記述された複数のソー
スプログラムの翻訳を行い得るものであり、例えば、ソ
ースプログラムllaはCOBOL言語で、ソースプロ
グラム1lbはPL/I言語で記述され、かつ共通の仕
様を持つデータベース操作言語を含むソースプログラム
である。第4図に示す例では、2種のソースプログラム
が示されているが、ソースプログラムは、さらに多数あ
ってもよく、この場合、ソースプログラムの数に合わせ
て、汎用コンパイラを増設すればよい. 利用者は、拡張言語仕様で記述されたソースプログラム
llaまたはllbを翻訳しようとする場合、まず、汎
用コンパイラ12aまたは12bをソースプログラムを
記述した汎用言語の種類にしたがって起動する。
Note that in the above-described processing flow of the controller 18 explained with reference to FIG. 3, the processing of steps 37 and 38 may be performed in parallel with steps 35 and 36. According to the second embodiment of the present invention described above, since the interface between the general-purpose compiler and the special compiler is performed by the controller, the general-purpose compiler
It only needs to operate with the controller in mind, and it can flexibly deal with additions and changes to extended specifications, special compilers, etc., and can improve the extensibility and maintainability of the system. FIG. 4 is a block diagram showing the basic configuration of the third embodiment of the present invention. 41st! In I, lla and 1lb contain common extended language specifications and are source programs written in different general-purpose languages, l2a and 12b are general-purpose compilers that translate the respective general-purpose languages, and 16a and 16b.
is the target program that is the result of translating the source program,
17a. Reference numeral 17b indicates various lists such as a diagnostic message, a source program list, a cross reference list, etc., and the other symbols are the same as in FIGS. 1 and 2. The third embodiment of the present invention shown in FIG. 4 is capable of translating a plurality of source programs written in different languages, each of which has a common special operation language inside. lla is written in the COBOL language, and the source program 1lb is written in the PL/I language, and is a source program including a database operation language having common specifications. In the example shown in FIG. 4, two types of source programs are shown, but there may be many more source programs. In this case, a general-purpose compiler may be added to match the number of source programs. When a user wants to translate a source program lla or llb written in the extended language specification, first, the user starts the general-purpose compiler 12a or 12b according to the type of general-purpose language in which the source program is written.

汎用コンパイラ12aは、ソースプログラム1】aを、
汎用コンパイラ12bは、ソースプログラムllbを取
り込み、それぞれの解析を行う。
The general-purpose compiler 12a converts the source program 1]a into
The general-purpose compiler 12b takes in the source program llb and analyzes each of them.

汎用コンパイラ12a% 12bは、この解析過程で拡
張仕様で記述された部分を発見すると、その拡張仕様部
分に関わる情報1 4 a,  l 4 bを特殊コン
パイラl3へ渡す.このとき、情報14a,14bは同
一のフォーマットでで特殊コンパイラに渡される. 特殊コンパイラl3は、この情報14a,14bをもと
に翻訳を行ない、目的プログラムや、診断メッセージな
どの翻訳結果の情報15a,15bをそれぞれ汎用コン
パイラ12a,12bへ返送する。このとき、情報15
a,15bは同一のフォーマットである。
When the general-purpose compiler 12a% 12b discovers a part described in the extended specification during this analysis process, it passes information 14a, l4b related to the extended specification part to the special compiler l3. At this time, the information 14a and 14b are passed to the special compiler in the same format. The special compiler l3 performs translation based on this information 14a and 14b, and returns information 15a and 15b of translation results such as the target program and diagnostic messages to the general-purpose compilers 12a and 12b, respectively. At this time, information 15
a and 15b have the same format.

汎用コンパイラ12a% 12bは、自分の翻訳処理の
結果である目的プログラム、診断メッセージ等と、特殊
コンパイラ13から返送された目的プログラム、診断メ
ッセージ等とを合成して、目的プログラム1 6 a,
  1 6 b,各種リスト17a、17bとしてそれ
ぞれ出力する. 前述した本発明の第3の実施例によれば、各汎用コンパ
イラは、特殊コンパイラとのインターフエイスの機能だ
けを実装すれば良く、拡張仕様の翻訳に関する機能の大
部分は、特殊コンパイラだけが実装することになる.そ
して、これにより、本発明の第3の実施例は、COBO
L,FORTRAN,PL/Iなどの様々な汎用言語に
ついて、その拡張仕様を翻訳することが可能となる。
The general-purpose compiler 12a% 12b synthesizes the target program, diagnostic message, etc., which is the result of its own translation process, and the target program, diagnostic message, etc. returned from the special compiler 13, and creates the target program 16a,
1 6 b, and output as various lists 17a and 17b, respectively. According to the third embodiment of the present invention described above, each general-purpose compiler only needs to implement the function of interfacing with the special compiler, and most of the functions related to translation of extended specifications are implemented only by the special compiler. I will do it. Accordingly, the third embodiment of the present invention is a COBO
It becomes possible to translate extended specifications for various general-purpose languages such as L, FORTRAN, and PL/I.

前述した本発明の第3の実施例は、ソースプログラム内
に含まれる拡張された言語仕様が1つであるとしたが、
本発明は、複数のソースプログラムのそれぞれに、複数
の拡張された言語仕様が含まれる場合にも適用すること
が可能であり、この場合、第4図に示す特殊コンパイラ
13の位置に、第2図に示したと同様なコントローラ1
8を置き、このコントローラ18に複数の特殊コンパイ
ラを接続すればよい6 第5図は本発明の第4の実施例の構成を示すブロック図
、第6図はデータベース操作言語SQLが埋め込まれた
PL/Iプログラムの例を示す図、第7図はPL/Iコ
ントローラからSQLコントローラへ渡す情報の内容例
を示す図,第8図は第7図内のソースプログラムに関す
る情報のフォーマット例を示す図、第9図は第7図内の
変数の属性に関する情報のフォーマット例を示す図、第
10図はSQLコントローラからPL/Iコントローラ
へ渡す情報の内容例を示す図、第11図は第10図内の
目的プログラムに関する情報のフォーマット例を示す図
、第12図は第lO図内の診断メッセージに関する情報
のフォーマット例を示す図、第13図は第10図内の名
標相互の参照関係に関する情報のフォーマット例を示す
図、第14図はPL/IとSQLコンパイラとが生成す
る目的プログラムの関係を示す図,第15図はPL/■
コンパイラの処理内容の概要を説明するフローチャート
である.第5図において、l9はデータベース操作言語
SQLが埋め込まれたPL/Iプログラム、20はPL
/Iコンパイラ、2lはSQLを翻訳するSQLコンパ
イラ、22はデータベース管理システム、23はデータ
ベースに関する情報を格納しているディスクショナリで
あり、他の符号は第1図の場合と同一である.第5図に
示す本発明の第4の実施例は、第l図により説明した本
発明の第1の実施例を具体的にしたものであり、以下、
この第4の実施例を第6図〜第15図を参照して説明す
る。
In the third embodiment of the present invention described above, there is one extended language specification included in the source program, but
The present invention can also be applied to a case where each of a plurality of source programs includes a plurality of extended language specifications. In this case, a second compiler is installed at the location of the special compiler 13 shown in FIG. Controller 1 similar to the one shown in the figure
8 and connect a plurality of special compilers to this controller 18. 6 Figure 5 is a block diagram showing the configuration of the fourth embodiment of the present invention, and Figure 6 is a PL program in which the database manipulation language SQL is embedded. A diagram showing an example of a /I program, FIG. 7 is a diagram showing an example of the content of information passed from the PL/I controller to the SQL controller, and FIG. 8 is a diagram showing an example format of information regarding the source program in FIG. Figure 9 is a diagram showing an example of the format of information regarding attributes of variables in Figure 7, Figure 10 is a diagram showing an example of the content of information passed from the SQL controller to the PL/I controller, and Figure 11 is in Figure 10. FIG. 12 is a diagram showing an example format of information regarding the diagnostic message in FIG. Figure 14 shows a format example, Figure 14 shows the relationship between the target programs generated by PL/I and the SQL compiler, Figure 15 shows PL/■
This is a flowchart explaining an overview of the processing contents of the compiler. In FIG. 5, l9 is a PL/I program in which the database operation language SQL is embedded, and 20 is a PL/I program.
/I compiler, 2l is an SQL compiler that translates SQL, 22 is a database management system, 23 is a dictionary that stores information regarding the database, and other symbols are the same as in FIG. The fourth embodiment of the present invention shown in FIG. 5 is a concrete version of the first embodiment of the present invention explained in FIG.
This fourth embodiment will be explained with reference to FIGS. 6 to 15.

ソースプログラムであるSQLが埋め込まれたPL/I
プログラム19は,第6図に示すように、基本仕様で記
述されたPL/Iの文24の中に、SQLの中で使用さ
れる変数についてのPL/Iでの変数宣言25と、デー
タベース操作を指示するSQL文26とが埋め込まれて
構成されている。
PL/I with embedded SQL source program
As shown in FIG. 6, the program 19 contains variable declarations 25 in PL/I for variables used in SQL and database operations in a PL/I statement 24 written in the basic specifications. An SQL statement 26 that instructs is embedded.

このソースプログラムの例は、rJIS  X  30
05−1987Jに準拠して構成されたものである. 前述のように構成されたPL/Iプログラム19を翻訳
しようとする場合、まず、PL/rコンパイラ20が起
動される. PL/Iコンパイラ20は、ソースプログラムl9を取
り込み、構文解析の結果、PL/Iプログラムl9がS
QLを使用していることが分かると、SQLコンパイラ
2lを動的にローデイングする.このSQLコンパイラ
のローデイングは、PL/Iコンパイラのコンパイラオ
プションに、SQLを使用している旨の指定があった場
合に行うことにしてもよい. そして、PL/Iコンパイラ20は、SQL文26及び
変数宣言25からSQLコンパイラ2lへ渡す情報l4
を生成する.この情報l4の内容は、第7図に示すよう
に、ソースプログラムに間する複数の情報27と、変数
の属性に間する複数の情報28等から構成されている.
ソースプログラムに関する情報のフォーマットの例を第
8図に、変数の属性に間する情報のフォーマットの例を
第9図にそれぞれ示す。そしてPL/Iコンパイラ20
は制御をSQLコンパイラ2lへ渡す.SQLコンパイ
ラ2lは、PL/Iコンパイラ20から渡された情報l
4の解析を実行する.SQLコンパイラ2lは、この解
析過程でデータベース管理システム22を経由してデー
タベースの定義情報などか格納されているディクショナ
リ23をアクセスし、SQLの意味チェックを行なう.
さらに、SQLコンパイラ21は,PL/Iコンバイラ
20から渡された情報l4に基づきSQLの翻訳を行な
い、目的プログラム、診断メッセージ等のPL/Iコン
パイラ20へ渡すべき情報l5を生成する. この情報l5の内容は、第10図に示すように、目的プ
ログラムに関する情報29、診断メッセージに関する情
報30、名標相互の参照間係に関する情報31等から構
成されている。目的プログラムに関する情報29のフォ
ーマットの例が第11図に、診断メッセージに関する情
報30のフォーマットの例が第12図に、名標相互の参
照関係に関する情報31のフォーマットの例が第13図
にそれぞれ示されている。そして、SQLコンパイラ2
lは、その制御をPL/Iコンパイラ20へ返す。
This source program example is rJIS
05-1987J. When attempting to translate the PL/I program 19 configured as described above, the PL/r compiler 20 is first started. The PL/I compiler 20 takes in the source program l9, and as a result of syntax analysis, the PL/I program l9 is
When it is determined that QL is being used, the SQL compiler 2l is dynamically loaded. This loading of the SQL compiler may be performed when the compiler option of the PL/I compiler specifies that SQL is used. Then, the PL/I compiler 20 passes information l4 from the SQL statement 26 and variable declaration 25 to the SQL compiler 2l.
Generate. As shown in FIG. 7, the content of this information 14 is composed of a plurality of pieces of information 27 about the source program, a plurality of pieces of information 28 about the attributes of variables, and the like.
FIG. 8 shows an example of the format of information regarding the source program, and FIG. 9 shows an example of the format of information regarding the attributes of variables. and PL/I compiler 20
passes control to SQL compiler 2l. The SQL compiler 2l uses the information passed from the PL/I compiler 20.
Execute the analysis in step 4. During this analysis process, the SQL compiler 2l accesses the dictionary 23, which stores database definition information, etc., via the database management system 22, and checks the meaning of the SQL.
Further, the SQL compiler 21 translates SQL based on the information l4 passed from the PL/I compiler 20, and generates information l5 to be passed to the PL/I compiler 20, such as a target program and a diagnostic message. As shown in FIG. 10, the contents of the information 15 are comprised of information 29 regarding the target program, information 30 regarding the diagnostic message, information 31 regarding the mutual reference between names, and the like. An example of the format of the information 29 regarding the target program is shown in FIG. 11, an example of the format of the information 30 regarding the diagnostic message is shown in FIG. 12, and an example of the format of the information 31 regarding the mutual reference relationship between names is shown in FIG. has been done. And SQL compiler 2
l returns control to the PL/I compiler 20.

PL/Iコンパイラ20は、第14図に示すように、P
L/Iプログラムl9内に記述されたSQL文を.SQ
Lコンパイラ21が生成する目的プログラムの呼出し(
PL/I言語ではCALL文)に置き換えて、PL/I
言語で記述された部分の翻訳を続行する。
The PL/I compiler 20, as shown in FIG.
The SQL statement written in the L/I program l9. SQ
Calling the target program generated by the L compiler 21 (
CALL statement in PL/I language), PL/I
Continue translating the parts written in the language.

この翻訳が終了すると、PL/Iコンパイラ20は,S
QLコンパイラ2lより受け取った情報l5を自分の翻
訳結果と合成して、目的プログラムl6と各種のりスト
l7を出力する。
When this translation is completed, the PL/I compiler 20
It combines the information l5 received from the QL compiler 2l with its own translation results and outputs a target program l6 and various lists l7.

前述したPL/Iコンパイラ20における処理内容の概
要が第15図にフローチャートとして示されており、以
下、これについて説明する。
An overview of the processing contents in the aforementioned PL/I compiler 20 is shown in the form of a flowchart in FIG. 15, which will be explained below.

PL/Iコンパイラ20における処理は、第15図に示
すように、構文解析処理と、宣言解析処理と、目的プロ
グラム生成及びリスト出力の処理とにより行われる. 構文解析処理は、ソースプログラムが入力された後、そ
のソースプログラム内のSQL文を抽出し、抽出された
SQL文に基づいて、SQLコンパイラへ渡す情報を設
定し、ソースプログラムをC:ALL文に変換すると共
に,SQL文以外に対して通常の処理を施すことにより
行われる.宣言解析処理は、ソースプログラム内の宣言
文を解析し、その宣言文が、SQL文の中で使用されて
いる場合に、そのSQL文の中で使用されている宣言文
に基づいて、SQLコンパイラへ渡す情報を設定する処
理である。
As shown in FIG. 15, the processing in the PL/I compiler 20 is performed by syntax analysis processing, declaration analysis processing, and object program generation and list output processing. In the syntax analysis process, after a source program is input, the SQL statement in the source program is extracted, and based on the extracted SQL statement, information to be passed to the SQL compiler is set, and the source program is converted into a C:ALL statement. This is done by converting and applying normal processing to non-SQL statements. Declaration analysis processing analyzes declaration statements in a source program, and if the declaration statement is used in an SQL statement, the SQL compiler This is the process of setting the information to be passed to.

また、目的プログラム生成及びリスト出力の処理は、ソ
ースプログラム内にSQL文があった場合に、SQLコ
ンパイラから渡された目的プログラム及び各種リストと
、自PL/Iコンパイラで生成した目的プログラム及び
各種リストとを合成し、出力する処理である。
In addition, when there is an SQL statement in the source program, the object program generation and list output processing is performed using the object program and various lists passed from the SQL compiler, and the object program and various lists generated by the own PL/I compiler. This process combines and outputs the

前述したPL/Iコンパイラの処理において、目的プロ
グラムの合成は、PL/rコンパイラ20が出力する目
的プログラムとSQLコンパイラ2lが出力する目的プ
ログラムとをそれぞれ別の制御セクションとして出力し
、その結合を編集結合プログラム(リンケージエディタ
)に行なわせるようにしてもぐ、また、PL/Iコンパ
イラ20が、SQLコンパイラ2lの出力する目的プロ
グラムの中のオフセット情報等を書き換えて、自分の出
力する目的プログラムと同一の制御セクションとして出
力するようにしても良い。
In the process of the PL/I compiler described above, synthesis of the target program involves outputting the target program output by the PL/r compiler 20 and the target program output by the SQL compiler 2l as separate control sections, and editing the combination thereof. Also, the PL/I compiler 20 rewrites the offset information etc. in the target program output by the SQL compiler 2l to make it the same as the target program output by itself. It may also be output as a control section.

また、PL/Iコンパイラ20とSQLコンパイラ2l
との間で送受信される情報14.15は、主記憶装置を
介して相互に転送してもよく、あるいは,外部記憶装置
を介して相互に転送してもよい。
In addition, PL/I compiler 20 and SQL compiler 2l
The information 14, 15 sent and received between the two may be transferred to each other via the main storage device, or may be transferred to each other via the external storage device.

また、PL/Iコンパイラ20とSQLコンパイラ2l
との間の制御の移行は、前述の本発明の複数の実施例の
場合のように1回だけでも良いし、宣言解析のとき、構
文解析のとき、意味解析のとき等、複数回に分けて行な
っても良い。
In addition, PL/I compiler 20 and SQL compiler 2l
The control may be transferred only once, as in the case of the plurality of embodiments of the present invention described above, or may be transferred multiple times, such as during declarative analysis, syntactic analysis, and semantic analysis. You may do so.

[発明の効果] 以上説明したように、本発明によれば次のような効果を
奏することができる。
[Effects of the Invention] As explained above, according to the present invention, the following effects can be achieved.

利用者は、汎用コンパイラだけを起動すればよく、ジョ
ブステップも一つであるため、操作性が良い。
The user only needs to start the general-purpose compiler and there is only one job step, so it is easy to use.

特殊コンパイラの出力する診断メッセージ等は、汎用コ
ンパイラから文番号等の情報を貰うことにより、正しい
形式、すなわち、利用者の記述したソースプログラムか
ら直接得られたと同一の形式で出力することが出来るの
で利用者にとって分かりやすいものとなる。
By receiving information such as statement numbers from the general-purpose compiler, the diagnostic messages etc. output by the special compiler can be output in the correct format, that is, in the same format as if they were directly obtained from the source program written by the user. It becomes easy to understand for users.

字句切り出し、構文解析等のコンパイラの内部処理に関
しても、例えば、汎用コンパイラがすべてを行ない、そ
の結果を中間語として特殊コンパイラへ渡すという手法
、または、汎用コンパイラが、拡張仕様の開始を認識し
た時点で次の文の先頭まで無条件に解析処理を行なわず
に,特殊コンパイラの処理にまかせるという手法等を採
用することにより,無駄な処理の重複を避けることが出
来る。このため、計算機資源の損失を最低限にとどめる
ことができる。
Regarding the compiler's internal processing such as lexical segmentation and syntax analysis, for example, a general-purpose compiler performs all the processing and passes the result to a special compiler as an intermediate word, or the general-purpose compiler recognizes the start of an extended specification. By adopting a technique such as not performing analysis processing unconditionally up to the beginning of the next sentence and leaving it to the processing of a special compiler, unnecessary duplication of processing can be avoided. Therefore, loss of computer resources can be kept to a minimum.

ソースプログラム内部で宣言されている名標の情報等は
、汎用コンパイラが解析し、その解析結果の情報を特殊
コンパイラへ渡す、あるいは、拡張仕様で記述された部
分を特殊コンパイラが解析し、その解析結果の情報を汎
用コンパイラへ渡すことによって、より厳密なエラーチ
ェックが翻訳時に可能となる。
Name information declared within the source program is analyzed by a general-purpose compiler and the resulting information is passed to a special compiler, or a special compiler analyzes the part described in the extended specification and then analyzes the information. By passing the resulting information to a general-purpose compiler, more rigorous error checking becomes possible during translation.

基本仕様部分は、全て汎用コンパイラが処理し、特殊コ
ンパイラは、拡張仕様で記述された部分しか処理しない
ため、言語仕様に不自然な制約を受けることがない。
The general-purpose compiler processes all the basic specification parts, and the special compiler processes only the parts described in the extended specifications, so there are no unnatural restrictions imposed by the language specification.

拡張仕様の追加、変更によるコンパイラの改造を、特殊
コンパイラの改造のみに局所化することができるので、
システムとしての拡張性、保守性の向上を図ることがで
きる。
Modifications to the compiler due to additions and changes to extended specifications can be localized to only modification of the special compiler.
It is possible to improve the expandability and maintainability of the system.

複数の拡張仕様を含むプログラムを扱う際に、コントロ
ーラを設け、該コントローラに各拡張仕様のための特殊
コンパイラを総括させることにより、汎用コンパイラが
意識しなくてはならないインターフエイスは、コントロ
ーラとのインターフエイスだけになり、汎用コンパイラ
の開発を容易に行うことが可能となる. 拡張仕様を追加して、特殊コンパイラの個数が増加した
場合にも、汎用コンパイラとコントローラとのインター
フエイスは変わらないため、汎用コントローラの改造が
不要であり、改造が必要な場合にも微小で済む. 例えば、データベース操作言語であるSQL言語は、r
JIs  X  3005−1987J規格によれば、
COBOL.PL/I,FORTRANなどの既存の汎
用的高級言語に埋め込まれる場合でも、拡張部分に関し
てはすべて同一の構文、及び同一の意味規則を有してい
る。従って、このような拡張仕様については、該拡張仕
様を処理する特殊コンパイラをただ一つ開発すれば、各
種の汎用コンパイラは、この特殊コンパイラとのインタ
ーフエイスを行なう機能だけを実装し、この特殊コンパ
イラとハンドシエイクさせることにより、各種の汎用的
高級言語で容易にこの拡張仕様を使用することができる
。このため、コンパイラの開発に要する費用の低減を図
ることが出来る。
When handling a program that includes multiple extension specifications, by providing a controller and having the controller integrate special compilers for each extension specification, the interface that the general-purpose compiler must be aware of is the interface with the controller. This makes it easier to develop a general-purpose compiler. Even if extended specifications are added and the number of special compilers increases, the interface between the general-purpose compiler and the controller remains the same, so there is no need to modify the general-purpose controller, and even if modification is required, it will be minimal. .. For example, the SQL language, which is a database manipulation language, is r
According to JIs X 3005-1987J standard,
COBOL. Even when embedded in existing general-purpose high-level languages such as PL/I and FORTRAN, all extended parts have the same syntax and the same semantic rules. Therefore, for such extended specifications, if only one special compiler is developed to process the extended specifications, various general-purpose compilers can implement only the function to interface with this special compiler, and this special compiler By handshaking with , this extended specification can be easily used in various general-purpose high-level languages. Therefore, it is possible to reduce the cost required for developing a compiler.

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

第1図は本発明の第1の実施例の基本構成を示すブロッ
ク図、第2図は本発明の第2の実施例の基本構成を示す
ブロック図、第3図はコントローラの処理動作を説明す
るフローチャート、第4図は本発明の第3の実施例の基
本構成を示すブロック図、第5図は本発明の第4の実施
例の構成を示すブロック図、第6図はデータベース操作
言語SQLが埋め込まれたPL/rプログラムの例を示
す図、第7図はPL/IコントローラからSQLコント
ローラへ渡す情報の内容例を示す図、第8図は第7図内
のソースプログラムに関する情報のフォーマット例を示
す図、第9図は第7図内の変数の属性に関する情報のフ
ォーマット例を示す図、第lO図はSQLコントローラ
からPL/Iコントローラへ渡す情報の内容例を示す図
、第11図は第10図内の目的プログラムに関する情報
のフォーマット例を示す図、第.12図は第10図内の
診断メッセージに関する情報のフォーマット例を示す図
、第13図は第lO図内の名標相互の参照関係に関する
情報のフォーマット例を示す図,第14図はPL/rと
SQLコンパイラとが生成する目的プログラムの関係を
示す図、第15図はPL/Iコンパイラの処理内容の概
要を説明するフローチャート、第16図、第17図は従
来技術の構成を示すブロック図である。 11・・・・・・拡張された言語仕様で記・述されたソ
−スプログラム、12・・・・・・汎用コンパイラ、1
3・・・・・・特殊コンパイラ、l4・・・・・・汎用
コンパイラから特殊コンパイラへ渡す情報、15・・・
・・・特殊コンパイラから汎用コンパイラへ渡す情報、
16・・・・・・ソースプログラムを翻訳した結果の目
的プログラム、17・・・・・・診断メッセージ、ソー
スプログラムリストなどの各種リスト、18・・・・・
・特殊コンパイラ群を総括して制御を行なうコントロー
ラ、l9・・・・・・データベース操作言MrIS Q
 Lが埋め込まれたPL/Iプログラム、20・・・・
・・PL/rコンパイラ、2】・・・・・・SQLを翻
訳するSQLコンパイラ、22・・・・・・データベー
ス管理システム、23・・・・・・データベースに関す
る情報を格納してあるデクショナリ。 第 6 図 JE21!1 第3図 第10図 第7図 第8図 第9図 第11図 第12図 #!13図 )一ベトo R +r < 叫宕トO水1♂4 第16図 第17図
FIG. 1 is a block diagram showing the basic configuration of the first embodiment of the present invention, FIG. 2 is a block diagram showing the basic configuration of the second embodiment of the present invention, and FIG. 3 explains the processing operation of the controller. FIG. 4 is a block diagram showing the basic configuration of the third embodiment of the present invention, FIG. 5 is a block diagram showing the configuration of the fourth embodiment of the present invention, and FIG. 6 is a database operation language SQL Figure 7 is a diagram showing an example of the content of information passed from the PL/I controller to the SQL controller, and Figure 8 is the format of the information regarding the source program in Figure 7. Figure 9 is a diagram showing an example of the format of information regarding attributes of variables in Figure 7. Figure 10 is a diagram showing an example of the content of information passed from the SQL controller to the PL/I controller. Figure 11 10 is a diagram showing an example of the format of information regarding the target program in FIG. Figure 12 is a diagram showing an example of the format of information regarding the diagnostic message in Figure 10, Figure 13 is a diagram showing an example of the format of information regarding the reference relationship between names in Figure IO, and Figure 14 is a diagram showing an example of the format of information regarding the mutual reference relationship of names in Figure 10. FIG. 15 is a flowchart outlining the processing contents of the PL/I compiler, and FIGS. 16 and 17 are block diagrams showing the configuration of the conventional technology. be. 11... Source program written and described using extended language specifications, 12... General-purpose compiler, 1
3... Special compiler, l4... Information passed from general-purpose compiler to special compiler, 15...
...Information passed from the special compiler to the general-purpose compiler,
16...Target program resulting from translation of the source program, 17...Various lists such as diagnostic messages, source program list, etc., 18...
・Controller that collectively controls the special compiler group, l9... Database operation command MrIS Q
PL/I program with embedded L, 20...
... PL/r compiler, 2] ... SQL compiler that translates SQL, 22 ... Database management system, 23 ... Dictionary that stores information about the database. Figure 6 JE21!1 Figure 3 Figure 10 Figure 7 Figure 8 Figure 9 Figure 11 Figure 12 #! Fig. 13) 1 bet o R + r < shout o water 1♂4 Fig. 16 Fig. 17

Claims (1)

【特許請求の範囲】 1、汎用的な言語の中に特殊な用途に対する拡張された
言語仕様が埋め込まれた形式のソースプログラムを翻訳
し、目的プログラムを生成するコンパイラにおいて、汎
用的な言語を翻訳する汎用コンパイラと、特殊な用途に
対する拡張された言語を翻訳する特殊コンパイラとを備
え、ソースプログラムが入力された前記汎用コンパイラ
は、前記特殊コンパイラに対して、前記特殊な用途にの
ために記述された部分を翻訳するための情報を渡し、前
記特殊コンパイラは、この情報をもとに特殊な用途に対
する言語で記述された部分を翻訳し、翻訳結果の情報を
前記汎用コンパイラへ返送し、前記汎用コンパイラは、
この情報と、汎用的な言語で記述された部分を汎用コン
パイラ自身が翻訳した結果の情報とを合成し、一括して
出力することを特徴とする拡張された言語仕様のコンパ
イル方式。 2、前記ソースプログラムが、複数種類の特殊な用途に
対する拡張された言語仕様が埋め込まれたソースプログ
ラムである場合、これらの特殊な用途に対する言語を翻
訳する複数の特殊コンパイラと、これらの特殊コンパイ
ラを総括するコントローラとを備え、前記コントローラ
は、汎用的な言語を翻訳する汎用コンパイラとのインタ
ーフェイスを行なうことを特徴とする特許請求の範囲第
1項記載の拡張された言語仕様のコンパイル方式。 3、前記ソースプログラムが複数種類あり、これらのソ
ースプログラムの中に、共通な仕様を持つ特殊な用途に
対する拡張された言語が埋め込まれているた場合、この
特殊な用途に対する言語を翻訳する特殊コンパイラを、
前記ソースプログラムを翻訳する複数の汎用コンパイラ
に対して共通に備えることを特徴とする特許請求の範囲
第1項または第2項記載の拡張された言語仕様のコンパ
イル方式。
[Claims] 1. In a compiler that translates a source program in a format in which extended language specifications for a special purpose are embedded in a general-purpose language and generates a target program, the general-purpose language is translated. The general-purpose compiler is provided with a general-purpose compiler that translates an extended language for a special purpose, and a special compiler that translates an extended language for a special purpose. Based on this information, the special compiler translates the part written in the language for the special purpose, sends the translation result information back to the general-purpose compiler, The compiler is
An extended language specification compilation method that combines this information with information resulting from the translation of parts written in a general-purpose language by the general-purpose compiler itself and outputs them all at once. 2. If the source program is a source program embedded with extended language specifications for multiple types of special uses, multiple special compilers that translate languages for these special uses, and these special compilers 2. The extended language specification compilation method according to claim 1, further comprising: a general-purpose controller, and wherein said controller interfaces with a general-purpose compiler that translates a general-purpose language. 3. If there are multiple types of source programs and an extended language for a special purpose with common specifications is embedded in these source programs, a special compiler that translates the language for this special purpose. of,
The extended language specification compilation method according to claim 1 or 2, characterized in that it is provided in common for a plurality of general-purpose compilers that translate the source program.
JP16267089A 1989-06-27 1989-06-27 Compiling system for extended language specifications Pending JPH0328932A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16267089A JPH0328932A (en) 1989-06-27 1989-06-27 Compiling system for extended language specifications

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16267089A JPH0328932A (en) 1989-06-27 1989-06-27 Compiling system for extended language specifications

Publications (1)

Publication Number Publication Date
JPH0328932A true JPH0328932A (en) 1991-02-07

Family

ID=15759054

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16267089A Pending JPH0328932A (en) 1989-06-27 1989-06-27 Compiling system for extended language specifications

Country Status (1)

Country Link
JP (1) JPH0328932A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014211729A (en) * 2013-04-18 2014-11-13 株式会社日立製作所 Computer, program, and data generation method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014211729A (en) * 2013-04-18 2014-11-13 株式会社日立製作所 Computer, program, and data generation method

Similar Documents

Publication Publication Date Title
JP2666847B2 (en) Heterogeneous language communication method
JP3762867B2 (en) Compiler device, compiling method, and storage medium storing program therefor
Glässer et al. The formal semantics of SDL-2000: status and perspectives
US5812855A (en) System and method for constaint propagation cloning for unknown edges in IPA
JP4041248B2 (en) COMPILER DEVICE, COMPUTER-READABLE RECORDING MEDIUM CONTAINING COMPILING PROGRAM, AND COMPILING METHOD
JP2001184218A (en) Optimization method in compile of mpi program
JPH0328932A (en) Compiling system for extended language specifications
JP2002268896A (en) Method and device for generating control program
JP2007122187A (en) Program code generation device
CN114489683B (en) JVM-based functional programming grammar implementation method for java-like language
JP3889227B2 (en) Program execution device, program execution method, recording medium, and control program
KR101099491B1 (en) Method for analyzing power consumption
JP3630086B2 (en) Program conversion apparatus, program conversion method, and recording medium
JPH02205930A (en) Interface check processing method
JPS6365530A (en) Code optimizing system
JPH06119203A (en) Debugging line deleting device
JP2003076547A (en) System and method for automatically generating control software
CN118585289A (en) Intelligent contract execution method of Ethernet virtual machine based on register
JP2674489B2 (en) Vectorization processor
CN112579088A (en) Heterogeneous hybrid programming-oriented one-stop program compiling method
JPH0358232A (en) Preprocessor calling system
JPH0749843A (en) Parallelized compiler
JPH04209029A (en) Parallel process program translation processor
JPH0342727A (en) System for generating name by pre-compiler
JPH02245934A (en) Data processor