JPS62137637A - Arithmetic accuracy setting system in language processing system - Google Patents

Arithmetic accuracy setting system in language processing system

Info

Publication number
JPS62137637A
JPS62137637A JP60279726A JP27972685A JPS62137637A JP S62137637 A JPS62137637 A JP S62137637A JP 60279726 A JP60279726 A JP 60279726A JP 27972685 A JP27972685 A JP 27972685A JP S62137637 A JPS62137637 A JP S62137637A
Authority
JP
Japan
Prior art keywords
arithmetic
digits
program
intermediate code
intermediate result
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
JP60279726A
Other languages
Japanese (ja)
Inventor
Takao Sato
孝夫 佐藤
Michiyuki Ushinmei
宇新明 道行
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 JP60279726A priority Critical patent/JPS62137637A/en
Publication of JPS62137637A publication Critical patent/JPS62137637A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To make it possible to change accuracy of calculation of objective program of an arithmetic expression only by changing registered information by making conversion to objective program using arithmetic accuracy information consisting of number of digits of integer part and number of digits of decimal part registered beforehand. CONSTITUTION:Arithmetic accuracy information registered in a storage device 1 is inputted by an inputting means 2. Then, number of digits of decimal part and integer part of storing area are determined and allotted by an intermediate result allotting means 5 to store interim result of operation used in an objective program from the arithmetic accuracy information. An intermediate code consisting of two lines of talk made by expanding an arithmetic expression to the relation of operator and operand is inputted by an intermediate code inputting means 4. Further, inputted intermediate codes are processed successively from the head, and an objective program 4 using allotted interim result storing area is formed.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は原始プログラムを目的プログラムに変換する言
語処理系における原始プログラム中の算術式の中間結果
の演算精度の決定を行なう言語処理系における演算精度
設定方式に関する。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to an operation in a language processing system that converts a source program into a target program, and determines the precision of the calculation of an intermediate result of an arithmetic expression in a source program. Regarding accuracy setting method.

〔従来の技術〕[Conventional technology]

従来この種の演算精度設定方式は、演算精度情報を外部
から入力する入力手段をもたず、中間コード中に現われ
るすべての演算数の整数部及び小数部の桁数から必要最
低限の精度を判定し、この精度から中間結果格納領域の
整数部及び小数部の桁数を決定し前記中間結果格納領域
を使用した目的プログラムに変換していた。
Conventionally, this type of arithmetic precision setting method does not have an input means for externally inputting arithmetic precision information, and only calculates the minimum necessary precision from the number of digits in the integer part and decimal part of all the arithmetic numbers that appear in the intermediate code. The number of digits of the integer part and decimal part of the intermediate result storage area is determined from this accuracy, and the target program is converted to use the intermediate result storage area.

また中間コード中の演算数の桁数より演算精度を求める
方式は、言語処理系によシ異なり、結果として決定さh
た演算精度もそれぞれの言語処理系固有のものであった
Also, the method of calculating the calculation accuracy from the number of digits of the calculation number in the intermediate code differs depending on the language processing system, and the result is
The calculation accuracy was also unique to each language processing system.

第3図は、従来方式の構成を示すブロック図であるO 第3図を参照すると従来方式は、原始プログラム中の算
術式を演算子、演算数の関係に展開したトークン列から
成る中間コードを格納した記憶装置13及びこの中間コ
ードを入力する中間コード入力手段14、中間結果格納
領域の精度の決定を行う中間結果判定手段8及び中間結
果判定手段8で決定した精度から目的プログラムの実行
時に演算の途中結果を格納するために必要な主記憶製賃
上またはレジスタ上の作業用領域である中間結果格納領
域の作成割付けを行う中間結果割付は手段15、中間結
果割付は手段15で割付けた中間結果格納領域及び中間
コード入力手段14で入力した中間コードから目的プロ
グラムの生成を行う目的プログラム生成手段16から構
成される。
FIG. 3 is a block diagram showing the configuration of the conventional method. Referring to FIG. The stored storage device 13, the intermediate code input means 14 that inputs this intermediate code, the intermediate result determination means 8 that determines the accuracy of the intermediate result storage area, and the calculation from the accuracy determined by the intermediate result determination means 8 when executing the target program. Create and allocate an intermediate result storage area, which is a work area on the main memory or register necessary for storing intermediate results. It is comprised of a result storage area and an object program generation means 16 that generates an object program from the intermediate code inputted by the intermediate code input means 14.

第4図は、従来方式の処理の流わを示す流れ図である。FIG. 4 is a flowchart showing the flow of processing in the conventional method.

第4図におい°〔、ステップ41でまず原始プログラム
中の算術式を演算子、演算数の関係に展開したトークン
列から成る中間コードを中間コード入力手段14により
入力する。次にステップ42で中間結果判定手段8を用
いステップ41で入力した中間コード中の演算数のトー
クンをすべて調べ中間結果格納領域の精度を決定する。
In FIG. 4, in step 41, the intermediate code input means 14 inputs an intermediate code consisting of a token string in which an arithmetic expression in the source program is expanded into a relationship between operators and arithmetic numbers. Next, in step 42, all the tokens of the operation number in the intermediate code input in step 41 are examined using the intermediate result determination means 8 to determine the accuracy of the intermediate result storage area.

さらにステップ43で、ステップ42で決定した中間結
果格納領域の精度から中間結果割付は手段15を用い中
間結果格納領域の割付けを行う。ステップ44で、ステ
ップ41で入力した中間コードを先頭から順に処理しス
テップ43で作成した中間結果格納領域を使用した目的
プログラムを生成する。
Furthermore, in step 43, the intermediate result storage area is allocated using means 15 based on the accuracy of the intermediate result storage area determined in step 42. At step 44, the intermediate code input at step 41 is processed sequentially from the beginning to generate a target program using the intermediate result storage area created at step 43.

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

このような従来方式に幹いては、演算精度の変更の必要
が生じた場合には、複雑な従来の演算精度設定方式を熟
知したうえで、最終的な演算精度を得るために中間コー
ド中の演算数の桁数を変更しなければならず多大な労力
と時間が必要であるという第1の問題点がある。
In this conventional method, when it is necessary to change the calculation accuracy, it is necessary to be familiar with the complicated conventional calculation accuracy setting method, and then change the settings in the intermediate code to obtain the final calculation accuracy. The first problem is that the number of digits in the calculation number must be changed, which requires a great deal of effort and time.

一!た言語処理系が原始プログラム中の算術式を目的プ
ログラムに変換する過程において変換の前に、必要な演
算精度がすでに決められている場合であっても中間コー
ド中の演算数から演算精度を決定しなければならず演算
精度判定のための処理時間が無駄になるという第2の問
題点がある。
one! In the process of converting arithmetic expressions in the source program to the target program, the language processing system determines the arithmetic precision from the number of operations in the intermediate code even if the necessary arithmetic precision has already been determined. There is a second problem that processing time for determining calculation accuracy is wasted.

さらに異なる言語処理系の間では、同一の原始プログラ
ムであるにもかかわらず算術式の演算精度が異なるため
に変換された目的プログラムの動作が異なり、時間的、
経済的に多大な打撃を与えるという第3の問題点がある
Furthermore, between different language processing systems, the operation of the converted target program differs due to the difference in the precision of arithmetic expressions even though they are the same source program, and the behavior of the converted target program differs in time and
There is a third problem, which is that it will cause a huge economic blow.

したがって本発明の目的は、整数部の桁数及び小数部の
桁数から成る演算精度情報を入力する手段を設け、入力
した演算精度情報から決定した中間結果格納領域を使用
した目的プログラムへの変換を行うことにより、演算精
度の変更が必要な原始プログラムに対しては、原始プロ
グラムの変更無しで演算精度の変更を可能とし、さらに
は言語処理系の処理速度の向上を図り、また演算精度情
報を言語処理系の外部から固定的に与えることにより、
異なる言語処理系間での互換性を向上できる言語処理系
における演算精度設定方式を提供することにある。
Therefore, an object of the present invention is to provide a means for inputting arithmetic precision information consisting of the number of digits in the integer part and the number of digits in the decimal part, and to convert the program into a target program using an intermediate result storage area determined from the input arithmetic precision information. By doing this, it is possible to change the arithmetic precision without changing the source program for a source program that requires a change in arithmetic precision, and it also improves the processing speed of the language processing system. By giving fixedly from outside the language processing system,
An object of the present invention is to provide an arithmetic precision setting method for a language processing system that can improve compatibility between different language processing systems.

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

本発明の方式は、原始プログラムを目的プログラムに変
換する言語処理系における演算精度設定方式におい”C
1あらかじめ記憶装置上に設定された整数部と小数部と
の桁数から成る演算精度情報を入力する精度情報入力手
段と、前記精度情報入力手段で入力した演算精度情報か
ら中間結果格納領域の作成2割付けを行う中間結果割付
は手段と、あらかじめ記憶装置上に格納された原始プロ
グラム中の算術式を演算子と演算数の関係に展開したト
ークン列から成る中間コードを入力する中間コード入力
手段と、前記中間結果割付は手段で割付けられた中間結
果格納領域と前記中間コード入力手段で入力した中間コ
ードとから前記算術式の目的プログラムを生成する目的
プログラム生成手段とを含んで構成される〇 〔実施例〕 次に本発明について図面を参照して説明する。
The method of the present invention is an arithmetic precision setting method for a language processing system that converts a source program into a target program.
1. Accuracy information input means for inputting arithmetic precision information consisting of the number of digits of an integer part and a decimal part preset on a storage device, and creation of an intermediate result storage area from the arithmetic precision information inputted by the precision information input means. An intermediate result allocation means for performing 2 allocation, and an intermediate code input means for inputting an intermediate code consisting of a token string obtained by expanding an arithmetic expression in a source program stored in a storage device in advance into a relationship between operators and operands. , the intermediate result allocation is configured to include an intermediate result storage area allocated by the means and an object program generation means for generating the object program of the arithmetic expression from the intermediate code input by the intermediate code input means. Embodiments Next, the present invention will be described with reference to the drawings.

第1図は、本発明の一実施例の構成を示すブロック図で
ある。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention.

第1図の言語処理系における演算精度設定方式は、整数
部の桁数及び小数部の桁数から成る演算精度情報を格納
した記憶装置1と、この演算精度情報を入力する精度情
報入力手段2と、入力した演算精度情報から目的プログ
ラムの実行時に演算の途中結果を格納するために必要な
主記憶上またはレジスタ上の作業用領域である中間結果
格納領域の作成及び割付けを行う中間結果割付は手段5
と、原始プログラム中の算術式を演算子、演算数の関係
に展開したトークン列から成る中間コードを格納した記
憶装置3と、この中間コードを入力する中間コード入力
手段4と、中間結果割付は手段5で作成した中間結果格
納領域及び中間コード入力手段4で入力した中間コード
とから目的プログラムを生成する目的プログラム生成手
段6とから構成される。
The arithmetic precision setting method in the language processing system shown in FIG. Intermediate result allocation is a process that creates and allocates an intermediate result storage area, which is a work area in main memory or registers, necessary to store intermediate results of calculations during execution of the target program from input calculation accuracy information. Means 5
, a storage device 3 storing an intermediate code consisting of a token string in which an arithmetic expression in a source program is expanded into a relationship between operators and arithmetic numbers, an intermediate code input means 4 for inputting this intermediate code, and an intermediate code input means 4 for allocating intermediate results. It is comprised of an object program generation means 6 for generating an object program from the intermediate result storage area created by the means 5 and the intermediate code inputted by the intermediate code input means 4.

第2図は、第1図の処理の流れを示す流れ図である。FIG. 2 is a flowchart showing the flow of the process shown in FIG.

第2図においてステップ21でまず記憶装置1上に登録
された演算精度情報を精度情報入力手段2により入力し
、次にステップ22でステップ21で入力した演算精度
情報から目的プログラムで使用する演算の途中結果を格
納しておくために必要な中間結果格納領域の小む部、整
数部の桁数の決定及び割付けを中間結果割付は手段5に
より行う。
In FIG. 2, in step 21, the arithmetic accuracy information registered on the storage device 1 is first inputted by the accuracy information input means 2, and then in step 22, the arithmetic accuracy information input in step 21 is used to determine the arithmetic operation to be used in the target program. Determining and allocating the number of digits of the small part and integer part of the intermediate result storage area necessary for storing the intermediate result is performed by means 5 for allocating the intermediate result.

次にステップ23では算術式を演算子、演算数の関係に
展開したトークン列から成る中間コードを中間コード入
力手段4により入力する。さらにステップ24では、入
力した中間コードを先頭から順に処理しステップ22で
割付けた中間結果格納領域を使用した目的プログラムを
生成する。
Next, in step 23, the intermediate code input means 4 inputs an intermediate code consisting of a token string in which an arithmetic expression is expanded into a relationship between operators and arithmetic numbers. Furthermore, in step 24, the input intermediate code is processed in order from the beginning, and a target program is generated using the intermediate result storage area allocated in step 22.

以上が本実施例の処理の流りの説明である。この処理の
流れかられかるとおり目的プログラムで使用される中間
結果格納領域を決定するにあたシ必要な情報は、記憶装
置1上にあらかじめ格納された演算精度情報のみである
ため、この記憶装置l上の演算精度情報を変更するだけ
で中間結果格納領域の整数部の桁数及び小数部の桁数を
変更することができる。捷た記憶装置1上の演算精度情
報を変更することにより任意に中間結果格納領域の整数
部の桁数及び小数部の桁数を決めることができるため、
演算精度設定方式の異なる他の言語処理系が変換した目
的プログラムと同一の演算精度で動作する目的プログラ
ムへの変換を演算精度情報の変更だけで行うことができ
る。
The above is the explanation of the processing flow of this embodiment. As can be seen from the flow of this process, the information necessary to determine the intermediate result storage area used by the target program is only the arithmetic precision information stored in advance on the storage device 1, so this storage device The number of digits in the integer part and the number of digits in the decimal part of the intermediate result storage area can be changed simply by changing the calculation precision information on l. By changing the arithmetic precision information on the shredded storage device 1, the number of digits in the integer part and the number of digits in the decimal part of the intermediate result storage area can be arbitrarily determined.
It is possible to convert a target program that operates with the same calculation accuracy as a target program converted by another language processing system with a different calculation accuracy setting method by simply changing the calculation accuracy information.

第4図の従来方式の実施例の処理の流れと第2図の本発
明による実施例の処理の流れを比較すると第4図の従来
方式では、ステップ42で中間コード中の演算数のトー
クンをすべて調べて中間結果格納領域の精度を決定する
のに対して第2図の本実施例では、単にステップ21で
演算精度情報を入力するのみで良いため処霧時間の短縮
ができる。
Comparing the processing flow of the embodiment of the conventional method shown in FIG. 4 and the processing flow of the embodiment according to the present invention shown in FIG. 2, in the conventional method shown in FIG. In contrast to determining the accuracy of the intermediate result storage area by examining all the results, in the present embodiment shown in FIG. 2, it is only necessary to input the calculation accuracy information in step 21, so that the processing time can be shortened.

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

以上訝明したようにあらかじめ記憶装置上に登録された
整数部の桁数及び小数部の桁数から成る演算精度情報を
用いて目的プログラムへの変換を行うことにより演算精
度情報を変更するだけで算術式の目的プログラムの演算
精度の変更を可能とし、さらには言語処理系の処理速度
の向上を図9、また演算精度情報を外部から固定的に与
えることにより、異なる言語処理系間での互換性を向上
させることができるという効果がある。
As explained above, the calculation precision information can be changed simply by converting it to the target program using the calculation precision information, which consists of the number of digits of the integer part and the number of digits of the decimal part, registered in advance on the storage device. It is possible to change the arithmetic precision of the target program for arithmetic expressions, and also improve the processing speed of the language processing system (Figure 9). Also, by providing fixed arithmetic precision information from the outside, it is possible to improve compatibility between different language processing systems. It has the effect of improving sexual performance.

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

第1図は、本発明の一実施例の構成を示すブロック図、
第2図は第1図の動作を示すフローチャート、第3図は
従来方式の構成を示すブロック図および第4図は第3図
の動作を示すフローチャートである。 1・・・・・・記憶装置、2・・・−・・精度情報入力
手段、3゜13・・・・・・記憶装置、4,14・・・
・・・中間コード入力手段、5.15・・・・・・中間
結果割付は手段、6,16・・・・・・目的プログラム
生成手段、7・・・・・・目的プログラム、8・・・・
・・中間結果判定手段。 −一\ 代理人 弁理士  内 原   晋 ¥; 1  因 第  2  図 第 3 図 −f;4  図
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention;
FIG. 2 is a flowchart showing the operation of FIG. 1, FIG. 3 is a block diagram showing the configuration of the conventional system, and FIG. 4 is a flowchart showing the operation of FIG. 1...Storage device, 2...-Accuracy information input means, 3゜13...Storage device, 4, 14...
... Intermediate code input means, 5.15 ... Intermediate result allocation means, 6, 16 ... Purpose program generation means, 7 ... Purpose program, 8 ...・・・
...Means for determining intermediate results. -1\ Agent Patent Attorney Susumu Uchihara; 1 Cause 2 Figure 3 Figure -f; 4 Figure

Claims (1)

【特許請求の範囲】 原始プログラムを目的プログラムに変換する言語処理系
における演算精度設定方式において、あらかじめ記憶装
置上に設定された整数部と小数部との桁数から成る演算
精度情報を入力する精度情報入力手段と、 前記精度情報入力手段で入力した演算精度情報から中間
結果格納領域の作成、割付けを行う中間結果割付け手段
と、 あらかじめ記憶装置上に格納された原始プログラム中の
算術式を演算子と演算数の関係に展開したトークン列か
ら成る中間コードを入力する中間コード入力手段と、 前記中間結果割付け手段で割付けられた中間結果格納領
域と前記中間コード入力手段で入力した中間コードとか
ら前記算術式の目的プログラムを生成する目的プログラ
ム生成手段とを含むことを特徴とする演算精度設定方式
[Claims] In an arithmetic precision setting method in a language processing system that converts a source program into a target program, the precision is to input arithmetic precision information consisting of the number of digits of an integer part and a decimal part set in advance on a storage device. information input means; intermediate result allocation means for creating and allocating an intermediate result storage area from the arithmetic accuracy information input by the accuracy information input means; intermediate code input means for inputting an intermediate code consisting of a token string developed in the relationship between 1. An arithmetic precision setting method comprising: objective program generation means for generating an arithmetic expression objective program.
JP60279726A 1985-12-11 1985-12-11 Arithmetic accuracy setting system in language processing system Pending JPS62137637A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP60279726A JPS62137637A (en) 1985-12-11 1985-12-11 Arithmetic accuracy setting system in language processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP60279726A JPS62137637A (en) 1985-12-11 1985-12-11 Arithmetic accuracy setting system in language processing system

Publications (1)

Publication Number Publication Date
JPS62137637A true JPS62137637A (en) 1987-06-20

Family

ID=17615023

Family Applications (1)

Application Number Title Priority Date Filing Date
JP60279726A Pending JPS62137637A (en) 1985-12-11 1985-12-11 Arithmetic accuracy setting system in language processing system

Country Status (1)

Country Link
JP (1) JPS62137637A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6468837A (en) * 1987-09-10 1989-03-14 Nec Corp Developing system for binary addition

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6468837A (en) * 1987-09-10 1989-03-14 Nec Corp Developing system for binary addition

Similar Documents

Publication Publication Date Title
US4172287A (en) General purpose data processing apparatus for processing vector instructions
KR910010301A (en) Command designation method and execution device
JPS62137637A (en) Arithmetic accuracy setting system in language processing system
JPH01118931A (en) Program conversion system
JP3683598B2 (en) Data-driven information processing device
JPH0789314B2 (en) Floating point condition code generation method
JPS59184944A (en) Rounding arithmetic system
JPH023832A (en) Translation system for source program including input/ output sentence without format
JPH0250730A (en) Language converting system based upon common machine word
JPS6297031A (en) Matching system for bit number of mantissa part
JP3017300B2 (en) Fuzzy inference device
JPH01265329A (en) Register allocation processing method
SU596934A1 (en) Elementary function generator
JPS63197218A (en) Priority encoder
JPH03100733A (en) Method for arithmetic mode determination processing in compiler
JPS62235643A (en) Program language translator
JPH0371233A (en) Optimum data allocating system for compiler
JPH0373026A (en) Compile system
JPH04167134A (en) Bit transcription system
JPS60142423A (en) Forming method of conditional code
JPS6077244A (en) Crc circuit
JPH04320535A (en) Program forming device
JPS5966747A (en) Multiplier
JPS62257536A (en) Data flow processor
JPH02222032A (en) Optimization system for addition/subtraction instruction