JPH11224200A - Program converting method, device therefor, and storage medium having stored program converting program - Google Patents
Program converting method, device therefor, and storage medium having stored program converting programInfo
- Publication number
- JPH11224200A JPH11224200A JP2706698A JP2706698A JPH11224200A JP H11224200 A JPH11224200 A JP H11224200A JP 2706698 A JP2706698 A JP 2706698A JP 2706698 A JP2706698 A JP 2706698A JP H11224200 A JPH11224200 A JP H11224200A
- Authority
- JP
- Japan
- Prior art keywords
- program
- conversion
- existing
- converting
- type
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 30
- 238000006243 chemical reaction Methods 0.000 claims abstract description 44
- 238000004458 analytical method Methods 0.000 claims abstract description 36
- 230000009466 transformation Effects 0.000 claims 1
- 238000004364 calculation method Methods 0.000 abstract description 8
- 230000006870 function Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 7
- 101150060298 add2 gene Proteins 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 1
- JEIPFZHSYJVQDO-UHFFFAOYSA-N ferric oxide Chemical compound O=[Fe]O[Fe]=O JEIPFZHSYJVQDO-UHFFFAOYSA-N 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、プログラム変換方
法及び装置及びプログラム変換プログラムを格納した記
憶媒体に係り、特に、数式処理システムの機能拡張を行
うためにプログラムを変換するためのプログラム変換方
法及び装置及びプログラム変換プログラムを格納した記
憶媒体に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program conversion method and apparatus, and a storage medium storing a program conversion program. More particularly, the present invention relates to a program conversion method and a program conversion method for converting a program in order to extend the functions of a mathematical expression processing system. The present invention relates to an apparatus and a storage medium storing a program conversion program.
【0002】[0002]
【従来の技術】数式処理システムにおいて、予め定義さ
れている以外の型の数を扱う場合、そのシステムが完全
にオブジェクト指向であれば、その型についてクラス定
義を行うことにより、既存のプログラムをそのまま利用
できる。2. Description of the Related Art In a mathematical processing system, when a number of types other than those defined in advance is handled, if the system is completely object-oriented, an existing program can be used as it is by defining a class for the type. Available.
【0003】[0003]
【発明が解決しようとする課題】しかしながら、数式処
理システムの中にはオブジェクト指向が不十分であるも
のもあり、その場合は、新しい型の定義や演算の定義と
合わせて、プログラム変換等の種々の処理を人手で行う
必要がある。以下にその例を示す。However, some mathematical processing systems are not sufficiently object-oriented. In such a case, various types of program conversion and the like are performed together with new type definitions and operation definitions. Must be performed manually. An example is shown below.
【0004】数式処理システムにおいて、新しい型を定
義し、その型を持つ数の計算を行うことを考える。ここ
では、例として、数式処理システムには、有理数及びそ
の間の加減乗除算、大小比較、絶対値の基本演算が定義
され、さらに、浮動小数及びその間の加減乗除算、大小
比較、絶対値の基本演算が定義され、浮動小数の丸めの
モードとして四捨五入、−∞丸め、及び、+∞丸めが用
意されているものとする。[0004] In a mathematical processing system, consider a case where a new type is defined and a number having the new type is calculated. Here, as an example, in the mathematical processing system, basic operations of rational numbers and addition / subtraction / multiplication / division between them, magnitude comparison, and absolute value are defined. It is assumed that the operation is defined and rounding, -∞ rounding, and + ∞ rounding are provided as floating-point rounding modes.
【0005】このシステムに、新しく“区間数”という
型を定義し、さらに、区間数係数の多項式の計算を行お
うとする場合について説明する。区間数は、a≦bなる
浮動小数の対[a,b]で表され、a≦c≦bなる数c
の集合を意味する。また、区間数の基本演算の定義は、
図18に示す通りであるとする。但し、浮動小数の計算
において、o,od ,ou (oは、+,−,*,/のい
ずれか)は、それぞれ丸めのモードとして、四捨五入、
−∞丸め、+∞丸めを表す。区間係数多項式の加減乗除
は、各次数毎に係数を纏めて、それを区間数の演算で計
算するものとする。A case will be described in which a new type of "section number" is defined in this system, and further a calculation of a polynomial of the section number coefficient is to be performed. The number of sections is represented by a floating-point pair [a, b] where a ≦ b, and a number c where a ≦ c ≦ b
Means a set of The definition of the basic calculation of the number of sections is
Suppose that it is as shown in FIG. However, in the calculation of the float, o, o d, o u (o is +, -, *, either /) as the rounding mode, respectively, rounded,
Represents −∞ rounding and + ∞ rounding. In addition, subtraction, multiplication and division of the section coefficient polynomial, coefficients are grouped for each degree and calculated by calculating the number of sections.
【0006】例えば、図19に示す、有理数係数あるい
は、浮動小数係数の一変数多項式f(x)のL1 ノルム
を計算するL1 というプログラムがあったとする(多項
式f(x)=cn xn +cn-1 xn-1 + … +c0
のL1 ノルムは、|cn |+|cn-1 |+ … +|c
1 |で定義される)。なお、同図において、第一行目の
「L1 :=proc(f,x)」とは、L1の仮引数が
fとxであることを意味し、第二行目の「local
c,cs,res;」は、この関数の中で用いる局所変
数の宣言である。第三行目の「coeffs(f,
x)」は、多項式f(x)の係数からなるリストを返す
関数である。また、第五行目の「for c in c
s do...od」は、cが、リストcs中のすべて
の成分を渡る繰り返しを示す。[0006] For example, FIG. 19, or rational coefficients, floating point computing the L 1 norm of univariate polynomial f (x) of the coefficients and there is a program called L 1 (polynomial f (x) = c n x n + c n-1 x n-1 + ... + c 0
Is of the L 1 norm, | c n | + | c n-1 | + ... + | c
1 |). In the figure, “L 1 : = proc (f, x)” on the first line means that the dummy arguments of L 1 are f and x, and “local” on the second line
"c, cs, res;" are declarations of local variables used in this function. The third line “coeffs (f,
“x)” is a function that returns a list including coefficients of the polynomial f (x). In the fifth line, "for c in c
s do. . . "od" indicates that c repeats across all components in list cs.
【0007】いずれの手法をとるにせよ、新しい型を定
義したときには、最低限、基本演算を定義するプログラ
ムを書くことが必要となる。図20は、2つの区間数の
加算を計算するプログラムの例を示し、同図に示す2つ
の区間数の間の加算を定義するプログラムとして“ad
d2interval”を示す。Regardless of which method is used, when a new type is defined, it is necessary to write a program defining at least the basic operation. FIG. 20 shows an example of a program for calculating the addition of two section numbers, and "ad" is a program for defining the addition between the two section numbers shown in FIG.
d2interval ".
【0008】図21は、区間係数多項式のL1 ノルムを
計算するプログラムの例を示す。同図に示すプログラム
“L1interval”を書けば、区間係数多項式の
L1ノルムの計算は可能になる。しかし、この手法で
は、新しい型の定義をする度に、全てのプログラムを書
き直す必要がある。もし、完全にオブジェクト指向の数
式処理システムならば、基本演算の定義のみで、図19
に示すプログラムのままで、区間数係数多項式のL1 ノ
ルムの計算も可能である。FIG. 21 shows an example of a program for calculating the L 1 norm of the interval coefficient polynomial. If you write a program "L1interval" shown in the figure, the calculation of the L 1 norm interval coefficient polynomial it becomes possible. However, this method requires rewriting all programs each time a new type is defined. If a completely object-oriented mathematical processing system is used, only the basic operations are defined, and FIG.
The calculation of the L 1 norm of the section number coefficient polynomial is also possible with the program shown in FIG.
【0009】しかし、この仮定が成り立たない、即ち、
基本演算に関して、ユーザによる定義変更が不可能な場
合がある。このとき、図22に示すように、プログラム
中に加算「+」があれば、その部分を例えば、“add
2”という二引数関数に書換え、“add2”というプ
ログラムを用意することが必要となる。さらに、絶対値
を返す関数abs(あるいは、さらにそこで呼び出され
ている関数)の中には、通常、大小比較があるので、そ
の書換えも必要となる。However, this assumption does not hold, ie,
In some cases, the user cannot change the definition of the basic operation. At this time, as shown in FIG. 22, if there is an addition “+” in the program, the portion is added to, for example, “add”
It is necessary to rewrite the function as a two-argument function “2” and prepare a program “add2.” In addition, functions abs (or functions called there) that return an absolute value usually include large or small functions. Because there is a comparison, it needs to be rewritten.
【0010】本発明は、上記の点に鑑みなされたもの
で、完全にはオブジェクト指向となっていない数式処理
システムにおいて、新しい型を定義した場合に、既存の
プログラムを自動変換し、新しい型に対しても計算可能
とするプログラム変換方法及び装置及びプログラム変換
プログラムを格納した記憶媒体を提供することを目的と
する。The present invention has been made in view of the above points, and in a mathematical processing system that is not completely object-oriented, when a new type is defined, an existing program is automatically converted to a new type. It is another object of the present invention to provide a program conversion method and device which can be calculated by the user and a storage medium storing the program conversion program.
【0011】[0011]
【課題を解決するための手段】図1は、本発明の原理を
説明するための図である。本発明(請求項1)は、数式
処理システムにおける、新しい型の定義に伴う既存プロ
グラムの基本演算部分を変換するためのプログラム変換
方法において、既存プログラムを入力し(ステップ
1)、入力された既存プログラムの構文解析を行い(ス
テップ2)、構文解析された既存プログラムについて文
法解析を行い(ステップ3)、既存の数式処理システム
に定義されている型で計算可能なプログラムを新しく定
義される型でも計算可能とする変換を行うためのプログ
ラム変換規則を用いて、文法解析された既存プログラム
を新しく定義する型でも計算可能となるよう変換し(ス
テップ4)、出力する(ステップ5)。FIG. 1 is a diagram for explaining the principle of the present invention. The present invention (claim 1) provides a program conversion method for converting a basic operation part of an existing program associated with a definition of a new type in a mathematical processing system. The program is parsed (step 2), the grammatical analysis is performed on the parsed existing program (step 3), and a program that can be calculated with the type defined in the existing mathematical processing system is converted into a newly defined type. Using a program conversion rule for performing a conversion that enables calculation, an existing program that has been subjected to grammatical analysis is converted so that a newly defined type can be calculated (step 4) and output (step 5).
【0012】本発明(請求項2)は、変換規則が変換対
象とする基本演算に、四則演算、大小比較、ゼロ判定の
いずれかを含む。本発明(請求項3)は、数式処理シス
テムにおける、新しい型の定義に伴う既存プログラムの
基本演算部分を変換するためのプログラム変換装置であ
って、既存プログラムを入力するプログラム入力手段1
と、入力された既存プログラムの構文解析を行う構文解
析手段2と、構文解析手段により構文解析された既存プ
ログラムについて文法解析を行う文法解析手段3と、既
存の数式処理システムに定義されている型で計算可能な
プログラムを新しく定義される型でも計算可能とする変
換を行うための変換規則4と、変換規則4を用いて文法
解析された既存プログラムを変換する変換手段5と、変
換手段5で変換されたプログラムを出力する出力手段6
とを有する。In the present invention (claim 2), the basic operation to be converted by the conversion rule includes any of four arithmetic operations, magnitude comparison, and zero judgment. The present invention (claim 3) is a program conversion device for converting a basic operation part of an existing program associated with a definition of a new type in a mathematical processing system, wherein the program input means 1 inputs an existing program.
Syntactic analysis means 2 for analyzing the syntax of the input existing program, grammatical analysis means 3 for analyzing the grammar of the existing program parsed by the syntax analysis means, and a type defined in the existing mathematical processing system. A conversion rule 4 for converting a program which can be calculated by a new type to be able to be calculated, a conversion means 5 for converting an existing program grammatically analyzed using the conversion rule 4, and a conversion means 5. Output means 6 for outputting the converted program
And
【0013】本発明(請求項4)は、変換規則4が変換
対象とする基本演算に、四則演算、大小比較、ゼロ判定
のいずれかを含む。本発明(請求項5)は、数式処理シ
ステムにおける、新しい型の定義に伴う既存プログラム
の基本演算部分を変換するためのプログラム変換プログ
ラムを格納した記憶媒体であって、既存プログラムを入
力させるプログラム入力プロセスと、入力された既存プ
ログラムの構文解析を行う構文解析プロセスと、構文解
析プロセスにより構文解析された既存プログラムについ
て文法解析を行う文法解析プロセスと、既存の数式処理
システムに定義されている型で計算可能なプログラムを
新しく定義される型でも計算可能とする変換を行うため
のプログラム変換規則を用いて文法解析された既存プロ
グラムを変換する変換プロセスと、変換プロセスで変換
されたプログラムを出力させる出力プロセスとを有す
る。In the present invention (claim 4), the basic operation to be converted by the conversion rule 4 includes any of four arithmetic operations, magnitude comparison, and zero judgment. The present invention (claim 5) is a storage medium for storing a program conversion program for converting a basic operation part of an existing program associated with a definition of a new type in a mathematical processing system, wherein the program input causes the existing program to be input. Process, a parsing process for parsing the input existing program, a grammar parsing process for parsing the existing program parsed by the parsing process, and a type defined in the existing mathematical processing system. A conversion process that converts an existing program that has been grammatically analyzed using a program conversion rule that converts a computable program into a newly defined type that can be calculated, and an output that outputs the program converted by the conversion process Process.
【0014】本発明(請求項6)は、変換プロセスで変
換対象となる基本演算に、四則演算、大小比較、ゼロ判
定のいずれかを含む。上記のように、本発明では、新し
い型を定義したとき、基本演算部分及び型変換用のプロ
グラムを予め変換規則として用意しておき、これを参照
することにより、既存のプログラムを新規のプログラム
に変換することが可能となる。According to the present invention (claim 6), the basic operation to be converted in the conversion process includes any of four arithmetic operations, magnitude comparison, and zero judgment. As described above, in the present invention, when a new type is defined, a basic operation part and a program for type conversion are prepared in advance as conversion rules, and by referring to this, an existing program is converted to a new program. It can be converted.
【0015】[0015]
【発明の実施の形態】図3は、本発明のプログラム変換
装置の構成を示す。同図に示すプログラム変換装置は、
プログラム入力部1、構文解析部2、文法解析部3、変
換規則データベース4、プログラム変換部5及び出力部
6より構成される。FIG. 3 shows the configuration of a program conversion device according to the present invention. The program conversion device shown in FIG.
It comprises a program input unit 1, a syntax analysis unit 2, a grammar analysis unit 3, a conversion rule database 4, a program conversion unit 5, and an output unit 6.
【0016】プログラム入力部1は、既存のプログラム
を入力する。構文解析部2は、既存の方法により、入力
されたプログラムの構文解析を行い、文法解析部3に転
送する。文法解析部3は、構文解析により得られた結果
に対して、文法辞書(図示せず)等を参照して文法解析
を行い、プログラム変換部5に転送する。The program input unit 1 inputs an existing program. The syntax analysis unit 2 analyzes the syntax of the input program by an existing method, and transfers it to the grammar analysis unit 3. The grammar analyzer 3 performs grammar analysis on the result obtained by the syntax analysis with reference to a grammar dictionary (not shown) or the like, and transfers the result to the program converter 5.
【0017】なお、構文解析部2と文法解析部3につい
ては既存技術を用いるものとし、本発明ではその方法を
特定しない。変換規則データベース4は、基本演算部分
の変換規則を格納する。変換対象となる基本演算には、
例えば、二引数の加算、大小比較、ゼロ判定等がある。
プログラム変換部5は、上記の変換規則データベース4
に登録されている変換規則、及び文法解析された結果に
基づいて、プログラムを変換し、出力部6に転送する。Note that the syntactic analysis unit 2 and the grammar analysis unit 3 use the existing technology, and the present invention does not specify the method. The conversion rule database 4 stores the conversion rules of the basic operation part. Basic operations to be converted include:
For example, there are addition of two arguments, comparison of magnitude, determination of zero, and the like.
The program conversion unit 5 stores the conversion rule database 4
The program is converted based on the conversion rules registered in, and the result of the grammatical analysis, and transferred to the output unit 6.
【0018】出力部6は、プログラム変換部5において
変換されたプログラムを出力する。The output unit 6 outputs the program converted by the program conversion unit 5.
【0019】[0019]
【実施例】以下、本発明の実施例を図面と共に説明す
る。ここで、区間数の型名を“interval”と
し、前述の図18に従って区間数の間の基本演算を定義
する。図4は、本発明の一実施例のプログラムの変換規
則の例を示す図である。同図において、(a)のパター
ンがあれば、それを(b)のパターンに書き換えるもの
とし、また、‖・‖は、省略されることもあることを示
す。これは、数式処理システムの言語の文法をBNFで
書いたものの一部である。この言語においては、繰り返
し部分で、for〈name〉と指定した場合、fro
m〈expr〉が省略されたときには、〈name〉の
初期値は1であり、by〈expr〉が省略されたとき
には、〈name〉は1つずつ増えるものとする。Embodiments of the present invention will be described below with reference to the drawings. Here, the type name of the number of sections is “interval”, and a basic operation between the number of sections is defined according to FIG. 18 described above. FIG. 4 is a diagram illustrating an example of a program conversion rule according to an embodiment of the present invention. In the figure, if there is the pattern (a), it is rewritten to the pattern (b), and ‖ indicates that the pattern may be omitted. This is a part of the language grammar of the mathematical processing system written in BNF. In this language, if for <name> is specified in the repetition part,
When m <expr> is omitted, the initial value of <name> is 1, and when by <expr> is omitted, <name> increases by one.
【0020】基本演算の定義プログラムのうち、例とし
て、図5に二引数の加算、図6に大小比較、図7にゼロ
判定プログラムを示す。これらは、ユーザが用意する必
要はない。図5、図6、図7にある、type(x n
umber)は、xが有理数、浮動小数のとき、そのと
きに限り“true”を返すものである。Among the definition programs for the basic operation, FIG. 5 shows an example of adding two arguments, FIG. 6 shows a magnitude comparison, and FIG. 7 shows a zero determination program. These do not need to be prepared by the user. The type (xn) shown in FIGS.
“umber” returns “true” only when x is a rational number or a floating point number.
【0021】また、図5、図6、図7に存在する、 add2.n, larger.n, zero.n, の「.」は、文字列の連結を表すものであり、例えば、
図5の場合、“n”が文字列「interval」であ
るとき、「add2.n」は「add2interva
l」を表す。Further, there are add2. n, large. n, zero. "." in n, represents a concatenation of character strings. For example,
In the case of FIG. 5, when “n” is a character string “interval”, “add2.n” is “add2interva”.
l ".
【0022】さらに、図6にある“evalb(x>
y)”,図7にある“evalb(x=0)”は、それ
ぞれ、x>y、x=0を評価した結果の真偽、即ち、
「true」あるいは、「false」を返す関数であ
る。新しい型の定義に伴って、ユーザは元々数式処理シ
ステムに定義されている型から新しく定義する型への変
換をするプログラム、及び、図4に現れる基本演算を定
義するプログラムを用意する。ここでは、例として、図
8に型変換のプログラム、図9に二引数の加算add2
を定義するプログラム、図10に大小比較を定義するプ
ログラム、図11にゼロ判定のプログラムを挙げる。な
お、システムに元々定義されている以外の型について
は、リストを用いて表現し、その第1成分に型名、第2
成分にデータそのものを入れるものとする。Further, “evalb (x>” in FIG.
y) ”and“ evalb (x = 0) ”in FIG. 7 are true or false of the result of evaluating x> y and x = 0, respectively, ie,
It is a function that returns “true” or “false”. With the definition of the new type, the user prepares a program for converting the type originally defined in the mathematical processing system to the newly defined type, and a program for defining the basic operation shown in FIG. Here, as an example, FIG. 8 shows a type conversion program, and FIG. 9 shows a two-argument addition add2.
FIG. 10 shows a program for defining magnitude comparison, and FIG. 11 shows a program for zero determination. Note that types other than those originally defined in the system are represented using a list, and the first component has a type name,
It is assumed that the data itself is included in the component.
【0023】また、図8において、“evalfd
(x)”、“evalfu(x)”は、xの値を予め定
めておいた精度の浮動小数に変換するもので、交換の
際、“evalfd(x)”は、−∞丸め、“eval
fu(x)は、+∞丸めを行うものである。ここで、図
12、図14、図16のプログラムが与えられたとして
説明を行う。In FIG. 8, "evalfd
(X) ”and“ evalfu (x) ”convert the value of x into a floating-point number having a predetermined precision. In the case of exchange,“ evalfd (x) ”is obtained by rounding -∞ and“ evalfu (x) ”.
fu (x) performs + ∞ rounding. Here, description will be made assuming that the programs of FIGS. 12, 14, and 16 are given.
【0024】最初に加算を含む例について説明する。図
12に示す既存プログラムがプログラム入力部1から入
力され、構文解析部2、文法解析部3により、「a+
b」の部分が、図4(3.(a))に該当することが分
かる。変換規則4に従って、加算「+」のところを“a
dd2”という二引数の関数に書換え、図13に示すプ
ログラムに変換して出力する。First, an example including addition will be described. The existing program shown in FIG. 12 is input from the program input unit 1, and “a +
It can be seen that the portion “b” corresponds to FIG. 4 (3. (a)). According to conversion rule 4, the place of addition “+” is replaced by “a”.
dd2 "is converted to a two-argument function, converted into a program shown in FIG. 13, and output.
【0025】次に、条件分岐を含む例について説明す
る。図14に示す既存プログラムがプログラム入力部1
から入力され、構文解析部2、文法解析部3により、当
該プログラム中の「n>a」の部分が、変換規則4の図
4(10.(a))に該当することが分かる。当該変換
規則4に従って、変換部5により不等号「>」のところ
を“larger”という二引数の関数に書換え、図1
5に示すプログラムに変換して出力する。Next, an example including a conditional branch will be described. The existing program shown in FIG.
And the syntax analysis unit 2 and the grammar analysis unit 3 find that the part “n> a” in the program corresponds to FIG. 4 (10. (a)) of the conversion rule 4. According to the conversion rule 4, the conversion unit 5 replaces the inequality sign “>” with a two-argument function “larger”.
5 and output.
【0026】更に、繰り返し部分を含む例について説明
する。図16に示す既存プログラムがプログラム入力部
1から入力され、構文解析部2、文法解析部3により、
当該プログラム中の「for i from a by
s to b do...od」の部分が、変換規則
4(図4(17.(a))に該当することがわかる。従
って、当該変換規則4に従って、図17に示すプログラ
ムに変換して出力する。Further, an example including a repeated portion will be described. The existing program shown in FIG. 16 is input from the program input unit 1, and the syntax analysis unit 2 and the grammar analysis unit 3
"For i from a by" in the program
s to b do. . . It can be seen that the part “od” corresponds to the conversion rule 4 (FIG. 4 (17. (a)). Therefore, according to the conversion rule 4, the program is converted into the program shown in FIG.
【0027】なお、上記の実施例では、図3に示す装置
構成に基づいて説明しているが、この例に限定されるこ
となく、各構成要素をプログラムとして構築し、当該プ
ログラム変換装置を実現するコンピュータに接続される
ディスク装置や、フロッピーディスクやCD−ROM等
の可搬記憶媒体に格納しておき、本発明を実現する際に
インストールすることにより容易に実施することが可能
である。Although the above embodiment has been described based on the apparatus configuration shown in FIG. 3, the present invention is not limited to this example, and each component is constructed as a program to realize the program conversion apparatus. The present invention can be easily implemented by storing the program in a portable storage medium such as a disk device, a floppy disk, or a CD-ROM connected to a computer, and installing the program when implementing the present invention.
【0028】なお、本発明は、上記の実施例に限定され
ることなく、特許請求の範囲内において、種々変更・応
用が可能である。It should be noted that the present invention is not limited to the above-described embodiment, and various modifications and applications are possible within the scope of the claims.
【0029】[0029]
【発明の効果】上述のように、本発明によれば、数式処
理システムにおいて、新しい型を定義したとき、基本演
算部分、及び型変換用のプログラムのみを予め用意して
おけば、残りのプログラムは、本発明のプログラム変換
手段により変換するだけで、そのまま使用可能である。As described above, according to the present invention, when a new type is defined in a mathematical expression processing system, if only a basic operation part and a program for type conversion are prepared in advance, the remaining program Can be used as it is simply by conversion by the program conversion means of the present invention.
【0030】また、一度変換されたプログラムは、さら
に新しい型を定義したときも、そのまま使用することが
可能である。The program once converted can be used as it is even when a new type is defined.
【図1】本発明の原理を説明するための図である。FIG. 1 is a diagram for explaining the principle of the present invention.
【図2】本発明の原理構成図である。FIG. 2 is a principle configuration diagram of the present invention.
【図3】本発明のプログラム変換装置の構成図である。FIG. 3 is a configuration diagram of a program conversion device of the present invention.
【図4】本発明の一実施例のプログラムの変換規則の例
を示す図である。FIG. 4 is a diagram showing an example of a program conversion rule according to an embodiment of the present invention.
【図5】本発明の一実施例の予め定義されている変換規
則(二引数の加算を定義しているプログラム)の例であ
る。FIG. 5 is an example of a predefined conversion rule (a program defining addition of two arguments) according to an embodiment of the present invention.
【図6】本発明の一実施例の予め定義されている変換規
則(大小比較を行うプログラム)の例である。FIG. 6 is an example of a predefined conversion rule (program for comparing magnitude) according to an embodiment of the present invention.
【図7】本発明の一実施例の予め定義されている変換規
則(ゼロ判定プログラム)の例である。FIG. 7 is an example of a predefined conversion rule (zero determination program) according to an embodiment of the present invention.
【図8】本発明の一実施例の変換プログラムの例であ
る。FIG. 8 is an example of a conversion program according to an embodiment of the present invention.
【図9】本発明の一実施例の2つの区間数の加算を定義
するプログラムの例である。FIG. 9 is an example of a program for defining addition of two section numbers according to an embodiment of the present invention.
【図10】本発明の一実施例の2つの区間の大小比較を
行うプログラムの例である。FIG. 10 is an example of a program for comparing the size of two sections according to an embodiment of the present invention.
【図11】本発明の一実施例の区間数のゼロ判定を行う
プログラムの例である。FIG. 11 is an example of a program for performing zero determination of the number of sections according to an embodiment of the present invention.
【図12】本発明の一実施例のその一部の加算を含むプ
ログラムの例である。FIG. 12 is an example of a program including a part of the addition according to the embodiment of the present invention.
【図13】本発明の一実施例の図12を変換したプログ
ラムの例である。FIG. 13 is an example of a program obtained by converting FIG. 12 according to an embodiment of the present invention.
【図14】本発明の一実施例のその一部に条件分岐を含
むプログラムの例である。FIG. 14 is an example of a program including a conditional branch as a part of the embodiment of the present invention.
【図15】本発明の一実施例の図14を変換したプログ
ラムの例である。FIG. 15 is an example of a program obtained by converting FIG. 14 according to an embodiment of the present invention;
【図16】本発明の一実施例のその一部に繰り返し部分
を含むプログラムの例である。FIG. 16 is an example of a program including a repetition part in a part of one embodiment of the present invention.
【図17】本発明の一実施例の図16を変換したプログ
ラムの例である。FIG. 17 is an example of a program obtained by converting FIG. 16 according to an embodiment of the present invention;
【図18】区間数の基本演算の定義を示す図である。FIG. 18 is a diagram showing a definition of a basic calculation of the number of sections.
【図19】有理数あるいは浮動小数を係数とする一変数
多項式に対してL1 ノルムを計算するプログラムの例で
ある。FIG. 19 is an example of a program for calculating an L 1 norm for a one- variable polynomial having a rational or floating-point coefficient.
【図20】2つの区間数の加算を計算するプログラムの
例である。FIG. 20 is an example of a program for calculating addition of two sections.
【図21】区間数係数多項式のL1 ノルムを計算するプ
ログラムの例である。FIG. 21 is an example of a program for calculating an L 1 norm of a section number coefficient polynomial.
【図22】ユーザによる基本演算の再定義が不可能なと
きのオブジェクト指向風のプログラムの例である。FIG. 22 is an example of an object-oriented program when it is impossible for a user to redefine a basic operation.
1 プログラム入力手段、プログラム入力部 2 構文解析手段、構文解析部 3 文法解析手段、文法解析部 4 変換規則 5 変換手段、プログラム変換部 6 出力手段、出力部 DESCRIPTION OF SYMBOLS 1 Program input means, program input part 2 Syntax analysis means, syntax analysis part 3 Grammar analysis means, grammar analysis part 4 Conversion rule 5 Conversion means, program conversion part 6 Output means, output part
Claims (6)
定義に伴う既存プログラムの基本演算部分を変換するた
めのプログラム変換方法において、 前記既存プログラムを入力し、 入力された前記既存プログラムの構文解析を行い、 構文解析された前記既存プログラムについて文法解析を
行い、 既存の数式処理システムに定義されている型で計算可能
なプログラムを新しく定義される型でも計算可能とする
変換を行うためのプログラム変換規則を用いて、文法解
析された前記既存プログラムを新しく定義する型でも計
算可能となるよう変換し、出力することを特徴とするプ
ログラム変換方法。1. A program conversion method for converting a basic operation part of an existing program according to a definition of a new type in a mathematical processing system, wherein the existing program is input, and a syntax analysis of the input existing program is performed. A program conversion rule for performing a grammatical analysis on the parsed existing program and performing a conversion that allows a program that can be calculated in a type defined in an existing mathematical processing system to be able to calculate in a newly defined type is also provided. A program conversion method comprising: converting a grammatically analyzed existing program so that a newly defined type can be calculated; and outputting the calculated program.
に、 四則演算、大小比較、ゼロ判定のいずれかを含む請求項
1記載のプログラム変換方法。2. The program conversion method according to claim 1, wherein the basic operation to be converted by the conversion rule includes any of four arithmetic operations, magnitude comparison, and zero judgment.
定義に伴う既存プログラムの基本演算部分を変換するた
めのプログラム変換装置であって、 前記既存プログラムを入力するプログラム入力手段と、 入力された前記既存プログラムの構文解析を行う構文解
析手段と、 前記構文解析手段により構文解析された前記既存プログ
ラムについて文法解析を行う文法解析手段と、 既存の数式処理システムに定義されている型で計算可能
なプログラムを新しく定義される型でも計算可能とする
変換を行うための変換規則と、 前記変換規則を用いて文法解析された前記既存プログラ
ムを変換する変換手段と、 前記変換手段で変換されたプログラムを出力する出力手
段とを有することを特徴とするプログラム変換装置。3. A program conversion device for converting a basic operation part of an existing program according to a definition of a new type in a mathematical processing system, comprising: a program input means for inputting the existing program; Syntactic analysis means for analyzing the syntax of the program; grammatical analysis means for performing a grammatical analysis on the existing program parsed by the syntax analysis means; and a program which can be calculated in a type defined in the existing mathematical processing system. A conversion rule for performing a conversion that enables a newly defined type to be calculated, a conversion unit for converting the existing program grammatically analyzed using the conversion rule, and a program converted by the conversion unit. A program conversion device comprising output means.
に、 四則演算、大小比較、ゼロ判定のいずれかを含む請求項
3記載のプログラム変換装置。4. The program conversion device according to claim 3, wherein the conversion rule includes one of four arithmetic operations, a magnitude comparison, and a zero determination as basic operations to be converted.
定義に伴う既存プログラムの基本演算部分を変換するた
めのプログラム変換プログラムを格納した記憶媒体であ
って、 前記既存プログラムを入力させるプログラム入力プロセ
スと、 入力された前記既存プログラムの構文解析を行う構文解
析プロセスと、 前記構文解析プロセスにより構文解析された前記既存プ
ログラムについて文法解析を行う文法解析プロセスと、 既存の数式処理システムに定義されている型で計算可能
なプログラムを新しく定義される型でも計算可能とする
変換を行うためのプログラム変換規則を用いて文法解析
された前記既存プログラムを変換する変換プロセスと、 前記変換プロセスで変換されたプログラムを出力させる
出力プロセスとを有することを特徴とするプログラム変
換プログラムを格納した記憶媒体。5. A storage medium storing a program conversion program for converting a basic operation part of an existing program associated with a definition of a new type in a mathematical processing system, a program input process for inputting the existing program, A syntax analysis process for parsing the input existing program; a grammar analysis process for performing grammar analysis on the existing program parsed by the syntax analysis process; and a type defined in the existing mathematical processing system. A conversion process of converting the existing program that has been grammatically analyzed using a program conversion rule for performing a conversion that allows a computable program to be calculated even in a newly defined type; and outputting a program converted by the conversion process. Output process Storage medium storing a program transformation program.
演算に、 四則演算、大小比較、ゼロ判定のいずれかを含む請求項
4記載のプログラム変換プログラムを格納した記憶媒
体。6. A storage medium storing the program conversion program according to claim 4, wherein the basic operation to be converted in the conversion process includes any of four arithmetic operations, magnitude comparison, and zero determination.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2706698A JPH11224200A (en) | 1998-02-09 | 1998-02-09 | Program converting method, device therefor, and storage medium having stored program converting program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2706698A JPH11224200A (en) | 1998-02-09 | 1998-02-09 | Program converting method, device therefor, and storage medium having stored program converting program |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH11224200A true JPH11224200A (en) | 1999-08-17 |
Family
ID=12210708
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2706698A Pending JPH11224200A (en) | 1998-02-09 | 1998-02-09 | Program converting method, device therefor, and storage medium having stored program converting program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH11224200A (en) |
-
1998
- 1998-02-09 JP JP2706698A patent/JPH11224200A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3430252B2 (en) | Source code conversion method, recording medium recording source code conversion program, and source code conversion device | |
US5557774A (en) | Method for making test environmental programs | |
Kodaganallur | Incorporating language processing into java applications: A javacc tutorial | |
US20030016234A1 (en) | Implicit frame-based processing for block-diagram simulation | |
US20020066088A1 (en) | System and method for software code optimization | |
WO2009098739A1 (en) | Program optimization device and program optimization method | |
JP2974900B2 (en) | Autonomous evolution hardware design system | |
US6460177B1 (en) | Method for target-specific development of fixed-point algorithms employing C++ class definitions | |
JPWO2015159501A1 (en) | Verification property integration apparatus, verification property integration method, and verification property integration program | |
KR101130351B1 (en) | Generate speech recognition grammar for alphanumeric concepts | |
US7117490B2 (en) | Method and apparatus for doing program analysis | |
JP2879099B1 (en) | Abstract syntax tree processing method, computer readable recording medium recording abstract syntax tree processing program, computer readable recording medium recording abstract syntax tree data, and abstract syntax tree processing device | |
Corliss | Industrial applications of interval techniques | |
US6901360B1 (en) | System and method for transferring packed linguistic structures | |
JPH11224200A (en) | Program converting method, device therefor, and storage medium having stored program converting program | |
US9075630B1 (en) | Code evaluation of fixed-point math in the presence of customizable fixed-point typing rules | |
US7694283B2 (en) | Method and apparatus for generating specification data | |
JPH06348475A (en) | Pointer analyzing system | |
JP2005038212A (en) | Program conversion method, device, and program and storage medium storing program conversion program | |
JPH03260766A (en) | Translating device with parenthesis generation deciding function | |
JP2000148756A (en) | Translation error detecting device | |
Coors et al. | Integer code generation for the TI TMS320C62x | |
Harris et al. | Generation of Verification Artifacts from Natural Language Descriptions | |
JPH06195383A (en) | Knowledge base configuring system | |
JPH08286927A (en) | Assembler processing method |