JPH04142629A - Advanced language processor - Google Patents

Advanced language processor

Info

Publication number
JPH04142629A
JPH04142629A JP26588290A JP26588290A JPH04142629A JP H04142629 A JPH04142629 A JP H04142629A JP 26588290 A JP26588290 A JP 26588290A JP 26588290 A JP26588290 A JP 26588290A JP H04142629 A JPH04142629 A JP H04142629A
Authority
JP
Japan
Prior art keywords
instruction
extended instruction
extended
code
analysis 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
JP26588290A
Other languages
Japanese (ja)
Inventor
Katsuyoshi Mitsuyanagi
三柳 勝義
Shinichi Konya
紺谷 真一
Yoshinobu Nakamura
好伸 中村
Fusaji Takahashi
高橋 房治
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 JP26588290A priority Critical patent/JPH04142629A/en
Publication of JPH04142629A publication Critical patent/JPH04142629A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To simply support a new instruction by means of external attaching without affecting the environment of executing an existing instruction by dynamically calling a relevant execution routine from an extended instruction library in response to an intermediate code or machine language code that represents an extended instruction during the execution of interprinter or during the execution of interprinter following compilation. CONSTITUTION:An extended instruction library 21 stores execution instructions are exchangeable extended instructions other than a basic instruction set therein, an extended instruction analytical information memory section 16 stores extended instruction analytical information to be prepared outside the main body of interprinter or main body of compiler therein. Further, when a statement other than reserved words of a basic instruction set appear in an extended instruction analytical processing section 12, the extended instruction analytical information memory section 16 is referred and analyzed to output an intermediate code or machine instruction code in response to the extended instruction. Furthermore, during the execution of instruction in response to an intermediate code or machine language code that represents the extended instruction a relevant execution routine is dynamically called from an extended instruction library 21. With this, a new instruction can be attached externally to the present advanced language processor and simply supported without affecting the environment of executing an existing instruction.

Description

【発明の詳細な説明】 〔概要〕 BAS I Cのような高級言語で記述されたソースプ
ログラムを、解釈実行するインタプリタまたは翻訳する
コンパイラを備えた高級言語処理装置に間し。
DETAILED DESCRIPTION OF THE INVENTION [Summary] A source program written in a high-level language such as BASIC is transferred to a high-level language processing device equipped with an interpreter that interprets and executes it or a compiler that translates it.

新規命令を既存の命令実行環境に影響を与えずに、外付
けで簡単にサポート可能にすることを目的とし。
The purpose is to easily support new instructions externally without affecting the existing instruction execution environment.

基本命令セット以外の交換可能な拡張命令に関する実行
ルーチンを格納する拡張命令ライブラリと、インタプリ
タ本体またはコンパイラ本体の外部に用意される拡張命
令解析情報を記憶する拡張命令解析情報記憶部と、基本
命令セットの予約語以外の文が現れた場合に、拡張命令
解析情報記憶部を参照して解析し、拡張命令に応じた中
間コードまたは機械語コードを出力する拡張命令解析処
理部とを備え、実行時に、拡張命令を示す中間コードま
たは機械語コードに対応して、拡張命令ライブラリ中の
該当する実行ルーチンを動的に呼び出すように構成する
an extended instruction library that stores execution routines related to exchangeable extended instructions other than the basic instruction set; an extended instruction analysis information storage unit that stores extended instruction analysis information prepared outside the interpreter body or the compiler body; and the basic instruction set. When a statement other than a reserved word appears, the extension instruction analysis processing section refers to the extension instruction analysis information storage section, analyzes it, and outputs intermediate code or machine language code according to the extension instruction. , a corresponding execution routine in the extended instruction library is dynamically called in response to intermediate code or machine language code indicating the extended instruction.

〔産業上の利用分野〕 本発明は、BASICのような高級言語で記述されたソ
ースプログラムを、解釈実行するインタプリタまたは翻
訳するコンパイラを備えた高級言語処理装置に関する。
[Industrial Application Field] The present invention relates to a high-level language processing device equipped with an interpreter that interprets and executes a source program written in a high-level language such as BASIC or a compiler that translates it.

例えば計算機用の高級言語の1つとして普及しているB
ASICの処理機構は、オペレーティング・システム(
O5)のない環境で発達した歴史があり3周辺装置に対
する入出力機能など、新しい機能が必要になるごとに、
それを処理する新規命令の処理機構が内部に組み込まれ
ることになり。
For example, B is popular as one of the high-level languages for computers.
The processing mechanism of ASIC is the operating system (
It has a history of developing in an environment without O5), and each time new functions are required, such as input/output functions for peripheral devices,
A new instruction processing mechanism will be built inside to process this.

巨大化する傾向にあった。そのため、新しい特殊命令を
必要としないユーザにとってもメモリ等の負荷が増大す
る原因になった。既存命令使用ユーザに負荷をかけずに
、新規命令をサポートできる手段が必要とされる。また
、ユーザ自身で命令を簡単に作成できれば便利である。
They tended to become larger. This has caused an increase in memory load even for users who do not need new special instructions. What is needed is a means to support new instructions without burdening users of existing instructions. Furthermore, it would be convenient if the user could easily create instructions by himself/herself.

〔従来の技術〕[Conventional technology]

従来のBASICインクブリタは2例えば次のようにB
AS I Cで記述されたプログラムを解釈し実行して
いる。
The conventional BASIC ink printer is 2, for example, B as follows.
Interprets and executes programs written in ASIC.

ソースプログラムのロード時に、ソースを1行ずつ読み
込んで、予約語テーブルをサーチし、対応するトークン
コードに変換する。トークンコードは1例えば命令や関
数の種類などを示す中間コードである。
When loading a source program, it reads the source line by line, searches the reserved word table, and converts it into the corresponding token code. The token code is an intermediate code indicating, for example, the type of command or function.

変換したトークンコードについて、構文解析テーブルを
用いて構文チエツクおよびオペランドのスタックなどを
行い、トークンコードに対応する実行ルーチンを呼び出
して、ソースプログラムによって指示された命令を実行
する。
The converted token code is checked for syntax and stacked with operands using a syntax analysis table, and the execution routine corresponding to the token code is called to execute the instructions specified by the source program.

また、従来のBASICコンパイラは1例えば次のよう
に処理している。
Further, a conventional BASIC compiler processes, for example, as follows.

ソースプログラムを1行ずつ入力し、予約語テーブルを
用いて中間コードのテキストであるコード化テキストを
作成する。そのコード化テキストについて、構文解析テ
ーブルにより構文チエツクを行い、コード化テキストか
ら機械語命令またはそれに類する擬似コードC以下、P
コードという)を生成する。すべてのソースプログラム
についての処理が終了したならば、Pコード等からなる
中間オブジェクトファイルについてアドレス解決処理を
行い、実行可能なオブジェクトのファイルをコンパイル
結果として出力する。
A source program is input line by line and coded text, which is intermediate code text, is created using a reserved word table. A syntax check is performed on the coded text using a syntax analysis table, and machine language instructions or similar pseudocode C and below are extracted from the coded text.
(referred to as code). When processing for all source programs is completed, address resolution processing is performed on intermediate object files consisting of P code, etc., and an executable object file is output as a compilation result.

このコンパイル結果のオブジェクトを実行するときには
、ますローダがPコードをメモリ上に展開する。そして
、Pコードを取り出してPコードに対応する実行ルーチ
ンを呼び出すことにより。
When executing the object resulting from this compilation, the loader expands the P code onto memory. and by retrieving the P-code and calling the execution routine corresponding to the P-code.

ユーザが所望する処理を行う。Perform the processing desired by the user.

従来技術では1以上のように高級言語の命令が一律に解
釈実行または翻訳されており、O3のコマンド、O8の
機能2周辺装置等に関する命令をサポートする場合には
、その命令を高級言語を処理する本体の中に、一体化し
て紐み込むようにされていた。
In the conventional technology, commands in a high-level language are uniformly interpreted or translated, and when supporting O3 commands, commands related to O8 function 2 peripheral devices, etc., the commands are processed in a high-level language. It was designed to be integrated and tied into the main body.

また、ユーザ自身が独自に開発した機能をプログラムで
使用したいときには2機械語ライブラリを作成し、その
機械語ライブラリの実行ルーチンを呼び出す命令を使わ
なければならなかった。
Furthermore, when a user wants to use a function that he or she has independently developed in a program, it is necessary to create two machine language libraries and use an instruction to call the execution routine of the machine language library.

[発明が解決しようとする課題〕 従来技術では2例えば新しい周辺装置を扱う特殊命令を
サポートしようとすると、それを解析するルーチンや実
行ルーチンは、他の既存の命令と同等に扱われるため、
その特殊命令を必要としないユーザにとっても、負荷の
大きいBASICインタプリタまたはBASICコンパ
イラを使用させられることになるという問題があった。
[Problems to be Solved by the Invention] In the prior art, for example, when trying to support a special instruction that handles a new peripheral device, the routine that analyzes it and the execution routine are treated the same as other existing instructions.
There is a problem in that even users who do not need the special instructions are forced to use the BASIC interpreter or BASIC compiler, which has a heavy load.

また1機械語ライブラリという形で、新たな機能を実現
する場合には2本来、素人向き言語であるBAS ] 
Cが、突然マニアツクなりASICに早変わりしてしま
い、使用方法の誤りによる暴走が生じることがあった。
In addition, when implementing new functions in the form of a machine language library, BAS, which is originally a language for amateurs, is used.
C suddenly became a maniac and turned into an ASIC, which sometimes caused a runaway operation due to incorrect usage.

使用方法に誤りがなくても1機械語ライブラリを呼び出
すCALL命令の記述の羅列になり、非常に解読性、保
守性の悪いプログラムになるという問題があった。
Even if there is no error in usage, the program becomes a list of descriptions of CALL instructions that call one machine language library, resulting in a program that is extremely difficult to read and maintain.

本発明は上記問題点の解決を図り、新規命令を〔課題を
解決するための手段〕 第1図は本発明の原理構成図である。
The present invention aims to solve the above-mentioned problems and provides a new command. [Means for Solving the Problems] FIG. 1 is a diagram showing the basic configuration of the present invention.

第1図において、10は高級言語で記述されたソースプ
ログラム、11はインクプリタ本体やコンパイラ本体な
どの高級言語処理本体部、12は基本命令セット以外の
命令である拡張命令を解析する拡張命令解析処理部、1
3は解析した結果の中間コードまたは機械語コード(以
下、単に中間コードという)、14は拡張命令について
所定の形式による文法を定義する文法定義文、15は文
法定義文14を拡張命令解析情報に変換する文法定義文
コンバータ、16は拡張命令解析情報を記憶する拡張命
令解析情報記憶部、17は解析のための初期化を行う初
期化ルーチン、18は拡張命令を解析するための解析テ
ーブル、19は標準で用意されている基本命令ライブラ
リ520は標準で用意されている基本命令を処理する基
本命令実行ルーチン、21は拡張命令ライブラリ、22
は拡張命令を処理する拡張命令実行ルーチンを表す。
In FIG. 1, 10 is a source program written in a high-level language, 11 is a high-level language processing main unit such as an inkpreter body or a compiler body, and 12 is an extended instruction analysis process that analyzes extended instructions that are instructions other than the basic instruction set. Part 1
3 is an intermediate code or machine language code (hereinafter simply referred to as intermediate code) as a result of the analysis; 14 is a grammar definition sentence that defines a grammar in a predetermined format for extended instructions; and 15 is a grammar definition sentence 14 as extended instruction analysis information. 16 is an extended instruction analysis information storage unit that stores extended instruction analysis information; 17 is an initialization routine that performs initialization for analysis; 18 is an analysis table for analyzing extended instructions; 19 21 is an extended instruction library, 22 is a basic instruction library 520 that is provided as standard, and is a basic instruction execution routine that processes basic instructions that are provided as standard.
represents an extended instruction execution routine that processes extended instructions.

本発明では、あらかじめ定められた基本命令セント以外
の交換可能な拡張命令に関する各種の拡張命令実行ルー
チン22を格納する拡張命令ライブラリ21と、それら
の拡張命令の構文チエツクなどを行い、必要に応じてオ
ペランドをスタックする処理などを行う拡張命令解析情
報を記憶する拡張命令解析情報記憶部16とが、高級言
語処理本体部11に対して外付けで用意できるようにな
っている。
The present invention includes an extension instruction library 21 that stores various extension instruction execution routines 22 related to exchangeable extension instructions other than predetermined basic instruction cents, and performs syntax checks of these extension instructions, etc. An extended instruction analysis information storage section 16 that stores extended instruction analysis information for performing processing such as stacking operands can be prepared externally to the high-level language processing main body section 11.

高級言語処理本体部11は、ソースプログラム10中に
基本命令セットの予約語以外の文が現れた場合に、拡張
命令解析処理部12を呼び出し。
The high-level language processing main unit 11 calls the extended instruction analysis processing unit 12 when a sentence other than a reserved word of the basic instruction set appears in the source program 10.

その文について拡張命令解析情報記憶部16を参照して
解析することにより、拡張命令に応じた中間コード13
を出力する。
The intermediate code 13 corresponding to the extended instruction is analyzed by referring to the extended instruction analysis information storage unit 16 for the sentence.
Output.

これにより、インタプリタにおける実行時またはコンパ
イル後の実行時に、拡張命令を示す中間コード13が出
現すると、拡張命令ライブラリ21中の該当する拡張命
令実行ルーチン22を動的に呼び出し、特殊な命令につ
いての処理を行う。
As a result, when intermediate code 13 indicating an extension instruction appears during execution in the interpreter or execution after compilation, the corresponding extension instruction execution routine 22 in the extension instruction library 21 is dynamically called, and processing for the special instruction is executed. I do.

本体に最初から標準で備わっている基本命令については
、従来同様、高級言語処理本体部11に組み入れられて
いる基本命令の実行ルーチンまたはランタイムシステム
と呼ばれる基本命令ライブラリ19に収容されている基
本命令実行ルーチン20によって処理する。
Regarding the basic instructions that are provided as standard in the main body from the beginning, as before, the basic instruction execution routine built into the high-level language processing main unit 11 or the basic instruction execution routine stored in the basic instruction library 19 called the runtime system is used. Processing is performed by routine 20.

拡張命令解析情報記憶部16の生成を、ユーザが簡単に
行うことができるようにするために、拡張命令の文法を
記述する文法定義文14が、所定の規則により定められ
ており、それによってユーザが拡張命令解析情報の基礎
となる情報を指定することができる0文法定義文コンバ
ータ15は。
In order to enable the user to easily generate the extended instruction analysis information storage section 16, a grammar definition sentence 14 that describes the grammar of the extended instruction is defined according to a predetermined rule. The 0 grammar definition sentence converter 15 is capable of specifying information that becomes the basis of extended instruction analysis information.

文法定義文14を入力し、それを解析して拡張命令解析
情報記憶部16を自動生成する。
A grammar definition sentence 14 is input, it is analyzed, and an extended instruction analysis information storage section 16 is automatically generated.

拡張命令解析情報記憶部16は、拡張命令の予約語や構
文解析テーブルなどの各種の解析テープル18を有し、
それらのテーブル等を初期化する初期化ルーチン17を
持っている。拡張命令解析情報記憶部16は、実行時に
呼び出し元に動的に結合されるダイナミック・リンク・
ライブラリ形式で作成され、高級言語処理本体部11か
ら呼び出しがあると、高級言語処理本体部11に動的に
結合される。
The extended instruction analysis information storage unit 16 has various analysis tables 18 such as reserved words and syntax analysis tables for extended instructions.
It has an initialization routine 17 that initializes these tables. The extended instruction analysis information storage unit 16 includes dynamic link information that is dynamically connected to the caller during execution.
It is created in a library format and is dynamically coupled to the high-level language processing main unit 11 when called from the high-level language processing main unit 11.

〔作用〕[Effect]

本発明では、標準で用意される基本命令セット以外の命
令については、外部から命令の構文および実行ライブラ
リの情報を獲得できるようになっている。したがって、
BASICなどの高級言語における基本命令セット以外
の特殊命令を、外付けで使用することができる。すなわ
ち、ハードウェアに拡張ボードを取り付けると機能アン
プするように、ソフトウェアに拡張命令を取り付ければ
基本命令セット以外の命令が簡単に使用できるようにな
り9機能アップ可能となる。
In the present invention, for instructions other than the standard basic instruction set, information on the instruction syntax and execution library can be obtained from the outside. therefore,
Special instructions other than the basic instruction set in a high-level language such as BASIC can be used externally. That is, just as attaching an expansion board to hardware increases its functionality, attaching expansion instructions to software makes it possible to easily use instructions other than the basic instruction set, making it possible to upgrade nine functions.

特に、BASIC言語は、比較的小規模の計算機システ
ムで使用されることが多く9また。新しい機能の追加が
しばしば必要になることが多いため、既存の実行環境に
あまり影響を与えないで新規命令を追加できる効果は大
きい、もちろん、他の高級言語にも応用可能である。
In particular, the BASIC language is often used in relatively small-scale computer systems9. Since it is often necessary to add new functions, the ability to add new instructions without significantly affecting the existing execution environment is a great advantage.Of course, it can also be applied to other high-level languages.

〔実施例〕〔Example〕

第2図は本発明の適用システムの例であって。 FIG. 2 is an example of a system to which the present invention is applied.

特に第2図(イ)はBASICインタプリタへの適用例
、 (ロ)はRAS I Cコンパイラへの適用例を示
している。
In particular, FIG. 2(a) shows an example of application to a BASIC interpreter, and FIG. 2(b) shows an example of application to a RAS I C compiler.

第2図において、30はCPUおよびメモリ等を備えた
データ処理装置、31はBAS I Cインタプリタ本
体部、32は基本命令に関する予約語を記憶する予約語
テーブル、33は基本命令に関する構文情報を記憶する
構文解析テーブル、34はソースコードを変換したトー
クンコード、35は第1図に示す拡張命令解析情報記憶
部16に記憶されている拡張命令解析情報、36はBA
S ICコンパイラ本体部、37は実行形式プログラム
ファイルを表す。
In FIG. 2, 30 is a data processing device equipped with a CPU, memory, etc., 31 is a BASIC interpreter main body, 32 is a reserved word table that stores reserved words related to basic instructions, and 33 is a storage that stores syntax information related to basic instructions. 34 is a token code obtained by converting the source code, 35 is extended instruction analysis information stored in the extended instruction analysis information storage unit 16 shown in FIG. 1, and 36 is BA
The SIC compiler main body 37 represents an executable program file.

BAS I Cインタプリタ本体部31は、ソースプロ
グラム10を入力すると、予約語テーブル32によって
、トークンコード34への変換を行う。
When the BAS I C interpreter main unit 31 receives the source program 10, it converts it into a token code 34 using the reserved word table 32.

入力したソースが予約語テーブル32に登録されていな
ければ、拡張命令解析情報35によって。
If the input source is not registered in the reserved word table 32, by the extended instruction analysis information 35.

拡張命令であるかどうかの判定を行い、拡張命令であれ
ば、それを示すトークンコード34に変換する。さらに
、トークンコード34について、構文解析テーブル33
または拡張命令解析情報35により構文チエツクなどを
行い、該当する基本命令実行ルーチン20または動的に
結合される拡張命令実行ルーチン22によって、命令の
実行を行う。
It is determined whether the instruction is an extended instruction or not, and if it is an extended instruction, it is converted into a token code 34 indicating it. Furthermore, regarding the token code 34, the syntax analysis table 33
Alternatively, a syntax check or the like is performed using the extended instruction analysis information 35, and the instruction is executed by the corresponding basic instruction execution routine 20 or the dynamically coupled extended instruction execution routine 22.

BASICコンパイラ本体部36も同様であるが、ソー
スプログラム10を解析して、すぐに実行するのではな
く、解析結果について機械語コードまたはPコードに変
換したものを、実行形式プログラムファイル37として
出力する。なお、直接実行形式で出力するのではなく、
結合編集の対象となるオブジェクトファイルとして出力
することもあるが、以下の実施例では、説明を簡単にす
るために、実行形式で出力するものとして説明する。
The BASIC compiler main unit 36 is similar, but instead of analyzing the source program 10 and immediately executing it, it converts the analysis result into machine language code or P code and outputs it as an executable program file 37. . Note that instead of outputting directly in executable format,
Although it may be output as an object file that is subject to combined editing, in the following embodiments, in order to simplify the explanation, it will be described as output in executable format.

ソースプログラム10中に拡張命令があると。There are extended instructions in the source program 10.

BAS I Cコンパイラ本体部36は、拡張命令解析
情報35に基づいて解析を行い、拡張命令実行ルーチン
22を呼び出す命令に展開する。したがって、実行形式
プログラムファイル37のプログラムを実行すると、必
要な時点で拡張命令を処理するための拡張命令実行ルー
チン22が呼び出されて処理されることになる。
The BASIC compiler main unit 36 analyzes the extended instruction analysis information 35 and expands it into an instruction that calls the extended instruction execution routine 22 . Therefore, when the program in the executable program file 37 is executed, the extended instruction execution routine 22 for processing extended instructions is called and processed at the necessary time.

以下9本発明の実施例についての詳しい説明に先立って
、まず実施例に関係する技術について説明する。
Prior to a detailed explanation of the following nine embodiments of the present invention, techniques related to the embodiments will first be explained.

第3図は本発明の実施例に係るインタプリタによる解析
説明図である。
FIG. 3 is an explanatory diagram of analysis by an interpreter according to an embodiment of the present invention.

インタプリタでは、ソースプログラムをトークンコード
に変換する。トークンコードは、ソースを解析しやすい
ように、命令、関数、定数、変数。
The interpreter converts the source program into token code. Tokencodes contain instructions, functions, constants, and variables, making it easier to parse the source.

ラベル、コメント区切り記号等に分類し、あるコードに
変換したものである。ソースプログラムのローディング
時に、予約語テーブルによってトークンコードへの′変
換(フランチ)を行う。
It is classified into labels, comment delimiters, etc. and converted into a certain code. When loading a source program, it is converted (franchised) into a token code using the reserved word table.

ソースプログラムは、第3図(イ)に示すようにフラン
チされることになる。各行の先頭は2次の行へのポイン
タである0次に1行番号とトークンコードの並びが続く
、各行の最後は、16進数の’oo”で示される。
The source program will be franchised as shown in FIG. 3(a). The beginning of each line is a pointer to the second line, which is 0, followed by a line number and token code, and the end of each line is indicated by a hexadecimal number 'oo'.

解析/実行時には、トークンコードにより、第3図(ロ
)に示すように、対応する構文解析テーブルを参照して
、構文チエツクを行い、スタックに実行ルーチンとのイ
ンタフェース情報を積み込む、積み込むのは主にオペラ
ンド値である。
During analysis/execution, as shown in Figure 3 (b), the token code refers to the corresponding syntax analysis table, performs a syntax check, and loads interface information with the execution routine onto the stack. is the operand value.

なお、構文解析テーブルには9文の成立ちを示す情報が
記述されており3分類したトークンが記述される順序を
規定した情報などが格納されている。
Note that the syntax analysis table describes information indicating the formation of nine sentences, and stores information such as specifying the order in which tokens classified into three categories are written.

例えばrABC文字列 〔、数値〕」と表される文法に
対する構文解析テーブルのイメージは。
For example, the image of the syntax analysis table for the grammar expressed as "rABC character string [, numeric value]" is as follows.

第3図(ハ)に示すように1文字型の次は、カンマ(1
)と数値型、または省略というような順序を規定する情
報である。構文チエツクにより、この流れに合わない記
述はエラーとなる。
As shown in Figure 3 (C), the next character type is a comma (1
), numeric type, or abbreviation. Due to the syntax check, any description that does not follow this flow will result in an error.

実行ルーチンに渡す情報(オペランド値)は。The information (operand values) to be passed to the execution routine.

第3図(ニ)、(ホ)のように、スタック40に積まれ
る。第3図(ニ)では2文字列”ABCD”の領域に対
するポインタと数値「lO」がスタック40に積まれる
。オペランドが省略された場合には、第3図(ホ)に示
すように、省略オペランドを意味する特殊コードのオペ
ランドが積まれる。
As shown in FIGS. 3(d) and 3(e), they are stacked on a stack 40. In FIG. 3(d), a pointer to the area of the two character strings "ABCD" and a numerical value "lO" are stacked on the stack 40. When an operand is omitted, an operand with a special code indicating an omitted operand is stacked as shown in FIG. 3(e).

なお、スタック40に積むオペランドは、簡略化して記
述しているが、型や長さ(文字型)等もスタック情報と
して存在する。
Although the operands stacked on the stack 40 are described in a simplified manner, the type, length (character type), etc. also exist as stack information.

実行は、トークンコードに応じたディスパッチテーブル
(図示省略)により、対応する実行ルーチンを呼び出し
て行う、実行ルーチンは、スタック40からオペランド
値を取り込み処理する。
Execution is performed by calling a corresponding execution routine using a dispatch table (not shown) according to the token code.The execution routine takes in operand values from the stack 40 and processes them.

一方、コンパイラの場合、インタプリタのトークンコー
ドと同様に、ソースを一旦、コード化テキストという解
析しやすい中間コード情報に変換する。このコード化テ
キストによって、第4図(イ)に示すように対応する構
文解析テーブルによる構文チエツク等を行う。
On the other hand, in the case of a compiler, similar to the token code of an interpreter, the source is first converted into intermediate code information called coded text that is easy to analyze. Using this coded text, a syntax check is performed using the corresponding syntax analysis table as shown in FIG. 4(a).

コンパイラにおける構文解析テーブルのイメージも、第
4図(ロ)に示すように、インタプリタの場合と同様で
ある。
The image of the syntax analysis table in the compiler is also similar to that in the interpreter, as shown in FIG. 4(b).

コンパイラは、コード化テキストをもとに9機械語コー
ドまたは機械語に近いプリミティブな命令からなるPコ
ード(擬似コード)を出力する。
The compiler outputs P code (pseudo code) consisting of nine machine language codes or primitive instructions similar to machine language based on the coded text.

例えばrABC”123”、A+2Jというようなソー
スの命令があワたとき、第4図(ハ)に示すようなPコ
ード41が生成される。数値式の場合は、順次実行可能
なように逆ボーランド記法により2例えば第4図(ニ)
や第4図(ホ)に示すようなPコード41が生成される
For example, when a source instruction such as rABC"123", A+2J is activated, a P code 41 as shown in FIG. 4(c) is generated. In the case of numerical expressions, use reverse Borland notation so that they can be executed sequentially.
A P code 41 as shown in FIG. 4 (e) is generated.

こうしてコンパイラによって生成された実行形式プログ
ラムファイル37は、第5図(イ)に示すような構成に
なっている。実行ファイルのヘッダー(EXEヘッダー
)に続くローダは、ランクイムシステムをロードすると
ともに、以下の領域をロードし、ランタイムシステムに
制御を渡す。
The executable program file 37 generated by the compiler in this way has a structure as shown in FIG. 5(a). The loader following the header (EXE header) of the executable file loads the runtime system, loads the following areas, and passes control to the runtime system.

ランタイムシステムは、Pコードを解析し、実行する。The runtime system parses and executes the P-code.

BASICヘッダーは、BASICのコンパイル結果の
領域を管理する。特にLINK情報は。
The BASIC header manages the area of BASIC compilation results. Especially the LINK information.

CHAINやサブプログラムで使用する領域である。D
LLテーブルは、ダイナミック・リンク・ライブラリを
管理するテーブルである。
This is an area used by CHAIN and subprograms. D
The LL table is a table that manages dynamic link libraries.

Pコード41は、コンパイル時に構文チエツクがされて
いるため5例えば第5図(ロ)に示すような実行に関す
る命令■〜■の集まりとなる。・この命令の実行で、A
BC命令に対応する実行ルーチンに制御が渡るときには
、Pコード41の実行により、第5図(ハ)に示すよう
にスタック40へのスクッキングが行われ、■の状態で
スタック40が渡される。
Since the P code 41 is syntactically checked at the time of compilation, it is a collection of execution-related instructions 5, for example, as shown in FIG. 5(B).・By executing this command, A
When control is transferred to the execution routine corresponding to the BC instruction, scooking to the stack 40 is performed as shown in FIG. 5(C) by executing the P code 41, and the stack 40 is passed in the state of ■.

次にユーザが任意に作成することができる拡張命令につ
いて説明する。
Next, extended instructions that can be created arbitrarily by the user will be explained.

拡張命令は2文法定義文により定義する0文法定義文は
、拡張命令に対する文法と実行ルーチンへのディスバッ
チ情報を持つ文であり、サポートする拡張命令のライブ
ラリ単位で1つのファイルを構成する。
Extension instructions are defined by 2 grammar definition statements. 0 Grammar definition statements are statements that have the grammar for extension instructions and dispatch information to execution routines, and each library of supported extension instructions constitutes one file.

文法定義文の構文は1例えば第6図(イ)に示すように
なっている。各項目は、タブまたは空白で区切らなけれ
ばならない。文の終りは復帰・改行コードである。文中
に記述する項目は、以下の内容である。
The syntax of the grammar definition sentence is as shown in FIG. 6(a), for example. Each item must be separated by a tab or space. The end of the sentence is a carriage return/line feed code. The items to be described in the text are as follows.

〈種別〉:定義する文法が「命令」か「関数Jかを記述
する。
<Type>: Describe whether the grammar to be defined is "command" or "function J".

命令:命令の文法を記述するとき指定する。Command: Specify when writing the command grammar.

関数二関数の文法を記述するとき指定する。Specify when writing the grammar of a function-bifunction.

<ANK名称〉:命令または関数のANK名称をを記述
する。ANK文字で記述しなければならない、許される
ANK文字は、英数字、アンダースコアである。ただし
、最初の文字は英字でなければならない。関数で文字型
の場合には最後に$を指定する。小文字で指定した場合
<ANK name>: Describe the ANK name of the instruction or function. The allowed ANK characters that must be written in ANK characters are alphanumeric characters and underscores. However, the first character must be a letter. If the function is of character type, specify $ at the end. When specified in lowercase letters.

大文字に変換される。この名称は実行ルーチン名の一部
としても使用される。
Converts to uppercase. This name is also used as part of the execution routine name.

〈国語名称〉:「命令」または「関数」の国語名称を記
述する。
<Japanese name>: Describe the Japanese name of the "command" or "function".

〈オペランド記述〉:オペランドの形態を下記の形式で
記述する。記述に用いる特殊記号は半角でも全角でも構
わない、関数の場合、オペランドが1つも存在しなくて
も、ダミーとして最低1つのオペランドを記述しなけれ
ばならない。
<Operand description>: Describe the form of the operand in the following format. The special symbols used in the description can be either half-width or full-width. In the case of a function, at least one operand must be written as a dummy even if there is no operand.

BNF風表記でオペランドの記述の文法を示すと以下の
とおりである。
The syntax of operand description in BNF style notation is as follows.

オペランド::識オペランド項目 オペランド、オペランド項目 オペランド項目::一数値型1 〔数値型〕文字型I 
〔文字型〕 配列変数1 〔配列変数〕 〔〕:省略可能を示す。
Operand::Intelligence operand item operand, operand item operand item:: 1 Numeric type 1 [Numeric type] Character type I
[Character type] Array variable 1 [Array variable] []: Indicates that it can be omitted.

数値型は、整数型、単精度実数型9倍精度実数型の定数
、変数2式を示す。文字型は2文字型の定数、変数7式
を示す、配列変数は1文字型、整数型、単精度実数型1
倍精度実数型の配列を示す。
Numerical types include integer type, single precision real number type, 9 double precision real number type constants, and two variable expressions. Character type indicates 2 character type constants, 7 variable expressions, array variables 1 character type, integer type, single precision real number type 1
Indicates an array of double-precision real numbers.

配列は実行時に確保されるため、型、配列要素数。Arrays are allocated at runtime, so the type, number of array elements.

存在の有無の検査は、実行ルーチンで行う必要がある。The execution routine must check for its existence.

拡張命令実行ルーチンの実行ルーチン名は9次のように
ユーザ実行ルーチン識別IDと、ANK名称により定め
る。
The execution routine name of the extended instruction execution routine is determined by the user execution routine identification ID and ANK name as shown below.

命令の場合=「UbS」とrANKANK名称の場合:
 rUbfJとrANK名称ノただし、rANKANK
名称初の文字は大文字。
For instructions = “UbS” and rANKANK name:
rUbfJ and rANK names, however, rANKANK
The first letter of the name is capitalized.

それ以後は小文字とする。もし文字型の場合、最後の$
は記述できないため、  24 ($の16進コード)
に置き換えて記述する。
After that, the letters are lowercase. If it is a character type, the last $
cannot be written, so 24 (hexadecimal code of $)
Replace it with .

例えば、あるファイルに属性を設定する拡張命令rsE
TJを作成するとする。これの文法定義文14は、第6
図(ロ)図示のように記述する。
For example, the extension command rsE that sets attributes on a certain file
Suppose we create a TJ. Grammar definition sentence 14 of this is the 6th
Figure (b) Write as shown.

これの拡張命令実行ルーチン22の実行ルーチン名は、
”UbsSet”となる。
The execution routine name of this extended instruction execution routine 22 is:
It becomes "UbsSet".

オペランドは、ファイル名と属性文字の2つの文字型で
あり、ANK名称の(a)または国語名称の(b)のよ
うに用いることができる。(a)の場合、ファイル名″
FILE”に“A″の属性を設定することを意味する。
The operands are of two character types: a file name and an attribute character, and can be used as in (a) for an ANK name or (b) for a Japanese name. In the case of (a), the file name
This means setting the attribute "A" to "FILE".

第6図(ハ)は、スクリーンを指定時間だけロックする
拡張命令rscRLOcK」の例である。
FIG. 6(c) is an example of the extended instruction rscRLOcK which locks the screen for a specified time.

文法定義文14は、省略可能な待ち時間を示す数値型と
9機能番号を示す数値型の2つのオペランドを定義して
いる0例えば(C)のように用いる。
The grammar definition statement 14 defines two operands: a numerical type indicating an optional waiting time and a numerical type indicating a function number.

同様に関数についても、ユーザが作成したものを用いる
ことができる。第6図(ニ)は、数値を2進数に変換す
る関数rBIN$Jまたは「二進$」の定義を示してい
る。 (d)、 (e)のように用いることができる。
Similarly, functions created by the user can be used. FIG. 6(d) shows the definition of the function rBIN$J or "binary $" that converts a numerical value into a binary number. It can be used as in (d) and (e).

この拡張命令実行ルーチン22については、実行ルーチ
ン名”UbfBin24″で拡張ライブラリに組み込ん
でおく。
This extended instruction execution routine 22 is incorporated into the extended library with the execution routine name "UbfBin24".

第1図に示す文法定義文コンバータ15は9文法定義文
14を格納した定義文ファイルの名前を羅列した定義文
指定ファイルを入力し、各定義文ファイル中の文法定義
文14から拡張命令解析情報を生成する。
The grammar definition sentence converter 15 shown in FIG. generate.

拡張命令解析情報は、第7図に示すような情報からなる
The extended instruction analysis information consists of information as shown in FIG.

第7図に示す拡張命令解析情報35のファイルは、ダイ
ナミック・リンク・ライブラリ(DLL)形式で作成さ
れる。したがって、これをロードするだけで、拡張命令
解析情報35がメモリに展開される。
The extended instruction analysis information 35 file shown in FIG. 7 is created in a dynamic link library (DLL) format. Therefore, simply by loading this, the extended instruction analysis information 35 is developed in the memory.

解析テーブル初期化ルーチン35−1は、予約語&構文
解析情報35−2のアドレスと、DLL名テーブル35
−3のアドレスを呼び出し元へ通知する。
The analysis table initialization routine 35-1 stores the address of the reserved word & syntax analysis information 35-2 and the DLL name table 35.
-3 address to the caller.

予約語&構文解析情報35−2は、第7図に示すように
、DLL名テーブル35−3における何番目かを示すD
LL番号、命令/関数識別idおよび文法定義文14で
定義されたANK予約語。
As shown in FIG.
An ANK reserved word defined by the LL number, instruction/function identification ID, and grammar definition statement 14.

国語予約語、構文解析テーブル、実行ルーチンへのポイ
ンタを持つ。なお、実行ルーチンへのポインタは、実行
時にダイナミック・リンクにより解決される。
Contains pointers to Japanese reserved words, parsing tables, and execution routines. Note that pointers to execution routines are resolved by dynamic linking at runtime.

DLL名テーブル35−3は、実行ルーチンをローディ
ングするとき、実行ルーチンが存在するライブラリを求
めるために使用する。
The DLL name table 35-3 is used to find the library in which the execution routine exists when loading the execution routine.

構文解析テーブルは、第8図(イ)に示すように、関数
または命令を識別する関数/命令識別子と2文字式、数
値式2区切り記号(1)等のトークンコード、正常時に
たどる構文解析テーブルエントリへのポインタ、異常時
にたどる構文解析テーブルエントリへのポインタなどを
持つ。
As shown in Figure 8 (a), the syntax analysis table includes a function/instruction identifier that identifies a function or instruction, a token code such as a two-character expression, a numeric expression, and a delimiter (1), and a syntax analysis table that is followed during normal operation. It has a pointer to the entry, a pointer to the parsing table entry to follow in case of an error, etc.

例えば、オペランドの文法が。For example, the syntax of operands.

「文字式、〔、数値式〕」であるとき、その構文解析テ
ーブルのイメージは、第8図(ロ)ニ示すようになる。
When it is a "character expression, [, numerical expression]", the image of the syntax analysis table is as shown in FIG. 8(b)-d.

インタプリタにおける拡張命令のトークンコードは、第
9図(イ)に示すような構造になっている。次のトーク
ンへのポインタと、ソースの通番と、拡張命令を示す拡
張命令識別子と、予約語&構文解析情報のエントリ番号
とからなる。
The token code of the extended instruction in the interpreter has a structure as shown in FIG. 9(a). It consists of a pointer to the next token, a source serial number, an extended instruction identifier indicating an extended instruction, and an entry number for reserved words and parsing information.

拡張命令識別子により拡張命令であることがわかると、
該当する予約語&構文解析情報により。
If the extended instruction identifier indicates that it is an extended instruction,
With applicable reserved words & parsing information.

その解析・実行を行う。Analyze and execute it.

コンパイラにおける拡張命令のPコードは、第9図(ロ
)に示すような構造になっている。拡張命令認識コード
は、拡張命令用と拡張関数用とがある。DLL番号は、
DLL名テーブルのエントリ番号である。ANK予約語
へのポインタは、命令または関数名へのポインタであり
1国語予約語が指定されても、ANK予約語に変換され
、それをポイントする。実行ルーチンへのポインタは。
The P code of the extended instruction in the compiler has a structure as shown in FIG. 9(b). There are extended instruction recognition codes for extended instructions and extended functions. The DLL number is
This is the entry number of the DLL name table. A pointer to an ANK reserved word is a pointer to an instruction or function name, and even if a monolingual reserved word is specified, it is converted to an ANK reserved word and points to it. A pointer to the execution routine.

実行時に解決される。resolved at runtime.

拡張命令のPコードの実行は、以下のように行う。Execution of the extended instruction P code is performed as follows.

i)Pコードの実行ルーチンへのポインタを入手する。i) Obtain a pointer to the P-code execution routine.

j)Pコードの実行ルーチンへのポインタが設定されて
いなければ、以下の処理を行う。
j) If the pointer to the P code execution routine is not set, perform the following processing.

(a)DLL番号からDLL名を手に入れる。(a) Obtain the DLL name from the DLL number.

(b)DLL名で指定された拡張命令ライブラリをロー
ドする。もし、拡張命令ライブラリが見つからない場合
には、エラーとする。
(b) Load the extended instruction library specified by the DLL name. If the extended instruction library is not found, an error occurs.

(C)ANK予約語によって示された文字列より実行ル
ーチン名を作成する。すなわち、命令ならUbs、関数
ならUbfをANK予約語の頭に付加し、この名前によ
って実行ルーチンのアドレスを手に入れる。もし、実行
ルーチンのアドレスが手に入らない場合には、エラーと
する。
(C) Create an execution routine name from the character string indicated by the ANK reserved word. That is, add Ubs to the beginning of the ANK reserved word for instructions and Ubf for functions, and use this name to obtain the address of the execution routine. If the address of the execution routine cannot be obtained, an error occurs.

(d)  実行ルーチンのアドレスをPコードに設定す
る。
(d) Set the address of the execution routine in the P code.

■)実行ルーチンを呼び出す。■) Call the execution routine.

第10図は、第1図に示す文法定義文コンバータ15の
処理フローを示している。以下、第10図に示す■〜[
相]に従って説明する。
FIG. 10 shows a processing flow of the grammar definition sentence converter 15 shown in FIG. Below, ■~[ shown in Figure 10
The explanation will be given according to the phase.

■ 必要な初期化を行い、定義文ファイル名が格納され
ている定義文指定ファイル60をオープンする。
■ Perform the necessary initialization and open the definition statement specification file 60 in which the definition statement file name is stored.

■ 定義文指定ファイル60から、定義文ファイル名を
1つ取り出す。
■ Extract one definition statement file name from the definition statement specification file 60.

■ 定義文指定ファイル60のデータが終了したならば
、処理■へ移る。
■ When the data in the definition statement specification file 60 is completed, the process moves to process ■.

■ 処理■で取り出した定義文ファイル名の定義文ファ
イル61をオーブンする。
■ Open the definition statement file 61 with the definition statement file name taken out in process (■).

■ オーブンした定義文ファイル61から1文法定義文
を1つ取り出す。
■ Extract one grammar definition sentence from the opened definition sentence file 61.

■ 文法定義文が終了したかどうかを判定し、終了した
ならば、処理■へ移る。
■ Determine whether the grammar definition sentence has ended, and if it has ended, move to process ■.

■ 文法定義文を第7図に示すような拡張命令解析情報
に変換する。その後、処理■に戻り、同様に次の文法定
義文を処理する。
■ Convert the grammar definition sentence into extended instruction analysis information as shown in FIG. Thereafter, the process returns to process (2), and the next grammar definition sentence is processed in the same way.

■ 文法定義文が終了したならば、定義文ファイル61
をクローズし、処理■へ戻る。
■ When the grammar definition sentence is finished, the definition sentence file 61
Close and return to process ■.

■ すべての定義文ファイル61についての処理が終了
したならば、拡張命令解析情報を予約語の昇順にソート
する。
- When processing for all definition statement files 61 is completed, the extended instruction analysis information is sorted in ascending order of reserved words.

■ 拡張命令解析情報をダイナミック・リンク・ライブ
ラリ形式のファイル(拡張命令解析情報ファイル62)
として作成し2文法定義文コンバータの処理を終了する
■ Extended instruction analysis information in a dynamic link library format file (extended instruction analysis information file 62)
and completes the processing of the two-grammar definition sentence converter.

本発明の実施例によるインタプリタは、第11図に示す
ように処理する。以下、第11図に示す■〜■に従って
説明する。
An interpreter according to an embodiment of the invention processes as shown in FIG. Hereinafter, explanation will be made according to (1) to (4) shown in FIG. 11.

■ 初期化時に、拡張命令解析情報ファイル62が存在
するか否かを調べ、存在すれば、メモリ上に拡張命令解
析情報35として読み込む。
(2) At the time of initialization, it is checked whether the extended instruction analysis information file 62 exists, and if it exists, it is read into the memory as the extended instruction analysis information 35.

■ ロード・トークン変換処理を行う、この処理につい
ては、第12図に従って後述する。
(2) Load token conversion processing will be described later with reference to FIG.

■ 処理■によって作成したトークンコード34をバッ
ファに読み込む。
■ Read the token code 34 created by process ■ into the buffer.

■ 終了トークンかどうかを判定し、終了トークンであ
れば実行を終了する。
■ Determine whether it is an end token, and if it is, terminate execution.

■ 終了トークンでなければ、トークンコードに対応す
る構文解析テーブル33により構文チエツクおよびオペ
ランドのスタックを行う、なお、拡張命令の場合には、
拡張命令解析情報35を使用し、構文チエツクおよびオ
ペランドのスタックを行う。
■ If it is not an end token, the syntax is checked and the operands are stacked using the syntax analysis table 33 corresponding to the token code.In addition, in the case of an extended instruction,
Extended instruction analysis information 35 is used to perform syntax check and operand stacking.

■〜■ トークンコードに対応する実行ルーチンを呼び
出す0通常の命令の場合、■の基本命令実行ルーチンに
より実行し、拡張命令の場合、拡張命令ライブラリ21
からロードした■の拡張命令実行ルーチンによって実行
する。その後、処理■へ戻り9次のトークンを処理する
■~■ Calls the execution routine corresponding to the token code 0 If it is a normal instruction, it will be executed by the basic instruction execution routine in ■, and if it is an extended instruction, it will be executed by the extended instruction library 21.
It is executed by the extended instruction execution routine loaded from ■. Thereafter, the process returns to process (2) and processes the ninth token.

第12図は、第11図に示す処理■のロード・トークン
変換処理の処理フローを示している。以下、第12図に
示す処理■〜■に従って説明する。
FIG. 12 shows the processing flow of the load token conversion process of process (2) shown in FIG. The following will explain the processes ① to ② shown in FIG. 12.

■ 実行するソースプログラム10のファイルをオーブ
ンする。
■ Open the file of the source program 10 to be executed.

■ ソースプログラム10からソースを1行読み込む。■ Read one line of source from the source program 10.

■ ソースが終了したならば5処理■へ移る。■ Once the source is finished, move on to 5 process ■.

■ ソースについて、予約語テーブル32をサーチする
■ Search the reserved word table 32 for the source.

■ 見つかった場合、処理■を実行し、見つからなかっ
た場合、処理■へ移る。
■ If found, process ■ is executed; if not found, proceed to process ■.

■ 予約語テーブル32を参照し、予約語に対応するト
ークンコード34への変換を行う、その後。
- Refer to the reserved word table 32 and convert the reserved word into a token code 34 corresponding to the reserved word.

処理■へ戻る。Return to processing ■.

■ 基本命令セットの予約語テーブル32に登録されて
いない場合、拡張命令解析情報35中の予約語テーブル
をサーチする。
(2) If it is not registered in the reserved word table 32 of the basic instruction set, search the reserved word table in the extended instruction analysis information 35.

■ 見つかった場合、処理■を実行し、見つからなかっ
た場合、処理[相]を実行する。
■ If found, process ■ is executed; if not found, process [phase] is executed.

■ ソースを拡張命令トークンに変換して、トークンコ
ード34として設定する。その後、処理■へ戻る。
■ Convert the source to an extended instruction token and set it as the token code 34. After that, return to process (■).

[相] 該当する予約語がなかった場合、変数トークン
に変換する。その後、処理■へ戻る。なお、変数トーク
ンの命令は、実行時にエラーとなる。
[Phase] If there is no corresponding reserved word, convert it to a variable token. After that, return to process (■). Note that the variable token command causes an error when executed.

■ すべてのソースについての処理が終了したならば、
ソースプログラムファイルをクローズし。
■ Once all sources have been processed,
Close the source program file.

呼び出し元へ戻る。Return to caller.

本発明の実施例によるコンパイラは、第13図に示すよ
うに処理する。以下、第13図に示す■〜■に従って説
明する。
The compiler according to the embodiment of the present invention processes as shown in FIG. The explanation will be given below according to (1) to (4) shown in FIG.

■ 初期化時に、拡張命令解析情報ファイル62が存在
するか否かを調べ、存在すれば、メモリ上に拡張命令解
析情報35として読み込む。
(2) At the time of initialization, it is checked whether the extended instruction analysis information file 62 exists, and if it exists, it is read into the memory as the extended instruction analysis information 35.

■ ソースプログラム10からソースを1行読み込む。■ Read one line of source from the source program 10.

■ ソースが終了したならば、処理■へ移る。■ Once the source has finished, move on to process ■.

■ 予約語テーブル32によりコード化テキスト70に
変換する。見つからない場合、拡張命令解析情報35を
使用し、コード化テキスト70に変換する。
(2) Conversion into coded text 70 using the reserved word table 32. If it is not found, the extended instruction analysis information 35 is used to convert it into coded text 70.

■ コード化テキスト70について、構文解析テーブル
33により構文チエツクを行う、拡張命令の場合には、
拡張命令解析情報35により構文チエツクを行う。
■ In the case of an extended instruction that performs a syntax check on the coded text 70 using the syntax analysis table 33,
A syntax check is performed using the extended instruction analysis information 35.

■ 構文チエツクを行ったならば、コード化テキスト7
0をもとに、対応するPコードを作成し。
■ If you have performed a syntax check, coded text 7
Create the corresponding P code based on 0.

中間オブジェクトファイル71に格納する。拡張命令の
場合には、拡張命令用のPコードを作成する。その後、
処理■へ戻る。
It is stored in the intermediate object file 71. In the case of an extended instruction, a P code for the extended instruction is created. after that,
Return to processing ■.

■ ソースプログラム10が終了したならば、中間オブ
ジェクトファイル71についてアドレス解決を行い、実
行形式プログラムファイル37を作成する。
(2) When the source program 10 is completed, address resolution is performed for the intermediate object file 71 and an executable program file 37 is created.

■ ファイルのクローズなど必要な後処理を行い。■ Perform necessary post-processing such as closing files.

処理を終了する。Finish the process.

コンパイル結果の実行は、第14図に示すように行われ
る。以下、第14図に示す処理■〜■に従って説明する
The compilation results are executed as shown in FIG. The following describes the processes ① to ② shown in FIG. 14.

■ ローダが、実行形式プログラムファイル37のPコ
ード80をメモリ上に展開する。
(2) The loader expands the P code 80 of the executable program file 37 onto memory.

■ Pコード80を取り出す。■ Take out the P code 80.

■ Pコードが終了するかまたはend命令になったな
らば実行を終了する。
■ When the P code ends or an end instruction is reached, execution ends.

■〜■ 取り出したPコードに対応する実行ルーチンを
呼び出す0通常の命令の場合、■の基本命令実行ルーチ
ンにより実行し、拡張命令の場合。
■~■ Calls the execution routine corresponding to the retrieved P code 0 In the case of a normal instruction, it is executed by the basic instruction execution routine in ■, and in the case of an extended instruction.

■の拡張命令実行ルーチンによって実行する。拡張命令
の場合、初めて呼び出す場合には、拡張命令ライブラリ
21からローディングする。実行後。
Executed by the extended instruction execution routine (2). In the case of an extended instruction, when it is called for the first time, it is loaded from the extended instruction library 21. After execution.

処理■へ戻り1次のPコードについての処理を行う。Returning to process (2), processing for the primary P code is performed.

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

以上説明したように1本発明によれば、以下の効果があ
る。
As explained above, the present invention has the following effects.

)機能アップにより命令がどんどん増えたときに、すべ
て基本命令としてサポートすると、新規命令を必要とし
ないユーザには負荷がかがるが。
) When the number of commands increases rapidly due to functional upgrades, supporting them all as basic commands will place a burden on users who do not need new commands.

本発明によれば、既存の基本命令だけでよいユーザには
まったく負荷がかからない。
According to the present invention, there is no burden on users who only need existing basic commands.

11)拡張命令を使用するユーザは、拡張命令解析情報
記憶部と拡張命令ライブラリを外付けすることにより、
最適な環境、すなわちユーザカスタマイズされた環境で
、高級言語を使用することができる。拡張命令解析情報
が2文法定義文によって。
11) Users who use extended instructions can install the extended instruction analysis information storage unit and extended instruction library externally.
High-level languages can be used in an optimal environment, that is, a user-customized environment. Extended command analysis information is provided by two grammar definition statements.

拡張命令ライブラリとは別に用意されるため、構文チエ
ツクなどによってエラーの事前検出が可能になる。した
がって、プログラムの暴走などを防止でき、実行ルーチ
ンの作成が容品になる。
Since it is prepared separately from the extended instruction library, errors can be detected in advance through syntax checks, etc. Therefore, runaway programs can be prevented, and execution routines can be created more easily.

1ii)計算機言語の専門知識がなくても、ある程度の
プログラム作成経験があれば、ユーザ自身で拡張命令を
作成することが可能になる。
1ii) Even if a user does not have specialized knowledge of computer languages, if he or she has some experience in creating programs, it becomes possible for the user to create extended instructions by himself/herself.

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

第1図は本発明の原理構成図。 第2図は本発明の適用システムの例。 第3図はインタプリタによる解析説明図。 第4図はコンパイラによる翻訳説明図。 第5図はコンパイル後の実行説明図。 第6図は本発明の実施例に係る文法定義文の例。 第7図は本発明の実施例に係る拡張命令解析情報の例。 第8図は本発明の実施例に係る構文解析テーブルの例。 第9図は本発明の実施例に係る拡張命令のトークンコー
ドとPコードの例。 第10図は本発明の実施例による文法定義文コンバータ
の処理フロー 第11図は本発明の実施例によるインタプリタの処理フ
ロー 第12図はロード・トークン変換処理の処理フロー 第13図は本発明の実施例によるコンパイー7(7)処
理フロー 第14図は本発明の実施例によるコンパイル結果実行時
の処理フローを示す。 図中、10はソースプログラム、11は高級言語処理本
体部、12は拡張命令解析処理部、13は中間コード、
14は文法定義文、15は文法定義文コンバータ、16
は拡張命令解析情報記憶部。 17は初期化ルーチン、18は解析テーブル、19は基
本命令ライブラリ、20は基本命令実行ルーチン、21
は拡張命令ライブラリ、22は拡張命令実行ルーチンを
表す。
FIG. 1 is a diagram showing the principle configuration of the present invention. FIG. 2 shows an example of a system to which the present invention is applied. FIG. 3 is an explanatory diagram of analysis by an interpreter. FIG. 4 is an explanatory diagram of translation by the compiler. FIG. 5 is an explanatory diagram of execution after compilation. FIG. 6 is an example of a grammar definition sentence according to an embodiment of the present invention. FIG. 7 is an example of extended instruction analysis information according to an embodiment of the present invention. FIG. 8 is an example of a syntax analysis table according to an embodiment of the present invention. FIG. 9 is an example of a token code and a P code of an extended instruction according to an embodiment of the present invention. FIG. 10 is a processing flow of a grammar definition sentence converter according to an embodiment of the present invention. FIG. 11 is a processing flow of an interpreter according to an embodiment of the present invention. FIG. 12 is a processing flow of load token conversion processing. Compiler 7 (7) Processing Flow According to Embodiment FIG. 14 shows a processing flow when executing a compilation result according to an embodiment of the present invention. In the figure, 10 is a source program, 11 is a high-level language processing main unit, 12 is an extended instruction analysis processing unit, 13 is an intermediate code,
14 is a grammar definition sentence, 15 is a grammar definition sentence converter, 16
is an extended instruction analysis information storage unit. 17 is an initialization routine, 18 is an analysis table, 19 is a basic instruction library, 20 is a basic instruction execution routine, 21
2 represents an extended instruction library, and 22 represents an extended instruction execution routine.

Claims (1)

【特許請求の範囲】 1)高級言語で記述されたソースプログラム(10)を
、解釈実行するインタプリタまたは低レベルの言語に翻
訳するコンパイラを備えた高級言語処理装置において、 あらかじめ定められた基本命令セット以外の交換可能な
拡張命令に関する実行ルーチンを格納する拡張命令ライ
ブラリ(21)と、 インタプリタ本体またはコンパイラ本体の外部に用意さ
れる拡張命令解析情報を記憶する拡張命令解析情報記憶
部(16)と、 ソースプログラム中に基本命令セットの予約語以外の文
が現れた場合に、その文について前記拡張命令解析情報
記憶部を参照して解析し、拡張命令に応じた中間コード
または機械語コードを出力する拡張命令解析処理部(1
2)とを備え、インタプリタにおける実行時またはコン
パイル後の実行時に、拡張命令を示す中間コードまたは
機械語コードに対応して、前記拡張命令ライブラリ中の
該当する実行ルーチンを動的に呼び出すようにしたこと
を特徴とする高級言語処理装置。 2)請求項1記載の高級言語処理装置において、拡張命
令に関する文法定義文(14)を入力し、その文法定義
文に基づいて前記拡張命令解析情報を自動生成する文法
定義文コンバータ(15)を備えたことを特徴とする高
級言語処理装置。 3)請求項1または請求項2記載の高級言語処理装置に
おいて、 前記拡張命令解析情報記憶部(16)は、解析に必要な
テーブルの初期化ルーチン(17)を含み、実行時にイ
ンタプリタ本体またはコンパイラ本体に動的に結合され
るダイナミック・リンク・ライブラリ形式で作成される
ことを特徴とする高級言語処理装置。
[Claims] 1) A predetermined basic instruction set in a high-level language processing device equipped with an interpreter that interprets and executes a source program (10) written in a high-level language or a compiler that translates it into a low-level language. an extension instruction library (21) that stores execution routines related to exchangeable extension instructions other than the above; and an extension instruction analysis information storage unit (16) that stores extension instruction analysis information prepared outside the interpreter body or the compiler body; When a statement other than a reserved word of the basic instruction set appears in a source program, the statement is analyzed by referring to the extended instruction analysis information storage unit, and intermediate code or machine language code corresponding to the extended instruction is output. Extended instruction analysis processing unit (1
2), and dynamically calls a corresponding execution routine in the extended instruction library in response to an intermediate code or machine language code indicating an extended instruction during execution in an interpreter or during execution after compilation. A high-level language processing device characterized by: 2) The high-level language processing device according to claim 1, further comprising a grammar definition sentence converter (15) that receives a grammar definition sentence (14) regarding an extended instruction and automatically generates the extended instruction analysis information based on the grammar definition sentence. A high-level language processing device characterized by: 3) The high-level language processing device according to claim 1 or 2, wherein the extended instruction analysis information storage unit (16) includes an initialization routine (17) for a table necessary for analysis, and the extended instruction analysis information storage unit (16) includes an initialization routine (17) for a table necessary for analysis, and the extended instruction analysis information storage unit (16) includes an initialization routine (17) for a table necessary for analysis, and the extended instruction analysis information storage unit (16) includes an initialization routine (17) for a table necessary for analysis, and the extended instruction analysis information storage unit (16) includes an initialization routine (17) for a table necessary for analysis, and the extended instruction analysis information storage unit (16) includes an initialization routine (17) for a table necessary for analysis. A high-level language processing device characterized in that it is created in a dynamic link library format that is dynamically coupled to a main body.
JP26588290A 1990-10-03 1990-10-03 Advanced language processor Pending JPH04142629A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26588290A JPH04142629A (en) 1990-10-03 1990-10-03 Advanced language processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP26588290A JPH04142629A (en) 1990-10-03 1990-10-03 Advanced language processor

Publications (1)

Publication Number Publication Date
JPH04142629A true JPH04142629A (en) 1992-05-15

Family

ID=17423412

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26588290A Pending JPH04142629A (en) 1990-10-03 1990-10-03 Advanced language processor

Country Status (1)

Country Link
JP (1) JPH04142629A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014507023A (en) * 2010-12-14 2014-03-20 エヌジーモコ リミテッド ライアビリティ カンパニー Communication protocol between high-level language and native language

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014507023A (en) * 2010-12-14 2014-03-20 エヌジーモコ リミテッド ライアビリティ カンパニー Communication protocol between high-level language and native language

Similar Documents

Publication Publication Date Title
EP2463771B1 (en) Method for translating a cobol source program into readable and maintainable program code in an object oriented second programming language
US7460996B2 (en) Using strong data types to express speech recognition grammars in software programs
US8464232B2 (en) Compiler compiler system with syntax-controlled runtime and binary application programming interfaces
Sestoft Programming language concepts
JPH06501583A (en) How to configure the folding mechanism within a multilingual optimizing compiler
Schröer The GENTLE Compiler Construction System
Rao C++ in One Hour a Day, Sams Teach Yourself
US20080141230A1 (en) Scope-Constrained Specification Of Features In A Programming Language
Fritzson et al. Meta-programming and language modeling with MetaModelica 1.0
JP2022522880A (en) How to generate representations of program logic, decompilers, recompile systems and computer program products
Blagodarov et al. Tool demo: Raincode assembler compiler
Schildt The art of java
JPH04142629A (en) Advanced language processor
KR20230040516A (en) Automation system and method for extracting intermediate representation based semantics of javascript
Jana Java and object-oriented programming paradigm
Turner C#: The Ultimate Beginner's Guide to Learn C# Programming Step by Step
Hunt et al. A First Kotlin Program
Cutler et al. Getting Started with Python
Rao Sams Teach Yourself C++ in One Hour a Day
Ismailaj Run time code optimization using MEF
Musch Interpreter
Gorman et al. The Pynini Library
Lazzarini et al. Introduction to the Programming Environment
Feldman Edward W. Czeck
SU1062721A1 (en) Device for syntax-controlled translation