JPH03158930A - Language variable drawback restoring device - Google Patents

Language variable drawback restoring device

Info

Publication number
JPH03158930A
JPH03158930A JP1299261A JP29926189A JPH03158930A JP H03158930 A JPH03158930 A JP H03158930A JP 1299261 A JP1299261 A JP 1299261A JP 29926189 A JP29926189 A JP 29926189A JP H03158930 A JPH03158930 A JP H03158930A
Authority
JP
Japan
Prior art keywords
variable
drawback
save
subroutine
stack
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
JP1299261A
Other languages
Japanese (ja)
Inventor
Seiichi Kuriyama
栗山 靜一
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.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP1299261A priority Critical patent/JPH03158930A/en
Publication of JPH03158930A publication Critical patent/JPH03158930A/en
Pending legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To use the same variable by each of a main routine and a subroutine by executing a drawback restoration of a necessary variable in an entrance and exit of the subroutine. CONSTITUTION:A byte of a drawback number is provided behind the variable name concerned in a variable store area, the drawback number is written in this area, and the variable concerned can be redefined. Subsequently, a store address of a masked variable is brought to drawback to a stack and a stack pointer. In such a way, the drawback of the variable is executed. Also, the restoration of the variable is executed by eliminating the variable concerned, fetching the store address of the variable brought to drawback from a stack means 2, shifting it to a register, and returning the drawback number to the origin against the variable of the store address shown by the contents of the register 3. In such a way, by utilizing a drawback restoration processing means 4 of the variable and executing a drawback restoration of a necessary variable in an entrance and exit of a subroutine, the same variable can be used by each of a main routine and the subroutine.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、BASIC言語で使用される変数の一時的な
退避復活処理手段に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a means for temporarily saving and restoring variables used in BASIC language.

〔概要〕〔overview〕

本発明は、BASIC言語で使用される変数の一時的な
退避復活手段において、 サブルーチンの出入口で必要な変数の退避復活を行うこ
とにより、 メインルーチンとサブルーチンとの相互で同一変数を使
用することができるようにしたものである。
The present invention is a means for temporarily saving and restoring variables used in the BASIC language.By saving and restoring necessary variables at the entrance and exit of a subroutine, the same variables can be used between the main routine and the subroutine. It has been made possible.

〔従来の技術〕[Conventional technology]

従来例では、BASIC言語には他の言語例えばPAS
CALやC言語のように変数にグローバルとローカルの
区別がなく、すべての変数がグローバル変数であるので
、BASIC言語の言語構造ではサブルーチンなどのモ
ジュール化が行えず、また、サブルーチンの再帰的処理
ができない。
In the conventional example, the BASIC language includes other languages such as PAS.
Unlike CAL and C languages, there is no distinction between global and local variables, and all variables are global variables. Therefore, the language structure of the BASIC language does not allow modularization of subroutines, and recursive processing of subroutines is not possible. Can not.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

このような従来例では、BASIC言語のすべての変数
がグローバル変数であるので、メインルーチンで使用し
た変数はサブルーチン内でも有効であり、メインルーチ
ンをサブルーチンとでの同一変数の重複使用によるバグ
や一方の変数の修正が他方のルーチンに影響を及ぼすな
どのためにサブルーチンの独立性が低く、また、処理ル
ーチンがそれ自身の中で再び自分自身を呼び出すような
再帰的処理ができない欠点がある。
In such a conventional example, all variables in the BASIC language are global variables, so variables used in the main routine are also valid in the subroutine, and bugs due to duplicate use of the same variable in the main routine and the subroutine can be avoided. Subroutines have low independence because modification of variables in one routine affects other routines, and recursive processing in which a processing routine calls itself again is not possible.

本発明はこのような欠点を除去するもので、処理ルーチ
ンの再帰的処理が行える変数退避復活装置を提供するこ
とを目的とする。
The present invention aims to eliminate such drawbacks, and aims to provide a variable saving and restoring device that can perform recursive processing of processing routines.

〔問題点を解決するための手段〕[Means for solving problems]

本発明は、メインルーチンとサブルーチンとに共に有効
である1個の変数を有する一変数言譜にかかわる言語変
数退避復活装置において、退避指示および復活指示に応
じて格納および抽出が実行されるスタック手段と、上記
変数にかかわる変数名を格納する領域を拡張して設けら
れた新たな領域に退避を示す退避番号を格納し、この退
避番号が格納された変数にかかわる変数名を上記スタッ
ク手段に格納する変数退避手段と、復活指示に応じて上
記スタック羊膜から抽出した変数名を登録するレジスタ
と、このレジスタに登録された変数名にかかわる退避番
号を抹消する変数復活手段とを備えたことを特徴とする
The present invention provides a stack means for storing and extracting in response to a save instruction and a restore instruction in a language variable save and restore device related to a univariate speech score that has one variable that is valid for both a main routine and a subroutine. Then, a save number indicating saving is stored in a new area created by expanding the area for storing variable names related to the above variables, and the variable name related to the variable in which this save number is stored is stored in the stack means. A register for registering a variable name extracted from the stacked amniotic membrane in response to a restoration instruction, and a variable restoration means for deleting a save number related to a variable name registered in this register. shall be.

〔作用〕[Effect]

変数格納領域内の該当変数名の後に退避番号のバイトを
設け、この領域に退避番号を書き込み、該当変数の再定
義を可能にする。マスクした変数の格納アドレスをスタ
ックおよびスタックポインタに退避する。このようにし
て、変数の退避を行う。また、変数の復活は、該当変数
を削除し、スタック手段より退避した変数の格納アドレ
スを取り出し、レジスタに移し、レジスタの内容で示さ
れる格納アドレスの変数に対し退避番号を元に戻して行
う。
A save number byte is provided after the name of the variable in the variable storage area, and the save number is written in this area to enable redefinition of the variable. Save the storage address of the masked variable to the stack and stack pointer. In this way, variables are saved. Further, a variable is restored by deleting the relevant variable, taking out the storage address of the saved variable from the stack means, moving it to a register, and restoring the save number to the variable at the storage address indicated by the contents of the register.

〔実施例〕〔Example〕

以下、本発明の一実施例について図面を参照して説明す
る。第1図はこの実施例の構成を示すブロック構成図で
ある。この実施例は、第1図に示すように、メインルー
チンとサブルーチンとに共に有効である1個の変数を有
する一変数言語にかかわる装置であり、退避Iが示およ
び復活指示に応じて格納および抽出が実行されるスタッ
ク手段2と、上記変数にかかわる変数名を格納する領域
を拡張して設けられた新たな領域に退避を示す退避番号
を格納し、この退避番号が格納された変数にかかわる変
数名をスタック手段2に格納する変数退避手段1と、復
活指示に応じてスタック手段2から抽出した変数名を登
録するレジスタ3と、このレジスタ3に登録された変数
名にかかわる退避番号を抹消する変数復活手段4とを備
える。
An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the configuration of this embodiment. As shown in FIG. 1, this embodiment is a device related to a one-variable language that has one variable that is valid for both a main routine and a subroutine, and stores and saves and restores in response to save and restore instructions. A save number indicating save is stored in the stack means 2 where extraction is executed and in a new area provided by expanding the area for storing variable names related to the above-mentioned variables, and a save number indicating save is stored in a new area provided by expanding the area for storing variable names related to the above-mentioned variables. A variable saving means 1 that stores variable names in the stack means 2, a register 3 that registers variable names extracted from the stack means 2 in response to a restoration instruction, and a save number related to the variable name registered in this register 3 is deleted. and variable restoration means 4.

第2図はBASIC言語における各変数の格納状態を示
す図である。各変数は「変数の型」に次いで「変数名」
が格納されており、本発明ではこれを書き替えることに
より変数の重複定義を実現する。
FIG. 2 is a diagram showing the storage state of each variable in the BASIC language. Each variable has a "variable type" followed by a "variable name"
is stored, and in the present invention, by rewriting this, overlapping definition of variables is realized.

次に、この実施例の動作を説明する。Next, the operation of this embodiment will be explained.

第3図は変数の退避を実行する際の処理を説明した図で
ある。例として、変数rAAJを退避する場合に、変数
名の最下位バイトをOloに変更して本来の変数rAA
jを区別する。次に、変更した変数の先頭アドレスをス
タックに格納する一連の処理を行う。
FIG. 3 is a diagram illustrating the process when saving variables. For example, when saving the variable rAAJ, change the lowest byte of the variable name to Olo and save the original variable rAAJ.
distinguish j. Next, a series of processing is performed to store the start address of the changed variable on the stack.

第4図は変数の復活を実行する際の処理を説明した図で
ある。サブルーチンなどで使用していた変数rAAJを
削除し、スタックに格納していた変数の先頭アドレスを
レジスタに読み出し、レジスタの内容で示されるアドレ
スに格納されている変数の退避番号を元に戻して本来の
変数rAAJを復活する。
FIG. 4 is a diagram illustrating the process when restoring variables. Delete the variable rAAJ used in the subroutine, etc., read the start address of the variable stored on the stack into the register, restore the save number of the variable stored at the address indicated by the contents of the register, and return it to its original value. Restore the variable rAAJ.

〔発明の効果〕 本発明は、以上説明したように、変数の退避復活処理手
段を活用してサブルーチンの出入口で必要な変数の退避
復活を行うので、メインルーチンとサブルーチンとの相
互で同一変数を使用することができ、したがってサブル
ーチンの独立性を保ち、再帰的処理を可能にする効果が
ある。
[Effects of the Invention] As explained above, the present invention utilizes the variable saving and restoring processing means to save and restore necessary variables at the entrance and exit of a subroutine, so that the same variable can be saved between the main routine and the subroutine. This has the effect of maintaining the independence of subroutines and enabling recursive processing.

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

第1図は、本発明実施例の構成を示すブロック構成図。 第2図は、BASIC言語に於ける変数の格納状態を示
す図。 第3図は、変数の退避を実行する際の処理を説明した図
。 第4図は、変数の復活を実行する際の処理を説明した図
。 1・・・変数退避手段、2・・・スタック手段、3・・
・レジスタ、4・・・変数復活手段。
FIG. 1 is a block configuration diagram showing the configuration of an embodiment of the present invention. FIG. 2 is a diagram showing the storage state of variables in the BASIC language. FIG. 3 is a diagram illustrating processing when saving variables. FIG. 4 is a diagram illustrating the process when restoring variables. 1...Variable saving means, 2...Stack means, 3...
・Register, 4...Variable restoration means.

Claims (1)

【特許請求の範囲】 1、メインルーチンとサブルーチンとに共に有効である
1個の変数を有する一変数言語にかかわる言語変数退避
復活装置において、 退避指示および復活指示に応じて格納および抽出が実行
されるスタック手段と、 上記変数にかかわる変数名を格納する領域を拡張して設
けられた新たな領域に退避を示す退避番号を格納し、こ
の退避番号が格納された変数にかかわる変数名を上記ス
タック手段に格納する変数退避手段と、 復活指示に応じて上記スタック手段から抽出した変数名
を登録するレジスタと、 このレジスタに登録された変数名にかかわる退避番号を
抹消する変数復活手段と を備えたことを特徴とする言語変数退避復活装置。
[Scope of Claims] 1. In a language variable save and restore device related to a univariate language having one variable that is valid for both a main routine and a subroutine, storage and extraction are executed in response to a save instruction and a restore instruction. A stack means for storing a variable name related to the above-mentioned variable, and a save number indicating save is stored in a new area provided by expanding the area for storing the variable name related to the above-mentioned variable, and the variable name related to the variable in which this save number is stored is stored in the above-mentioned stack. A variable saving means for storing in the means, a register for registering a variable name extracted from the stack means in response to a restoration instruction, and a variable restoring means for deleting the saving number related to the variable name registered in this register. A linguistic variable saving and restoring device characterized by:
JP1299261A 1989-11-17 1989-11-17 Language variable drawback restoring device Pending JPH03158930A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1299261A JPH03158930A (en) 1989-11-17 1989-11-17 Language variable drawback restoring device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1299261A JPH03158930A (en) 1989-11-17 1989-11-17 Language variable drawback restoring device

Publications (1)

Publication Number Publication Date
JPH03158930A true JPH03158930A (en) 1991-07-08

Family

ID=17870249

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1299261A Pending JPH03158930A (en) 1989-11-17 1989-11-17 Language variable drawback restoring device

Country Status (1)

Country Link
JP (1) JPH03158930A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8956012B2 (en) 2010-05-13 2015-02-17 Leotech Light-emitting diode (LED) street light apparatus having a heat-dissipation structure

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8956012B2 (en) 2010-05-13 2015-02-17 Leotech Light-emitting diode (LED) street light apparatus having a heat-dissipation structure

Similar Documents

Publication Publication Date Title
EP0069525A1 (en) Data processing system
JPH03158930A (en) Language variable drawback restoring device
JPS57100680A (en) Page fault processing system
KR940009822A (en) How to Run a Subroutine Branch Instruction
JPH01307865A (en) Character string retrieving system
JPH0348933A (en) Stack control circuit for return address
JPH0465717A (en) Method for accessing program
JPS58175054A (en) Data retrieval system
JPH07141195A (en) Literal optimizing system in compiler
JPH04106632A (en) Debug processor
JPH09179753A (en) Stack information collecting system using timing of return processing
JPH0498461A (en) Keyword extracting device
JPH0194473A (en) Japanese input device
JPS62211770A (en) Sentence tone converter
JPH0667942A (en) Log extraction system
JPH06175862A (en) Electronic computer
JPH03109672A (en) Electronic translator
JPS63223983A (en) Graphic drawing device
Silver APPENDIX III
JPH02207328A (en) Pipe line control system
JPS6274130A (en) Data generating system for program structure
JPH03251929A (en) Qualification name settling system for translation system
JPH05151030A (en) Information display system at end of user program abnormality
JPH0227471A (en) Intra-text numeric data updating system
JPH04297928A (en) Method for outputting source program list