JPH01243125A - Method for improving execution speed of interpreter program - Google Patents

Method for improving execution speed of interpreter program

Info

Publication number
JPH01243125A
JPH01243125A JP7065088A JP7065088A JPH01243125A JP H01243125 A JPH01243125 A JP H01243125A JP 7065088 A JP7065088 A JP 7065088A JP 7065088 A JP7065088 A JP 7065088A JP H01243125 A JPH01243125 A JP H01243125A
Authority
JP
Japan
Prior art keywords
intermediate code
program
code program
execution
execution speed
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
JP7065088A
Other languages
Japanese (ja)
Inventor
Satoshi Tanaka
敏 田中
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Co 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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP7065088A priority Critical patent/JPH01243125A/en
Publication of JPH01243125A publication Critical patent/JPH01243125A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To improve an execution speed by executing a program based on a second intermediate code program corresponding to a processing necessary only at the time of an execution. CONSTITUTION:In a stage A3, each first intermediate code program P1 and each second intermediate code program P2 are edited to a first intermediate code program Pe1 and a second intermediate code program Pe2, respectively, and in a next stage A4, the program is executed by the edited second intermediate code program Pe2. In the execution, the second intermediate code program P2 is made to correspond to the processing not to contain syntax information, for example, a space, a comma, etc., in other words, necessary only at the time of the execution. Thus, the execution speed can be improved.

Description

【発明の詳細な説明】[Detailed description of the invention] 【産業上の利用分野】[Industrial application field]

この発明は、言語プログラムとしての解釈プログラム(
インタプリタ)の欠点である実行速度の遅いことを改善
するだめの、解釈プログラムの実行速度の向上方法に関
する。
This invention provides an interpretation program (
This invention relates to a method for improving the execution speed of an interpreter, which is used to improve the slow execution speed that is a drawback of interpreters.

【従来の技術】[Conventional technology]

従来の解釈プログラム(以下、インタプリタという)で
は、その実行までに次の手順がとられる。 まず、命令ごとに順次、入力される原始プログラムを、
これに容易に復元可能な構文情報を含む中間コードを用
いて、各中間コード・プログラムに変換し、ついで、こ
の各中間コード・プログラムから一連の中間コード・プ
ログラムを編集する。 そして、インタプリタの実行は、この編集された中間コ
ード・プログラムの一つ一つの命令を解釈し、構文チエ
ツクをしながらおこなわれる。 なお実行するとき、解釈した後いったん機械語に直して
から、この機械語の命令を実行する場合もあり、機械語
に変換せず、どのような命令であるかが分かれば、直ち
にその命令の示す動作を実行する場合もある。
In a conventional interpretation program (hereinafter referred to as an interpreter), the following steps are taken before its execution. First, the source program is input sequentially for each instruction.
This is converted into each intermediate code program using an intermediate code containing syntactic information that can be easily restored, and then a series of intermediate code programs is edited from each intermediate code program. Then, the interpreter is executed while interpreting each instruction of this edited intermediate code program and checking the syntax. When executing, there are cases where the instructions in machine language are executed after being interpreted and converted into machine language. In some cases, the actions shown may be performed.

【発明が解決しようとする課B】[Question B that the invention attempts to solve]

以上説明したように、従来のインタプリタでは、プログ
ラムの変更や修正、追加、削除などによって再度プログ
ラム全体をコンパイルしたり、リンクしたりする作業が
不要であること、デバッグ作業が容易であること、プロ
グラムの開発効率が良いこと等の長所がある反面、プロ
グラムの実行速度が遅いという欠点があった。 この欠点について、第4図、第5図を参照しながら以下
に具体的に説明する。第4図は従来例における原始プロ
グラムと、これに対応する中間コード・プログラムとの
対応を示す説明図、第5図は従来例における実行を示す
フローチャートである。 第4図において、上段は原始プログラムPsの、下段は
中間コード・プログラムPのそれぞれ一部を模式的に示
す。すなわち、原始プログラムPsのスペースやコンマ
などの構文情報は、変換された中間コード・プログラム
Pの中に含まれている。 第5図のステップS21でr COL ORか?」が判
断され、YESなら次に、Noなら他の文の実行処理に
移行する。なお、rcOLORか?」は「色変更命令か
9」の意味である。 ステップS22で、スペースがスキップ(飛ばし読み)
され、次のステップS23で、第1パラメータPALの
読み込みがなされ、ステップS24で再びスペースがス
キップされる。ステップS25で、コンマかどうかの判
断がなされ、YESなら次に移り、NOならエラー処理
される。 以下同様に、ステップS26.  S28.  S30
.  S32でそれぞれスペースがスキップされ、ステ
ップS29でコンマかどうかの判断がなされ、ステップ
S27.  S31で第2.第3の各パラメータPA2
. PA3が読み込まれる。 ステップS33で、行の最後かどうかが判断され、NO
ならエラー処理され、YESならステップS34のrc
OLORに対応する機能の実行」に移り、ついで次行の
処理に移行する。 このように、従来の中間コード・プログラムPに基づく
実行では、その過程で多くのスペースを読み飛ばしたり
、コンマの有無の判断、チエツクをしたりする必要があ
り、このことが実行速度を低下させる原因となる。 この発明の課題は、従来の解釈プログラムの問題点であ
る実行速度の遅いことを改善するための、解釈プログラ
ムの実行速度の向上方法を提供することにある。
As explained above, with conventional interpreters, there is no need to compile or link the entire program again when changing, modifying, adding, or deleting the program, and debugging is easy. Although it has advantages such as high development efficiency, it has the disadvantage of slow program execution speed. This drawback will be specifically explained below with reference to FIGS. 4 and 5. FIG. 4 is an explanatory diagram showing the correspondence between the source program and the corresponding intermediate code program in the conventional example, and FIG. 5 is a flowchart showing the execution in the conventional example. In FIG. 4, the upper part schematically shows a part of the source program Ps, and the lower part schematically shows a part of the intermediate code program P. That is, syntactic information such as spaces and commas of the source program Ps is included in the converted intermediate code program P. In step S21 of FIG. 5, is r COL OR? ” is determined, and if YES, the process moves to the next execution process, and if No, the process moves to execution of another statement. By the way, is it rcOLOR? ” means “color change command or 9”. In step S22, spaces are skipped (skip reading)
Then, in the next step S23, the first parameter PAL is read, and the space is skipped again in step S24. In step S25, it is determined whether or not it is a comma. If YES, the process moves to the next step; if NO, error processing is performed. Similarly, step S26. S28. S30
.. In S32, each space is skipped, in step S29 it is determined whether it is a comma, and in step S27. 2nd in S31. Each third parameter PA2
.. PA3 is loaded. In step S33, it is determined whether it is the end of the line, and NO
If so, error processing is performed, and if YES, rc in step S34
The process moves on to ``Executing the function corresponding to OLOR'' and then moves on to the next line of processing. In this way, in the execution based on the conventional intermediate code program P, it is necessary to skip many spaces in the process and judge and check the presence or absence of commas, which reduces the execution speed. Cause. An object of the present invention is to provide a method for improving the execution speed of an interpretation program in order to improve the slow execution speed, which is a problem with conventional interpretation programs.

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

この課題を解決するために、本発明に係る解釈プログラ
ムの実行速度の向上方法は、 命令ごとに順次入力される原始プログラムを、これに復
元可能な構文情報を含む中間コードを用いてそれぞれ第
1の中間コード・プログラムに変換することと; この各第1中間コード・プログラムを、実行時にたけ必
要な処理に対応する第2の中間コード・プログラムに変
換することと; 前記の各第1中間コード・プログラムと、各第2中間コ
ード・プログラムとをそれぞれ一連の第1中間コード・
プログラムと、第2中間コード・プログラムとに編集す
ることと; ζ を備え、この編集された第2中間コード・プログラムに
基づいてプログラムが実行される。
In order to solve this problem, the method for improving the execution speed of an interpreter program according to the present invention is to first convert a source program that is sequentially input for each instruction into a first code using an intermediate code containing syntax information that can be restored to the source program. converting each of the first intermediate code programs into a second intermediate code program corresponding to the necessary processing at the time of execution;・The program and each second intermediate code program are respectively converted into a series of first intermediate code ・
and editing the program and a second intermediate code program; and the program is executed based on the edited second intermediate code program.

【作 用】[For use]

命令ごとに順次入力される原始プログラムを、これに復
元可能な構文情報を含む中間コードを用いてそれぞれ第
1の中間コード・プログラムに変換し、次にこの各第1
中間コード・プログラムを、実行時にだけ必要な処理に
対応する第2の中間コード・プログラムに変換する。つ
いで、各第1中間コード・プログラムと、各第2中間コ
ード・プログラムとをそれぞれ一連の第1中間コード・
プログラムと、第2中間コード・プログラムとに編集し
、この編集された第2中間コード・プログラムに基づい
てプログラムを実行する。
A source program that is input sequentially for each instruction is converted into a first intermediate code program using an intermediate code containing syntactic information that can be restored to the source program, and then each of the first intermediate code programs is converted into a first intermediate code program.
The intermediate code program is converted into a second intermediate code program that corresponds to processing required only at runtime. Each first intermediate code program and each second intermediate code program are then converted into a series of first intermediate code programs.
program and a second intermediate code program, and execute the program based on the edited second intermediate code program.

【実施例】【Example】

本発明に係る実施例について以下に図面を参照しながら
説明する。 第1図は実施例の構成を示すブロック図で、同図におい
て、原始プログラムPsは、段階A1において、各命令
がそれぞれ第1中間コード・プログラムP1に変換され
るが、この段階は従来のインタプリタにおける中間コー
ド・プログラムへの変換と同じである。次に、この各第
1中間コード・プログラムP1は段階A2で、それぞれ
第2中間コード・プログラムP2に変換される。この第
2中間コード・プログラムP2は、構文情報たとえばス
ペースやコンマ等を含まない、言いかえれば実行時にだ
け必要な処理に対応する。 段階A3で、先程の各第1中間コード・プログラムPL
、各第2中間コード・プログラムP2はそれぞれ第1中
間コード・プログラムPel、第2中間コード・プログ
ラムPe2に編集され、次の段階A4において、この編
集された第2中間コード・プログラムPe2によってプ
ログラムが実行される。この実行においては、第2中間
コード・プログラムP2に構文情報たとえばスペースや
コンマ等を含まない、言いかえれば実行時にだけ必要な
処理に対応するようになっているから、実行速度は従来
方式によるより向上する。 他方、段階A5において、編集された第1中間コード・
プログラムPel、第2中間コード・プログラムPe2
は、原始プログラムPsに変換される。 なお、変換された原始プログラムPsは、その内容が表
示装置に表示され(段階A6)、この表示内容を見なが
ら手入力操作により、変更、修正がおこなわれ(段階A
7)、変更、修正された原始プログラムPsが段階AI
の新たな入力となる。 次に、第2図は原始プログラムと、この実施例における
第1中間コード・プログラム、第2中間コード・プログ
ラムとの対応を示す説明図で、同図において上段が原始
プログラムPS、中段が第1中間コード・プログラムP
1、下段が第2中間コード・プログラムP2である。各
段をつなぐ線でそれぞれの対応を示す。第2中間コード
・プログラムP2では、スペースやコンマ等の構文情報
が含まれないことが分かる。 第3図は従来の中間コード・プログラムの実行段階でお
こなわれる第2中間コード変換処理を示す説明図である
。同図において、各ステップは、第5図に示した従来例
における実行動作におけるのとほぼ対応する。ただし、
ステップS3において、第1パラメータPALの読み込
みに対応するコード、’3101J  (第2図の下段
参照)が出力され、同様にステップS7.Sllにおい
て、第2パラメークPA2.第3パラメータPA3の読
み込みに対応するコード、r3102」、’3103J
が出力される。また、ステップS14でrcOLOR。 機能実行に対応するコード「A1」が出力される。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the configuration of the embodiment. In the same figure, each instruction of the source program Ps is converted into a first intermediate code program P1 at step A1, but this step is performed using a conventional interpreter. This is the same as the conversion to an intermediate code program in . Each first intermediate code program P1 is then converted into a respective second intermediate code program P2 in step A2. This second intermediate code program P2 does not include syntactic information such as spaces and commas, in other words, it corresponds to processing that is necessary only at the time of execution. At step A3, each first intermediate code program PL
, each second intermediate code program P2 is edited into a first intermediate code program Pel and a second intermediate code program Pe2, respectively, and in the next step A4, the program is edited by the edited second intermediate code program Pe2. executed. In this execution, the second intermediate code program P2 does not include syntactic information such as spaces and commas, in other words, it corresponds to necessary processing only during execution, so the execution speed is faster than in the conventional method. improves. On the other hand, in step A5, the edited first intermediate code
Program Pel, second intermediate code program Pe2
is converted into a source program Ps. The contents of the converted source program Ps are displayed on the display device (step A6), and changes and corrections are made by manual input operations while looking at the displayed contents (step A6).
7) The changed and modified source program Ps is the stage AI
becomes a new input. Next, FIG. 2 is an explanatory diagram showing the correspondence between the source program, the first intermediate code program, and the second intermediate code program in this embodiment. In the figure, the upper row is the source program PS, and the middle row is the first intermediate code program. Intermediate code program P
1. The lower row is the second intermediate code program P2. Correspondence between each column is shown by a line connecting each column. It can be seen that the second intermediate code program P2 does not include syntactic information such as spaces and commas. FIG. 3 is an explanatory diagram showing a second intermediate code conversion process performed at the stage of executing a conventional intermediate code program. In the figure, each step substantially corresponds to the execution operation in the conventional example shown in FIG. however,
In step S3, a code '3101J (see the lower part of FIG. 2) corresponding to reading the first parameter PAL is output, and similarly in step S7. In Sll, the second parameter PA2. Code corresponding to reading the third parameter PA3, r3102'', '3103J
is output. Further, rcOLOR is executed in step S14. A code "A1" corresponding to the function execution is output.

【発明の効果】【Effect of the invention】

以上説明したように、この発明においては、命令ごとに
順次入力される原始プログラムを、これに復元可能な構
文情報を含む中間コードを用いてそれぞれ第1の中間コ
ード・プログラムに変換し、次にこの各第1中間コード
・プログラムを、実行時にだけ必要な処理に対応する第
2の中間コード・プログラムに変換し、ついで、各第1
中間コード・プログラムと、各第2中間コード・プログ
ラムとをそれぞれ一連の第1中間コード・プログラムと
、第2中間コード・プログラムとに編集し、この編集さ
れた第2中間コード・プログラムに基づいてプログラム
を実行する。 したがって、この発明によれば、従来の技術に比べ次の
ようなすくれた効果がある。 (1)プログラムの実行は、実行時にだけ必要な処理に
対応する第2中間コード・プログラムに基づいてなされ
るから、言いかえれば構文情報を含まないから、実行速
度が向上する。 (2)従来の中間コード・プログラム変換手段と中間コ
ード編集手段とがほぼ利用できるから、第2中間コート
・プログラムの変換、ひいてはこの発明方法の実施が容
易である。 (3)第1中間コード・プログラムは、第2中間コード
・プログラムとともに保存されるから、従来の編集機能
が損なわれることがなく、運用上便利である。
As explained above, in the present invention, a source program that is input sequentially for each instruction is converted into a first intermediate code program using an intermediate code containing syntax information that can be restored to the source program, and then Each first intermediate code program is converted into a second intermediate code program corresponding to processing required only at runtime, and then each first
The intermediate code program and each second intermediate code program are edited into a series of first intermediate code programs and second intermediate code programs, respectively, and based on the edited second intermediate code programs, Run the program. Therefore, according to the present invention, there are the following advantages compared to the conventional technology. (1) The execution speed of the program is improved because the program is executed based on the second intermediate code program that corresponds to processing necessary only at the time of execution; in other words, syntax information is not included. (2) Since conventional intermediate code program converting means and intermediate code editing means can be used, it is easy to convert the second intermediate code program and to implement the method of the present invention. (3) Since the first intermediate code program is saved together with the second intermediate code program, conventional editing functions are not impaired, which is convenient for operation.

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

第1図は実施例の構成を示すブロック図、第2図は原始
プログラムと、この実施例における第1中間コード・プ
ログラム、第2中間コード・プログラムとの対応を示す
説明図、 】0 第3図は従来の中間コード・プログラムの実行段階でお
こなわれる第2中間コード変換処理を示す説明図、 第4図は従来例における原始プログラムと、これに対応
する中間コード・プログラムとの対応を示す説明図、 第5図は従来例における実行を示すフローチャートであ
る。 符号説明 Ps :原始プログラム、 Pl :第1中間コード・プログラム、P2 :第2中
間コード・プログラム、Pel:Ha集された第1中間
コード・プログラム、Pe2:MA集された第2中間コ
ード・プログラム。
FIG. 1 is a block diagram showing the configuration of the embodiment, and FIG. 2 is an explanatory diagram showing the correspondence between the source program and the first intermediate code program and second intermediate code program in this embodiment. ]0 3 The figure is an explanatory diagram showing the second intermediate code conversion process performed at the execution stage of a conventional intermediate code program. Figure 4 is an explanatory diagram showing the correspondence between the source program and the corresponding intermediate code program in the conventional example. FIG. 5 is a flowchart showing the execution in the conventional example. Code explanation Ps: Source program, Pl: First intermediate code program, P2: Second intermediate code program, Pel: First intermediate code program collected in Ha, Pe2: Second intermediate code program collected in MA. .

Claims (1)

【特許請求の範囲】[Claims] 1)命令ごとに順次入力される原始プログラムを、これ
に復元可能な構文情報を含む中間コードを用いてそれぞ
れ第1の中間コード・プログラムに変換することと;こ
の各第1中間コード・プログラムを、実行時にだけ必要
な処理に対応する第2の中間コード・プログラムに変換
することと;前記の各第1中間コード・プログラムと、
各第2中間コード・プログラムとをそれぞれ一連の第1
中間コード・プログラムと、第2中間コード・プログラ
ムとに編集することと;を備え、この編集された第2中
間コード・プログラムに基づいてプログラムが実行され
るようにしたことを特徴とする解釈プログラムの実行速
度向上方法。
1) Converting each of the source programs that are sequentially input for each instruction into a first intermediate code program using an intermediate code that includes syntactic information that can be restored into the source program; , converting each of the first intermediate code programs into a second intermediate code program corresponding to processing necessary only during execution;
each second intermediate code program;
An interpretation program comprising: editing an intermediate code program and a second intermediate code program; and executing the program based on the edited second intermediate code program. How to speed up execution.
JP7065088A 1988-03-24 1988-03-24 Method for improving execution speed of interpreter program Pending JPH01243125A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7065088A JPH01243125A (en) 1988-03-24 1988-03-24 Method for improving execution speed of interpreter program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7065088A JPH01243125A (en) 1988-03-24 1988-03-24 Method for improving execution speed of interpreter program

Publications (1)

Publication Number Publication Date
JPH01243125A true JPH01243125A (en) 1989-09-27

Family

ID=13437737

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7065088A Pending JPH01243125A (en) 1988-03-24 1988-03-24 Method for improving execution speed of interpreter program

Country Status (1)

Country Link
JP (1) JPH01243125A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003141488A (en) * 1996-10-25 2003-05-16 Schlumberger System Microcontroller using high class programming language

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003141488A (en) * 1996-10-25 2003-05-16 Schlumberger System Microcontroller using high class programming language

Similar Documents

Publication Publication Date Title
JPH01243125A (en) Method for improving execution speed of interpreter program
US6178547B1 (en) Method and apparatus for generating non-redundant symbolic debug information in computer programs
JPH0736734A (en) Method for checking argument value
JPH0554277A (en) Plant monitor device
JPH10187461A (en) Language processing system
JPS62214443A (en) Emulation executing method
JPS6378231A (en) Partial program combining system
JPS60237542A (en) Program controller
US20040117775A1 (en) Automatic compilation of electronic telecommunications system message generation code
JPH03179535A (en) Debug supporting device
JPS5930145A (en) Reexecution processing system by dynamic program correction
JPH0272407A (en) Ladder program converter
JPH01282609A (en) Method for setting nc data output form
JPS63640A (en) Execution control system for partial unit of data flow
JPH01239633A (en) System for generating load module in dynamic link structure
JPH02100732A (en) Program grammar checking system
JPS6033640A (en) Data monitoring system
JP3260788B2 (en) Robot control device and method
JPH0659929A (en) Computer device
JPH0619721A (en) Machine language translation optimizing system
JPH0612259A (en) Compiler processing system
JPH0580999A (en) Processing system for language processing program
JPS63305434A (en) Debugging aid device
JPH01147624A (en) Language processing system
JPH04209029A (en) Parallel process program translation processor