JPS62280935A - Program processing system - Google Patents

Program processing system

Info

Publication number
JPS62280935A
JPS62280935A JP12442186A JP12442186A JPS62280935A JP S62280935 A JPS62280935 A JP S62280935A JP 12442186 A JP12442186 A JP 12442186A JP 12442186 A JP12442186 A JP 12442186A JP S62280935 A JPS62280935 A JP S62280935A
Authority
JP
Japan
Prior art keywords
compiler
quaternion
source program
processing
program
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
JP12442186A
Other languages
Japanese (ja)
Inventor
Takeshi Yano
武 矢野
Toshiko Wakagi
若木 利子
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 JP12442186A priority Critical patent/JPS62280935A/en
Publication of JPS62280935A publication Critical patent/JPS62280935A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To improve the quality of calculated results by impressing a sientific and technical programming language capable of handling a four-dimensional numeric on a compiler capable of analyzing. CONSTITUTION:A source program 1 including newly expressed source program language 1a is inputted to a compiler 2. A vocabulary analysis part 3, a syntax analysis part 4 and a processing part 5 for giving meaning in the compiler 2 are equipped with corresponding processing means 3a-5a. What the vocabulary analysis part 3 hands in to the syntax analysis part 4 in the compiler 2 is a token string, and what the syntax analysis part 4 does to the processing part 5 for giving meaning is an analysis tree. The corresponding processing means 3a-5a sequentially process the source program. As a result, the programming language can be easily produced and the time required for compiling can be shortened.

Description

【発明の詳細な説明】 3、発明の詳細な説明 [概要] 四元数まで扱え、且つ記述性を高めたrFORTRAN
Jのような言語で記述したソースプログラムをコンパイ
ラに入力し、該コンパイラについて対応処理手段を各部
に具備していて、処理した結果中間コードを生成するプ
ログラム処理システムである。
[Detailed Description of the Invention] 3. Detailed Description of the Invention [Summary] rFORTRAN that can handle up to quaternions and has improved descriptive performance
This is a program processing system in which a source program written in a language such as J is input to a compiler, each part is equipped with a corresponding processing means for the compiler, and intermediate code is generated as a result of processing.

[産業上の利用分野] 本発明は電子計算機により科学技術計算を行うとき、四
元数まで扱えるようにしたrFORTRAN」のような
言語によるソースプログラムを入力する処理システムに
関する。
[Field of Industrial Application] The present invention relates to a processing system that inputs a source program written in a language such as "rFORTRAN" which can handle up to quaternions when performing scientific and technical calculations using an electronic computer.

rFORTRANJのような科学技術用プログラミング
言語ではその数値表現として複素数を取り扱うことは出
来るが、四元数を簡易に扱うことが出来ず、その手法を
開発することが要望されていた。
Although scientific and technological programming languages such as rFORTRANJ can handle complex numbers as numerical expressions, they cannot easily handle quaternions, and there has been a need to develop a method for doing so.

[従来の技術] 科学技術計算に適したrFORTRANJのような言語
によりコンパイラを介して電子計算機で演算処理を行う
ことは周知である。rFORTRAN」は算術計算など
の処理の中に含まれる手続きを、日常用いる表現に近い
形に整理して得た1つの言語体系であって、国際的な標
準言語となっている。
[Prior Art] It is well known that arithmetic processing is performed on an electronic computer via a compiler using a language such as rFORTRANJ, which is suitable for scientific and technical calculations. rFORTRAN is a language system that organizes the procedures involved in processes such as arithmetic calculations into a form that is similar to everyday expressions, and has become an international standard language.

rFORTRANJによる演算では算術的なものや文字
処理以外に、論理演算と複素数演算も可能である。一般
に計算処理に使われる理論やモデルをスカラ表現にアル
ゴリズム変換し、プログラミングしている。
In addition to arithmetic operations and character processing, rFORTRANJ allows logical operations and complex number operations. We program by converting theories and models commonly used in computational processing into scalar representations.

一方、人工衛星の姿勢表現や姿勢決定などの計算或いは
座標回転の計算に、「四元数」を用いると有効であるこ
とが判って来た。「四元数」とは言わば複素数を拡張し
て考えた数体系で、qと表すと、次のように定義できる
On the other hand, it has been found that it is effective to use a "quaternion" for calculations such as expressing and determining the attitude of an artificial satellite, or for calculating coordinate rotation. "Quaternion" is a number system that is an extension of complex numbers, and when expressed as q, it can be defined as follows.

石=χ+ξl+ηj+ζに =χ十q (ここでi、j、には三次元の直交基底を示す)四元数
の四則演算は次のようになる。即ち和’ Ql” q2
−(χ1+χ2)+(ξ、+ξ2)i+(η、+η、)
j+(ζ、+ζ2)k差:鯖−12=(χ1−χ2)+
(ξ1−ξ2) 1+(η、−η2)j+(ζ、−ζユ
)k積:ql・q2=〔χ、χ2−(ξ1ξ2+η1η
2+ζ、ζ2)]+  [χ、ξ2+ χ2ξ1+ η
1 ξ2− η2ζ1コ  i+[χ1η2+η1χ2
+ζ、ξ2−ζ2ξ1]j+[χ、ζ2+χ2ζ1+ξ
、η2−ξ2η、] k=(χ1χ2  ’ Qj”1
2〉” χiqz” ”zoq、+ q+ x (12
〜・−(1) ただしく q、、q2>はスカラ積、q、xq2はベク
トル積を表す。(1)式はi、j、にで示される基底の
間に次の関係があるものとして導出される。
Stone = χ + ξl + ηj + ζ = χ1q (Here, i and j represent three-dimensional orthogonal bases.) The four arithmetic operations of quaternions are as follows. That is, the sum 'Ql'' q2
−(χ1+χ2)+(ξ, +ξ2)i+(η, +η,)
j + (ζ, +ζ2) k difference: mackerel - 12 = (χ1 - χ2) +
(ξ1−ξ2) 1+(η, −η2)j+(ζ,−ζyu) k product: ql・q2=[χ, χ2−(ξ1ξ2+η1η
2+ζ, ζ2)]+ [χ, ξ2+ χ2ξ1+ η
1 ξ2− η2ζ1ko i+[χ1η2+η1χ2
+ζ,ξ2−ζ2ξ1]j+[χ,ζ2+χ2ζ1+ξ
, η2−ξ2η, ] k=(χ1χ2 'Qj”1
2〉"χiqz""zoq, + q+ x (12
~・-(1) where q, , q2> represent a scalar product, and q and xq2 represent a vector product. Equation (1) is derived assuming that the following relationship exists between the bases denoted by i, j, and i.

従って四元数は可換ではない。Therefore quaternions are not commutative.

逆:1=qン(N (q))2 ノルム−1の四元数qに対応する座標回転行列従来のr
FORTRANJによるプログラム言語の作成において
、定義される数として四元数を扱えばプロセッサの処理
能力に与える影響の小さいことが予測され、検討されて
来た。
Inverse: 1=qn(N (q))2 Coordinate rotation matrix corresponding to the quaternion q of norm-1 Conventional r
In creating the FORTRANJ programming language, it has been predicted and studied that if quaternions are treated as defined numbers, the effect on the processing performance of the processor will be small.

[発明が解決しようとする問題点] 前述のようにrFORTRANJ言語により複素数演算
を行うとき、理論をスカラ表現しているため、四元数を
扱う場合も、当然その変換作業が発生する。そのとき四
元数表現をわざわざスカラ表現にしているため、変換作
業上のエラーを起こし易く、ブーグラムをチェックする
とき余分に時間がかかる欠点があった。例えばrFOR
TRAN」を使用するプログラムを第9図に示す。第9
図は主ルーチンと掛は算を行うサブルーチンとを示して
いるが、ここではコメントを除き計22ステップを要し
ていた。
[Problems to be Solved by the Invention] As mentioned above, when performing complex number operations using the rFORTRANJ language, the theory is expressed in scalar form, so naturally, when dealing with quaternions, conversion work is required. At that time, the quaternion representation was purposely changed to a scalar representation, which had the disadvantage that errors were likely to occur during the conversion process, and it took extra time to check the boograms. For example rFOR
A program using "TRAN" is shown in FIG. 9th
The figure shows a main routine and a subroutine for multiplication, which required a total of 22 steps, excluding comments.

し問題点を解決するための手段] 本発明はプログラミング言語について、前述の定義によ
る「四元数演算」を容易なものとするように、言語作成
に拡張手段を行い、新たなプログラミング言語の表現と
する。第1図は本発明の原理構成を示す図であって、第
1図の1はrFORTRANJのようなソースプログラ
ムを示す。本発明において新たな表現を可能とした部分
をハンチングして1aと示す。即ちソースプログラムと
して四元数の宣言骨とその算術式・代入分・組み込み関
数を含んで表現する。
[Means for Solving the Problems] The present invention provides a means for extending the programming language so as to facilitate the "quaternion operation" as defined above, and creates a new expression for the programming language. shall be. FIG. 1 is a diagram showing the basic configuration of the present invention, and 1 in FIG. 1 indicates a source program such as rFORTRANJ. In the present invention, a portion that allows new expression is indicated by hunting and indicated as 1a. That is, it is expressed as a source program including the declaration bones of the quaternion, its arithmetic expressions, substitutions, and built-in functions.

次に新たな表現のプログラム言語1aを含むソースプロ
グラム1を、下記構成のコンパイラ2に入力する。コン
パイラ2における語党解析部3・構文解析部4・意味付
は処理部5には前記ソースプログラムについて対応処理
する手段3a、4a。
Next, the source program 1 including the new expression programming language 1a is input to the compiler 2 having the following configuration. The word parsing section 3, syntactic analysis section 4, and meaning processing section 5 in the compiler 2 include means 3a and 4a for correspondingly processing the source program.

5aを具備している。コンパイラ2において語党解析部
3から構文解析部4へ渡されるものはトークン列であり
、構文解析部4から意味付は処理部5へ渡されるものは
解析木と言われている。
5a. In the compiler 2, what is passed from the word party analysis section 3 to the syntax analysis section 4 is a token string, and what is passed from the syntax analysis section 4 to the semantic processing section 5 is called a parse tree.

[作用] 四元数演算が可能となるようにプログラミング言語作成
について拡張し、得られたソースプログラムをコンパイ
ラに入力する。このときコンパイラは語党解析部・構文
解析部・意味付は処理部におけるソースプログラムに対
する処理を、それぞれ対応処理手段3.4a、5aにお
いて順次行う。
[Operation] Expand programming language creation to enable quaternion operations, and input the resulting source program to a compiler. At this time, the compiler sequentially processes the source program in the word parsing section, syntactic analysis section, and meaning processing section in the corresponding processing means 3.4a and 5a, respectively.

その結果プログラミング言語作成が容易で、且つコンパ
イラにおける処理も短時間で済む。
As a result, it is easy to create a programming language, and processing by a compiler can be completed in a short time.

[実施例] (1) プログラミング言語について rFORTRANJ言語についてデータの型として、従
来の文字型、論理型、複素数型、倍精度実数型の外に四
元散型を追加する。四元散型のデータは16バイトの記
憶領域を占有する。(前述の定義によるスカラ部が4バ
イト、ベクトル部が各部4バイトである)。
[Embodiment] (1) Regarding the programming language Regarding the rFORTRANJ language, a quaternary distributed type is added as a data type in addition to the conventional character type, logical type, complex number type, and double precision real number type. Quaternary distributed data occupies 16 bytes of storage space. (As defined above, the scalar part is 4 bytes, and the vector part is 4 bytes each).

次に四元数定数を複素定数の拡張の形式で追加すの場合
四元数定数はプログラミング言語上(0,866、0,
5,0,5,0,5)として表現する。
Next, when adding a quaternion constant in the form of a complex constant extension, the quaternion constant is defined in the programming language (0,866, 0,
5,0,5,0,5).

次に型宣言文を定める。rFORTRANJの型宣言文
は一般に次の形式となっている。
Next, define the type declaration statement. The rFORTRANJ type declaration statement generally has the following format.

type  [1m  (、]  コ 、  name
  [、namel  −ここでr typeJは以下
の型指定であるから、ここにrQUA’TERN1ON
Jを追加する。従来の型指定はINTEGERLOGI
CAL REAL      DOUBLE−PRECISIO
NCOMPLEX    CHARACTIERである
type [1m (,] ko, name
[, name - Here r typeJ is the following type specification, so here rQUA'TERN1ON
Add J. The conventional type specification is INTEGERLOGI
CAL REAL DOUBLE-PRECISIO
NCOMPLEX CHARACTIER.

typeがQUATERN IONの場合、前記形式ニ
オケルmは長さを指定するので・16 nameは四元散型の変数名、関数名を示す。
When type is QUATERN ION, the format Niokel m specifies the length, so 16 name indicates the variable name or function name of the quaternary distributed type.

また四元数の四則演算に用いる算術演算子は+ 加算 −減算 * 乗算 であって/(除算)、**(べき乗)は使用しない。Also, the arithmetic operator used for the four arithmetic operations on quaternions is + addition −Subtraction * Multiplication / (division) and ** (power) are not used.

算術化行文について述べると、一般にrFORTRAN
jではy=eと書き、yは値を代入するための変数名で
あり、eは算術式である。ここでyに四元散型演算の算
術式を許す。また組込み関数として次記3種の組込み関
数を用意する。
When talking about arithmetic statements, rFORTRAN
j is written as y=e, where y is a variable name to which a value is assigned, and e is an arithmetic expression. Here, y is allowed to be an arithmetic expression of a four-dimensional distributed operation. In addition, the following three types of built-in functions are prepared as built-in functions.

ノルム値:NLM (Q) −四元数Qのノルムを計算 共役:  C0NJ(Q)−四元数Qの共投数を計算 逆:   INVQ (Q)、−・四元数Qの逆(2)
プログラミング言語の構文について四元数を扱う場合は
次のようになる。
Norm value: NLM (Q) - Calculate the norm of quaternion Q Conjugate: C0NJ (Q) - Calculate the co-casting number of quaternion Q Inverse: INVQ (Q), - Inverse of quaternion Q (2 )
The syntax of a programming language when dealing with quaternions is as follows.

イ、定数の定義: <C0N5TANT>→<INTEGER>  <RE
AL>   −・・−<QUATERNION> <QtlATERNION>→ “  (“  <RE
AL>   ” 、  ”(REAL>”。
B. Definition of constants: <C0N5TANT> → <INTEGER><RE
AL>-...-<QUATERNION><QtlATERNION>→ “ (“ <RE
AL>”, ”(REAL>”.

“<REAL>”、”<REAL>”  )   ″こ
こでく〉は非終端記号、“は終端記号を示す。
"<REAL>", "<REAL>") "Here," indicates a non-terminal symbol, and " indicates a terminal symbol.

口、型宣言、  <TYPE>→” INTEGER″
“IIEAL”C0MPLEX″“QUATERNIO
N” ”LOGICAL”“DOUBLEPRECIS
ION”“CHARACTER”ハ、算術式<ARIT
)l−OP>−<ARITH> <ARIT)I−QU
AT><ARITH−QUAT>→<Q> <Q>→<Q>“+”<T> <Q>→〈T〉 <Q>→<Q>“−”<T> <T>→<T>“本”<F> <T>→<F> <F>→”(”<g>″)11 <  F  > →<QLIATERNION>   
<QVAL><QBUILD−IN> 二1代入文: <ARITH−^SS IGNMENT>→従来のもの
<QVAL>−’<ARITH−QUAT>ホ1Mi込
み関数: (QBUILD−IN>  −”NLM’“C”<F>
四元数の演算文法をGとすると G=(V、J、V工、S、P) ここで非終端記号の集合VN= (S、Q、T、F )
終端記号の集合 ■ア” (qttj−>*、(3))
なお開始記号をS、生成規則の集合をP四元数の四則演
算は下記の生成規則でその構文が定義できる。
Mouth, type declaration, <TYPE>→” INTEGER”
“IIEAL” C0MPLEX” “QUATERNIO”
N” “LOGICAL” “DOUBLE PRECIS
ION” “CHARACTER” c, arithmetic expression <ARIT
)l-OP>-<ARITH><ARIT)I-QU
AT><ARITH-QUAT>→<Q><Q>→<Q>"+"<T><Q>→<T><Q>→<Q>"-"<T><T>→<T >“Book”<F> <T>→<F> <F>→”(”<g>”)11 <F> →<QLIATERNION>
<QVAL><QBUILD-IN> 21 Assignment statement: <ARITH-^SS IGNMENT> → Conventional one <QVAL>-'<ARITH-QUAT> E1Mi included function: (QBUILD-IN>-"NLM'"C”<F>
If the arithmetic grammar of quaternions is G, then G = (V, J, V, S, P), where the set of nonterminal symbols VN = (S, Q, T, F)
Set of terminal symbols ■A” (qttj−>*, (3))
The starting symbol is S, and the set of production rules is P. The syntax of the four arithmetic operations on quaternions can be defined by the following production rules.

S→Q#1 Q−hQ+T#2 Q−Ta2 Q−Q−Ta2 Q→−Ta5 T−4T*F#6 T→F#7 F→ (Q)          # 8F=   C
1t          #9(3)コンパイラにおけ
る処理について第2図は四元数表現をしたプログラム例
を示し、四元数の乗算を行う場合である。21と示すプ
ログラムにより僅か2ステ・ノブで記述したもので、前
述の従来技術第9図に示すプログラムと同様の処理がで
きる。
S→Q#1 Q-hQ+T#2 Q-Ta2 Q-Q-Ta2 Q→-Ta5 T-4T*F#6 T→F#7 F→ (Q) # 8F= C
1t #9 (3) Processing in the compiler FIG. 2 shows an example of a program expressed as a quaternion, in which quaternion multiplication is performed. 21, which is written using only two steps and knobs, can perform the same processing as the program shown in FIG. 9 of the prior art described above.

イ8語雪解析部の動作 第3図に示すブロック図はコンパイラにおける一部の構
成を示す図である。所謂ソースプロゲラLf)<  Q
tlATERNION (Q1*Q2)*(0,0,%
、V’4)のようにrFORTRANJで記述した四元
数の算術演算式で入力したとする。語霊解析部41にお
いて、プログラムの当初の四元数宣言文を見て各種情報
表30の中の予約語表31により四元数による入力のさ
れたことを知り、次に変数名表32と定数表33につい
てその参照位置を限定参照する。そして語霊解析部41
は入力プログラムの文字列を一字毎に調べ、変数名表3
2からQlに対応する欄に記載されているコードid、
lを「トークン」として取出し、それを繰り返して得ら
れたトークン列を構文解析部42へ入力させる。即ちこ
のトークンは四元数の定数・変数・組込み関数のトーク
ン列となっている。
Operation of the 8-word snow analysis section The block diagram shown in FIG. 3 is a diagram showing a part of the structure of the compiler. So-called source progera Lf) < Q
tlATERNION (Q1*Q2)*(0,0,%
, V'4) is input using a quaternion arithmetic expression written in rFORTRANJ. The word analysis unit 41 looks at the initial quaternion declaration statement of the program and learns from the reserved word table 31 in the various information tables 30 that a quaternion has been input, and then reads the variable name table 32 and constants. The reference position of Table 33 will be referred to in a limited manner. And the word spirit analysis department 41
examines the character string of the input program character by character, and creates variable name table 3.
Code id written in the column corresponding to Ql from 2,
1 is taken out as a "token", and the token string obtained by repeating it is input to the syntax analysis unit 42. In other words, this token is a token string of quaternion constants, variables, and built-in functions.

口、構文解析部の動作 構文解析部42においては、前述のトークン列を入力し
プログラムの何の部分が文法の何の規則に対応するかを
解析し、その結果として解析木を生成する。第4図はL
Rパーザ方式による例を示す。第4図において、43は
構文解析表で四元数演算を定義する生成規則に基づき計
算されたものを内容とする。44はスタック、45は入
力レジスタ、46はドライバルーチンプログラムを示す
。算術式 %式%) を解析する場合、先ずL R(11であるから先読み記
号は1個であるとする。第4図に示す「ヘッド」が走査
している記号が先読み記号である。
Operation of the syntactic analysis unit The syntactic analysis unit 42 inputs the above-mentioned token string, analyzes which part of the program corresponds to which rule of the grammar, and generates an analysis tree as a result. Figure 4 is L
An example using the R parser method is shown below. In FIG. 4, 43 is a syntax analysis table whose contents are calculated based on production rules that define quaternion operations. 44 is a stack, 45 is an input register, and 46 is a driver routine program. When analyzing the arithmetic expression % expression %), first assume that there is one look-ahead symbol since L R (11).The symbol scanned by the "head" shown in FIG. 4 is the look-ahead symbol.

ドライバルーチン・プログラムはスタック44の頭部の
記号ステー)Smと、ヘッドによる先読み記号aiの対
より次に行うべき動作を構文解析表43から検索し、そ
の情報Gこ基づきスタック44に対するポツプ・ブツシ
ュやヘッドの左右への移動を行い、構文解析を進める。
The driver routine program searches the syntax analysis table 43 for the next operation to be performed based on the pair of the symbol Sm at the head of the stack 44 and the symbol ai read ahead by the head, and based on the information G, pops the button on the stack 44. and move the head left and right to proceed with parsing.

なおドライバルーチンのアルゴリズムはA、V、AhO
など著″Pr1nciple of Compiler
 Design″(^ddison−Wesley社発
行)に記載されている。
The algorithm of the driver routine is A, V, AhO.
Author: “Pr1nciple of Compiler”
Design'' (published by DDison-Wesley).

第5図は本発明により附加された対応処理手段の一つと
しての構文解析表43の具体的な例を示す図であり、第
6図は構文解析で得られた解析木の例を示す図である。
FIG. 5 is a diagram showing a specific example of a syntax analysis table 43 as one of the correspondence processing means added according to the present invention, and FIG. 6 is a diagram showing an example of a parse tree obtained by syntax analysis. It is.

第5図においてスタック44の最上位のステー)Smと
現在のヘッドがスキャンしている位置のトークン列の記
号aiとを読取り、第5図のアクション欄において対応
する(Sm、ai)を実行する。ここでSjとなってい
る場合例えばqt(四元数が到来していることを示す)
の櫂でスタックが工6のときS7となるから、「シフト
」動作を行い、スタックにai、5jをブツシュしヘッ
ドを1つ右へ移動させる。若しアクション(S m 。
In FIG. 5, the top stay of the stack 44) Sm and the symbol ai of the token string at the position currently being scanned by the head are read, and the corresponding (Sm, ai) is executed in the action column of FIG. . If Sj here, for example, qt (indicates that the quaternion has arrived)
When the stack is 6 with the paddle, it becomes S7, so perform the "shift" operation, push ai and 5j to the stack, and move the head one place to the right. If action (S m.

ai)がrjの場合、例えば )の欄でr3のとき還元
動作を行う。還元動作とは与えられた四元数の終端記号
から生成規則を見出すことをいう。生成規則番号jに対
する規則が A−β(ただしβの長さをrとする) のとき構文解析表のGOTO部より SmGOTOC3m  r、 A) を求めて、形状 (5OX1S1X2S2−− Xm−r Sm−rA 
S 、  at at、+  −−−an 4)にはい
る。
When ai) is rj, for example, a reduction operation is performed when r3 in the column ). Reduction operation refers to finding production rules from the terminal symbols of a given quaternion. When the rule for production rule number j is A-β (where the length of β is r), find SmGOTOC3m r, A) from the GOTO part of the parsing table and calculate the shape (5OX1S1X2S2-- Xm-r Sm-rA)
S, at at, +---an 4).

具体的にはスタックの上より2r個の記号をポツプする
と(β” Xm−r*+−・−料が成立っている)スタ
ックのトップにSm叶が現れ、パーザはステー1−Sm
ゴに遷移したことになる。そこで構文解析表45により
ステートSm−tにおけるGOTO部でAに対応するス
テートSを見つけ、スタックにASをブツシュする。(
したがってパーザはステートSに遷移した)。またアク
ション(Sm、ai)がアクセプトのとき構文解析は完
了する。アクション(Sm、at)がエラーのときエラ
ー回復ルーチンを呼び出す。
Specifically, if you pop 2r symbols from the top of the stack (β"
This means that it has transitioned to Go. Therefore, using the syntax analysis table 45, the state S corresponding to A is found in the GOTO portion of state Sm-t, and AS is pushed onto the stack. (
Therefore, the parser has transitioned to state S). Furthermore, when the action (Sm, ai) is accept, the syntactic analysis is completed. When the action (Sm, at) is an error, an error recovery routine is called.

第6図に示す構文木はしたがって下方のqtが与えられ
たとき、傍らに記しである#9. #7の生成規則によ
りqtをFに置換しく#9)、FをTに置換(#7)す
ることを意味する。これらを繰り返して、生成規則は#
 9−97−#1の順序で認識され、構文木を得ること
が判る。
The syntax tree shown in FIG. 6 is therefore given the lower qt, #9. The production rule #7 means replacing qt with F (#9) and replacing F with T (#7). By repeating these, the production rule is #
It can be seen that they are recognized in the order 9-97-#1 and a syntax tree is obtained.

ハ、意味付は処理 前述の構文解析により得られた解析木について、解析木
を構成している各生成規則(10〜11頁記載の#の数
字)に対応した意味付はアクションを起動して中間コー
ドを生成する。例えば意味付は処理の実行手法の一例と
して、四元数の算術式の意味付けを「シンタックス方向
付は変換方式」に基づいて行う。意味付は処理に使用す
る生成規則とアクション番号との対照表を第8図に示す
。例えば四元数の部分記号列Wに対しLRパーザがA−
XYZ −=wを認識したとき第4図に示すパーザの処
理は第7図に示す還元直前のスタックにおいて、そのス
タックを3個ポツプアップしXYZをAに還元するが、
この直前にA−XYZの規則に付けられているアクショ
ン番号αを実行して意味付は処理を行う。第7図では太
い矢印の右に還元直後のスタックを示している。なお第
8図において■、e、■の演算記号は3〜4頁に記載の
各式の左辺の+、−1*をそれぞれ置換し対応する右辺
の計算を行うことを意味する。またLEXVALは誘雷
解析で認識された四元数からなる値で四元数の属性を有
する。例えば第8図において VAL  (TOP 〕
= VAL (TOP ) 0VAL  (TOP−2
)はスタックの最上位の値と、上から二段目の値とを加
算して最上段の値と置換して意味付けした中間コードを
得ることを意味する。
C. Processing of semantics For the parse tree obtained by the syntactic analysis described above, the semantics corresponding to each production rule (# numbers listed on pages 10 to 11) that make up the parse tree can be added by activating an action. Generate intermediate code. For example, as an example of a processing execution method, meaning is assigned to an arithmetic expression of a quaternion based on a "syntax direction conversion method." FIG. 8 shows a comparison table of the production rules and action numbers used for the meaning processing. For example, for a subsequence W of a quaternion, the LR parser is A-
When recognizing XYZ -=w, the parser process shown in Figure 4 pops up three stacks in the stack immediately before reduction shown in Figure 7 and reduces XYZ to A, but
Immediately before this, the action number α attached to the A-XYZ rule is executed to give meaning. In FIG. 7, the stack immediately after reduction is shown to the right of the thick arrow. In FIG. 8, the operation symbols ■, e, and ■ mean that + and -1* on the left side of each equation described on pages 3 and 4 are replaced, respectively, and the corresponding right side is calculated. Further, LEXVAL is a value consisting of a quaternion recognized in the lightning analysis and has the attribute of a quaternion. For example, in Figure 8, VAL (TOP)
= VAL (TOP) 0VAL (TOP-2
) means to add the value at the top of the stack and the value at the second level from the top and replace it with the value at the top to obtain a meaningful intermediate code.

[発明の効果] このようにして本発明によると、四元数を扱うようにし
た科学技術用プログラミング言語を、四元数について解
析処理のできるコンパイラに印加して、容易に処理ので
きるシステムを得ている。そのため複雑な科学技術計算
を実行するとき従来よりソースリストが作り易くなるか
ら、後にチェックするときエラーが少なく、且つエラー
を見出すことを容易になる。したがって計算結果の品質
向上につながる効果を有する。
[Effects of the Invention] Thus, according to the present invention, a system that can easily process quaternions can be created by applying a scientific and technological programming language that handles quaternions to a compiler that can analyze and process quaternions. It has gained. Therefore, when performing complex scientific and technical calculations, it becomes easier to create a source list than before, which reduces errors and makes it easier to find errors when checking later. Therefore, it has the effect of improving the quality of calculation results.

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

第1図は本発明の原理構成を示す図、 第2図は四元数表現をしたプログラム例、第3図はコン
パイラにおける一部の構成を示す図、第4図は第1図中
の構文解析部における解析方式第5図は構文解析表を示
す図、 第6図は構文解析で得られた解析木の例を示す図、第7
図は意味付は処理用表を示す図、 第8図はスタックの変化を示す図、 第9図は従来のrFORTRANJを使用するプログラ
ムを示す図である。 1・−ソースプログラム 1a・・・本発明の表現を含む部分 2・−・コンパイラ 3−倍量解析部 4−構文解析部 5−意味付は処理部 3a、4a、5a・−4aについて対応処理する各部の
手段 特許出願人    富士通株式会社 代理人    弁理士  鈴木栄祐 第1図 四元葛りシシ辷キ見1ワミ月弓1グ弓 第2図 コンノズイラの構成図(−8μ) 第3図 LR(f )パーザ 第4図 第5図 1  (4H) 9を 解神木の例 第6図
Figure 1 is a diagram showing the principle configuration of the present invention, Figure 2 is an example of a program expressed as a quaternion, Figure 3 is a diagram showing a part of the configuration in a compiler, and Figure 4 is the syntax in Figure 1. Analysis method in the analysis section Figure 5 shows the syntax analysis table, Figure 6 shows an example of the parse tree obtained by syntax analysis, and Figure 7
The figure shows a processing table with meaning, FIG. 8 shows a change in the stack, and FIG. 9 shows a program using conventional rFORTRANJ. 1.-Source program 1a...Part including the expression of the present invention 2.--Compiler 3.-Double analysis section 4.Syntax analysis section 5.Semantic processing for processing sections 3a, 4a, 5a, -4a Means for each part Patent applicant Fujitsu Ltd. agent Patent attorney Eisuke Suzuki Figure 1 Four-gen kudzuri shishi leg view 1 Wami moon bow 1 Gu bow Figure 2 Construction diagram of Konnozuira (-8μ) Figure 3 LR ( f) Parser Figure 4 Figure 5 Figure 1 (4H) 9 Example of a tree Figure 6

Claims (1)

【特許請求の範囲】 語彙解析部(3)・構文解析部(4)・意味付け処理部
(5)で構成されるコンパイラ(2)に対しソースプロ
グラム(1)を入力して処理をさせ、中間コード(6)
を生成するプログラム処理システムにおいて、 ソースプログラム(1)は四元数の宣言文・算術式・代
入文・組み込み関数を含むプログラムとし、前記語彙解
析部・構文解析部・意味付け処理部には、前記四元数の
宣言文などを含むソースプログラムについて対応処理す
る手段(3a)(4a)(5a)をそれぞれ具備するこ
と を特徴とするプログラム処理システム。
[Claims] A source program (1) is input to a compiler (2) comprising a lexical analysis unit (3), a syntactic analysis unit (4), and a meaning processing unit (5), and the source program (1) is processed. Intermediate code (6)
In the program processing system that generates A program processing system characterized by comprising means (3a), (4a), and (5a) for correspondingly processing a source program including the quaternion declaration statement.
JP12442186A 1986-05-29 1986-05-29 Program processing system Pending JPS62280935A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP12442186A JPS62280935A (en) 1986-05-29 1986-05-29 Program processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP12442186A JPS62280935A (en) 1986-05-29 1986-05-29 Program processing system

Publications (1)

Publication Number Publication Date
JPS62280935A true JPS62280935A (en) 1987-12-05

Family

ID=14885064

Family Applications (1)

Application Number Title Priority Date Filing Date
JP12442186A Pending JPS62280935A (en) 1986-05-29 1986-05-29 Program processing system

Country Status (1)

Country Link
JP (1) JPS62280935A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0312235A2 (en) * 1987-10-13 1989-04-19 AT&T Corp. Graphics image editor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0312235A2 (en) * 1987-10-13 1989-04-19 AT&T Corp. Graphics image editor

Similar Documents

Publication Publication Date Title
Barron et al. The main features of CPL
Cameron et al. Grammar-based definition of metaprogramming systems
WO2001029698A9 (en) System and method to compile instructions to manipulate linguistic structures into separate functions
US7010476B2 (en) Method and apparatus for constructing finite-state networks modeling non-concatenative processes
EP0789885A2 (en) Method and apparatus for tree data structure manipulation and translating source code from one high-level computer language to another
Murena et al. Solving analogies on words based on minimal complexity transformation
Bennett A methodology for automated design of computer instruction sets
JPS6318458A (en) Method and apparatus for extracting feeling information
Zajac Feature structures, unification and finite-state transducers
Koskimies et al. The design of a language processor generator
JPS62280935A (en) Program processing system
KR20190037988A (en) Apparatus for analyzing compound nouns and method thereof, computer program
Jones et al. Mix: a self-applicable partial evaluator for experiments in compiler generation
Mu et al. Theory and applications of inverting functions as folds
JPH0833895B2 (en) Sentence generation processing method in machine translation system
JP3044463B2 (en) Data conversion method
Maurer et al. The use of combinators in translating a purely functional language to low-level data-flow graphs
Barthélemy A grammatical approach to DCG parsing
Morris et al. Intelligent natural language interface for a signal processing system
JPH0728821A (en) Text processor
JPH07200582A (en) Syntax analyzing system
JPS62269238A (en) Compiling system
Pretorius et al. Regular expressions: enabling the development of computational aids for Zulu natural language processing
Tseng Precedence grammars for compiler construction
Sestoft et al. From Concrete Syntax to Abstract Syntax