JPS6244841A - Execution control system for logical type program - Google Patents

Execution control system for logical type program

Info

Publication number
JPS6244841A
JPS6244841A JP18312685A JP18312685A JPS6244841A JP S6244841 A JPS6244841 A JP S6244841A JP 18312685 A JP18312685 A JP 18312685A JP 18312685 A JP18312685 A JP 18312685A JP S6244841 A JPS6244841 A JP S6244841A
Authority
JP
Japan
Prior art keywords
predicate
variable
hook
bind
predicates
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.)
Granted
Application number
JP18312685A
Other languages
Japanese (ja)
Other versions
JPH0350296B2 (en
Inventor
Katsuto Nakajima
克人 中島
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.)
National Institute of Advanced Industrial Science and Technology AIST
Original Assignee
Agency of Industrial Science and Technology
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 Agency of Industrial Science and Technology filed Critical Agency of Industrial Science and Technology
Priority to JP18312685A priority Critical patent/JPS6244841A/en
Publication of JPS6244841A publication Critical patent/JPS6244841A/en
Publication of JPH0350296B2 publication Critical patent/JPH0350296B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To access one or more predicates registered for a variable on the basis of the substituting operation of values for a specific variably by controlling the access of chains and predicates in a stack area by a register included in a central processor. CONSTITUTION:A bind hook predicate having a function for accessing a predicate specified by the substituting operation of values for a specific variable to attain flexible programming is registered by executing a bind hook defined in a system. The 1st argument 'X' of the bind hook indicates the variable and the 2nd argument 'a(Y)' indicates the bind hook predicate for the variable X. At the access of a predicate (q), a value '1' is substituted for the variable X on the basis of the integrating processing of the argument with a section 13. Consequently, a predicate (a) is accessed by using a variable Y is its argument before the access of a predicate (r) and a section 14 is executed. Thus, the section 13 is executed as if it is a section 15.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、Prolog等の述語論理型プログラミング
言語で記述された論理型プログラムの実行制御方式に係
り、特にその拡張機能の実現に関するものである。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to an execution control method for a logic program written in a predicate logic programming language such as Prolog, and particularly relates to the implementation of extended functions thereof. .

〔従来の技術〕[Conventional technology]

述語論理型プログラミング言語としてProlog(P
rograming in Logic)と呼ばれるプ
ログラミング言語が知られている。この種のプログラミ
ング言語は、その名が示すように述語論理を基礎として
おり、その実行制御にパターン・マツチングやバックト
ラック等の他のプログラミング言語にはない高次の機能
が備えられているため、他の言語に較べてかなり柔軟な
プログラミングが可能となるという特徴を有している。
Prolog (P
A programming language called ``programming in Logic'' is known. As the name suggests, this type of programming language is based on predicate logic, and its execution control is equipped with higher-order functions not found in other programming languages, such as pattern matching and backtracking. It has the feature of allowing for much more flexible programming than other languages.

なお、上記言語が基礎にしている述語論理は、対象の性
質や対象間の関係を示す述語に含まれる変数が、対象の
みを指すことができる1駆込語論理である。
Note that the predicate logic on which the above language is based is a one-force logic in which a variable included in a predicate that indicates the nature of an object or the relationship between objects can refer only to an object.

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

ところで、この種プログラミング言語においては、さら
に柔軟なプログラミングを可能とするために、特定の変
数への値の代入操作がなされると前もって指定しておい
た述語を呼出す機能(以下、バインド・フック機能と呼
ぶ)が必要となる。しかしながら、当該プログラミング
言語が1駆込語論理を基礎にして開発された言語である
ため、変数が述語を指定することは本来許されず、バッ
クトラック等の機能を用いて実行効率を犠牲にすること
なしには、より柔軟なプログラミングを可能とすること
ができないという問題点を有していた。
By the way, in order to enable more flexible programming, this type of programming language has a function (hereinafter referred to as the bind hook function) that calls a prespecified predicate when a value is assigned to a specific variable. ) is required. However, since this programming language was developed based on one-stroke logic, it is originally not allowed for variables to specify predicates, and it is necessary to sacrifice execution efficiency by using functions such as backtracking. Without this, there was a problem that more flexible programming could not be achieved.

なお、バインド・フック機能は、値が代入される変数と
その時に呼出される述語を指定する、いわば「バインド
・フック述語の登録」という処理と、その変数に値が代
入された時に指定された述語の呼出しを実行する「バイ
ンド・フック述語の実行処理」の2段階の処理に分けて
実現される。
The bind hook function is a process called "registering a bind hook predicate," which specifies the variable to which a value is assigned and the predicate to be called at that time. This process is realized in two stages: ``bind hook predicate execution process'' that executes a predicate call.

そして、同一の変数に2つ以上のバインド・フック述語
の登録を指定したり、各々異なるバインド・フック述語
が登録済みの異なる変数間で統合(ユニフィケーション
とも称す)が行なわれる事によるこれらバインド・フッ
ク述語の併合があるため、バインド・フック述語の実行
処理時には2つ以上のバインド・フック述語の呼出しを
可能とする機構が必要となる。
These bind hooks can be created by specifying the registration of two or more bind hook predicates for the same variable, or by unifying (also called unification) between different variables for which different bind hook predicates have been registered. Because of the merging of predicates, a mechanism is required to enable invocation of two or more bind hook predicates during the execution process of bind hook predicates.

本発明は、上記のような問題点を解消するためになされ
たもので、通常時の論理型プログラムの実行処理速度へ
の影響をできるだけ少なく保ちつつ、前記のように1つ
の変数への値の代入に対して、2つ以上のバインド・フ
ック述語の呼出しを実行し、より柔軟なプログラミング
を可能とする論理型プログラム実行制御方式を提供する
ことを目的とするものである。
The present invention has been made in order to solve the above-mentioned problems.The present invention has been made in order to solve the above-mentioned problems. The object of the present invention is to provide a logical program execution control method that executes calls of two or more bind hook predicates in response to assignments and enables more flexible programming.

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

本発明に係る論理型プログラム実行制御方式は、論理型
プログラム実行処理装置の主記憶上に設けられたスタッ
ク領域に、同一変数に対して登録された1以上の述語の
登録情報を終端が接地された連鎖状に結合して格納する
とともに、その連鎖の始端へのポインタとその変数とを
格納し、上記スタック領域内の連鎖及び述語呼出しを当
該装置の中央処理装置内に備えられたレジスタを用いて
管理することにより、特定の変数への値の代入操作によ
り、その変数及びその変数と統合される異なる変数に対
してそれぞれ登録された1以上の述語の呼出しを行なう
ようにしたものである。
A logical program execution control method according to the present invention stores registration information of one or more predicates registered for the same variable in a stack area provided on the main memory of a logical program execution processing device, with the terminal end being grounded. At the same time, the pointer to the start of the chain and its variables are stored, and the chain and predicate calls in the stack area are stored using registers provided in the central processing unit of the device. By managing this, by assigning a value to a specific variable, one or more predicates registered for that variable and different variables integrated with that variable are called.

〔作用〕[Effect]

本発明においては、バインド・フック登録された変数に
論理型プログラムでの通常の実行手順に従って値を代入
しようとする時、スタック領域上のその変数セルの内容
がバインド・フック述語の登録情報へのポインタであっ
た場合には、そのポインタをレジスタに保存し、変数へ
の値の代入後、上記ポインタの指す登録情報をもとにバ
インド・フック述語を呼出し、起動する。この時、連鎖
上の次のバインド・フック述語の登録情報へのポインタ
は、今起動される述語の終了時の継続点情報としてそれ
用に用意されたレジスタに保存しておく。このようにし
て、登録されていたバインド・フック述語は接地点が発
見されるまで、1つずつ順に呼出され、すべて実行され
ていく。
In the present invention, when attempting to assign a value to a variable registered with a bind hook according to the normal execution procedure in a logical program, the contents of the variable cell on the stack area are assigned to the registration information of the bind hook predicate. If it is a pointer, the pointer is saved in a register, and after the value is assigned to the variable, the bind hook predicate is called and activated based on the registration information pointed to by the pointer. At this time, a pointer to the registration information of the next bind/hook predicate on the chain is saved in a register prepared for that purpose as continuation point information at the end of the currently activated predicate. In this way, the registered bind hook predicates are called one after another until a grounding point is found, and all are executed.

〔実施例〕〔Example〕

以下、本発明を実施例を図示して詳細に説明する。 Hereinafter, the present invention will be explained in detail by showing examples.

第1図は、Prologと呼ばれる述語論理型プログラ
ミング言語で記述された論理型プログラムでのバインド
・フック述語登録の記述例である。バインド・フック述
語の登録は、図中11で示すように、システム内部であ
らかじめ定義した組込述語“bind−hook ”を
実行する事で行なう事としている。この組込述語の第1
引数“X″が変数を、第2引数“a  (Y)  ”が
上記変数Xに対するバインド・フック述語を指している
FIG. 1 is a description example of bind hook predicate registration in a logic type program written in a predicate logic type programming language called Prolog. Bind-hook predicates are registered by executing a built-in predicate "bind-hook" defined in advance within the system, as shown at 11 in the figure. The first of this built-in predicate
The argument "X" indicates a variable, and the second argument "a (Y)" indicates a bind hook predicate for the variable X.

第1図の例では、節12の最後の述語qの呼出しにおい
て、節13との引数の統合(ユニフィケーション)処理
により変数Xに値“1”が代入される。その結果、節1
3の述語rの呼出し前に、バインド・フック述語aが変
数Yを引数として呼出される事になり、節14の実行と
なる。これは言い換えると、節13があたかも節15で
あったかの様に実行される事になる。ただし、述語aの
呼出し側引数Yは、節13における変数ではなく、節1
2の環境における変数である。
In the example of FIG. 1, in the last invocation of predicate q in clause 12, the value "1" is assigned to variable X through argument unification processing with clause 13. As a result, clause 1
Before calling predicate r in step 3, bind hook predicate a is called with variable Y as an argument, and clause 14 is executed. In other words, clause 13 will be executed as if it were clause 15. However, the caller argument Y of predicate a is not a variable in clause 13, but in clause 1
This is a variable in environment 2.

第2図は、第1図におけるバインド・フック述語の登録
と、その述語の起動方法に関する本発明の実施例であり
、同図(a)は組込述語“bind−hook ″の実
行直前、fblは実行直後、(Q)はバインド・フック
述語の起動直前、(d)は起動直後のスタック領域内の
状態をそれぞれ表わしている。図中21は前記処理装置
の主記憶1内に設けた変数の値保持用のスタック領域(
図中、下方がスタック・ボトム、上方がスタック・トッ
プ)であり、各述語呼出しごとに各節の変数の値(すだ
値が代入されていない事を示す“未定義語”の場合や、
他の変数セルへのポインタである場合などもある)を格
納する。
FIG. 2 shows an embodiment of the present invention relating to the registration of the bind hook predicate in FIG. 1 and the activation method of the predicate. FIG. (Q) represents the state in the stack area immediately after execution, (Q) represents the state immediately before the bind hook predicate is activated, and (d) represents the state in the stack area immediately after activation. In the figure, 21 is a stack area (21) for holding the values of variables provided in the main memory 1 of the processing device.
In the figure, the lower part is the stack bottom and the upper part is the stack top), and for each predicate call, the value of the variable in each clause (in the case of an "undefined word" indicating that no value has been assigned,
It may also be a pointer to another variable cell).

なお、変数セルとはスタック領域内の1ワ一ド分の領域
の事である。
Note that a variable cell is an area corresponding to one word in the stack area.

同図(alは、第1図の節12における組込述語“bi
nd−ho’ok ”の実行直前の状態例であり、変数
セルX、Yは節12における変数X、Yに対応している
。変数セルXば、この節の呼出し元の他の変数セル■へ
のポインタが格納されており、その変数セルVにはまだ
値が代入されていない事を示す“未定義語”が格納され
ているとする。
(al is the built-in predicate “bi” in section 12 of FIG.
This is an example of the state immediately before execution of ``nd-ho'ok'', and variable cells X and Y correspond to variables X and Y in clause 12. Variable cell Assume that a pointer is stored in the variable cell V, and an "undefined word" indicating that no value has been assigned yet is stored in the variable cell V.

同図(blば、第1図の節12における組込述語“bi
nd−hook ”の実行直後の状態であり、スタック
・トップには、バインド・フック述語aへのポインタ2
2.変数X、Yの環境即ち、節12の環境へのポインタ
23及び後述のフック・チェインのためのポインタ24
の3つの情報からなるバインド・フック制御ブロック2
5が積まれている。
In the same figure (bl, the built-in predicate “bi” in section 12 of Figure 1
This is the state immediately after execution of ``nd-hook'', and the top of the stack contains pointer 2 to bind hook predicate a.
2. A pointer 23 to the environment of variables X and Y, that is, the environment of clause 12, and a pointer 24 for the hook chain described below.
Bind/hook control block 2 consisting of three pieces of information:
5 is stacked.

同じ変数に対するバインド・フック述語群のチェイン(
以後フック・チェインと呼ぶ)のためのポインタ24は
、これ以前に変数Xに関してのバインド・フック述語が
無かったために接地(例えば値“0”)されている。ま
た、変数Xの真の値を格納する変数セルVは“未定義語
”からバインド・フック制御ブロック25へのボインク
ヘ変更されている。
A chain of bind hook predicates for the same variable (
The pointer 24 for the hook chain (hereinafter referred to as the hook chain) is grounded (eg, has the value "0") because there was no previous bind hook predicate for the variable X. Furthermore, the variable cell V that stores the true value of the variable X has been changed from an "undefined word" to a boink to the bind hook control block 25.

同図(C1は、第1図の節12の述語qの呼出しにより
節13が呼出された結果、変数Xに“1′が代入された
状態を示している。節13のヘッド引数との統合処理に
おいて、変数Xの真の値セルVをスタック領域21から
読み出し、同図+81におけるような“未定義語”であ
るならばそのままヘッド引数値である値“1”を代入す
べきところであるが、同図fb)に示すように値セル■
はバインド・フック制御ブロック25へのポインタとな
っているため、このポインタを論理型プログラム実行処
理装置内の中央処理装置(以後CPUと呼ぶ)2内のバ
インド・フック制御レジスタ26へ移し換えた後、変数
セルVへ値“I”を代入する。述語qの呼出しは、節1
3のすべてのヘッド引数の統合が可能であった場合に成
功し、通常なら節13の最初のゴールr (Z)の評価
を開始するわけであるが、本発明によると、評価前にバ
インド・フック制御レジスタ26を調べ、バインド・フ
ック制御ブロック25へのポインタが格納されているか
否かを見る。
The same figure (C1 shows a state in which “1” is assigned to variable X as a result of clause 13 being called by the call of predicate q in clause 12 in Figure 1. In the process, the true value cell V of the variable , as shown in figure fb), the value cell ■
is a pointer to the bind hook control block 25, so after transferring this pointer to the bind hook control register 26 in the central processing unit (hereinafter referred to as CPU) 2 in the logical program execution processing unit. , assigns the value "I" to variable cell V. The invocation of predicate q is clause 1
Normally, the first goal r (Z) in clause 13 would be evaluated, but according to the present invention, the binding The hook control register 26 is checked to see if a pointer to the bind hook control block 25 is stored.

同図(d+は、バインド・フック制御レジスタ26にバ
インド・フック制御ブロック25へのポインタを発見し
たため、バインド・フック述語aの呼出し準備を完了し
た状態である。制御ブロック25内にあったバインド・
フック述語aへのポインタ22と、節12の環境へのポ
インタ23は、バインド・フック述語aの呼出し処理等
のために、CPU2内の述語呼出し用アドレスレジスタ
27と呼出し用環境レジスタ2Bにロードする。フック
・チェイン用のポインタ24は接地されているので、こ
こでは説明を省略する。バインド・フック制御ブロック
25の情報を取り出した後、スタック・トップからバイ
ンド・フック制御ブロック25を取り除き、これを指し
ていたバインド・フック制御レジスタ26は値“O″な
どを入れて初期化してお(。このようにして、バインド
・フック述語aは第1図の節15のように実行する事が
出来る。なお、ゴールr (Z)の呼出しに関する情報
はバインド・フック述語aの実行終了時の継続点情報と
して、述語呼出し制御用のスタック(第2図には示さな
い)などに格納しておけば良い。
In the same figure (d+ is in a state where preparation for calling the bind hook predicate a is completed because a pointer to the bind hook control block 25 is found in the bind hook control register 26.
The pointer 22 to the hook predicate a and the pointer 23 to the environment of clause 12 are loaded into the predicate call address register 27 and the call environment register 2B in the CPU 2 for the call process of the bind/hook predicate a. . Since the hook chain pointer 24 is grounded, its explanation will be omitted here. After extracting the information of the bind hook control block 25, remove the bind hook control block 25 from the top of the stack, and initialize the bind hook control register 26 that was pointing to it with a value such as "O". (In this way, bind-hook predicate a can be executed as in section 15 of Figure 1. Note that the information regarding the invocation of goal r (Z) is stored at the end of execution of bind-hook predicate a. The continuation point information may be stored in a stack for predicate call control (not shown in FIG. 2) or the like.

第3図は、同じ変数Xに対して2つのバインド・フック
述語al、a2を登録した場合である。節31の2つの
bind−hook組込述語の実行後、第1図と同様に
述語qの呼出しを行なうと、節32が呼出され、ゴール
r (Z)が評価される前にバインド・フック述語al
、a2が共に節35のように呼出される事になる。
FIG. 3 shows a case where two bind hook predicates al and a2 are registered for the same variable X. After executing the two bind-hook built-in predicates in clause 31, when predicate q is called in the same way as in Figure 1, clause 32 is called and the bind-hook predicate is executed before goal r (Z) is evaluated. al
, a2 are both called as in clause 35.

第4図は、第3図での多重のバインド・フック述語の登
録と実行を本発明により実施した動作例である。
FIG. 4 is an operational example of the registration and execution of multiple bind hook predicates in FIG. 3 according to the present invention.

同図Talは第3図の節31の1つ目のbind−ho
ok組込述語の実行直前、(blはその実行直後の状態
例であり、前記第2図と同様となる。
Tal in the figure is the first bind-ho of node 31 in Figure 3.
Immediately before the execution of the ok built-in predicate, (bl is an example of the state immediately after its execution, which is the same as in FIG. 2 above.

同図rc+は2つ目のbind−hook組込述語の実
行直後の状態であり、(blにおける変数セルVから1
つ目のバインド・フック制御用ブロック41へのポイン
タの間に、2つ目のバインド・フック制御計用ブロック
42を挿入し、バインド・フック制御用ブロック間でチ
ェインを形成している。
rc+ in the same figure is the state immediately after the execution of the second bind-hook built-in predicate, (1 from variable cell V in bl)
A second bind/hook controller block 42 is inserted between the pointers to the first bind/hook control block 41 to form a chain between the bind/hook control blocks.

同図(dlは、変数X即ち変数セルVに値を代入した直
後の状態であり、バインド・フック制御用レジスタ26
にはバインド・フック制御用ブロック42へのポインタ
が格納されている。
In the same figure (dl is the state immediately after assigning a value to variable X, that is, variable cell V, and the bind/hook control register 26
A pointer to the bind/hook control block 42 is stored in .

同図felは、第3図の節32のヘッド引数の統合が終
了し、バインド・フック述語a2の呼出し準備が完了し
た状態である。ここでは、節32の最初のゴールr (
Z)はバインド・フック述語の終了後の継続点として、
すでに述語呼出し制御用スタック43 (ここでは主記
憶1上に設ける事にする)に格納されているものとし、
更に、述語a2の終了後の継続点情報として、述語a1
に関するバインド・フック制御ブロック41へのポイン
タを述語呼出し制御用スタック43に格納しておく。
fel is a state in which the integration of the head arguments in section 32 in FIG. 3 has been completed, and preparations for calling the bind hook predicate a2 have been completed. Here, the first goal r (
Z) is the continuation point after the end of the bind hook predicate,
Assume that it has already been stored in the predicate call control stack 43 (here, it will be provided on the main memory 1),
Furthermore, as continuation point information after the end of predicate a2, predicate a1
A pointer to the bind/hook control block 41 for the predicate call control stack 43 is stored in advance.

このようにして、同一変数に対する多重のバインド・フ
ック述語の処理を実現する事ができる。
In this way, processing of multiple bind hook predicates for the same variable can be realized.

なお、フック・チェイン上の最後のバインド・フック述
語の呼出しを準備する時、フック・チェインの先が接地
されている事から、この述語の終了後に本来のq (Z
)の呼出しへ処理を移行すべき事を知る事ができる。q
 (Z)への移行には、最後のバインド・フック述語の
呼出し時に、述語呼出し制御用スタック43上で最新の
継続点をq (Z)となるようにする方法や、最後のバ
インド・フック述語呼出し時にも接地されているフック
・チェインを継続点としてひとまず述語呼出し制御用ス
タック43へ積んでしまい、スタックから取り出した時
にこれを無視する方法などがある。
Note that when preparing to call the last bind hook predicate on the hook chain, since the end of the hook chain is grounded, the original q (Z
) can be used to know when processing should be transferred to a call. q
(Z), there is a method to set the latest continuation point on the predicate call control stack 43 to q (Z) when the last bind hook predicate is called, and There is a method in which a hook chain that is grounded at the time of a call is temporarily stacked on the predicate call control stack 43 as a continuation point, and then ignored when taken out from the stack.

第5図は、バインド・フック指定を受けた2つの変数が
統合され、その後、そのどちらかの変数への値の代入に
より、双方の変数に対応するバインド・フック述語が共
に実行される例である。
Figure 5 is an example in which two variables that have received bind hook specifications are integrated, and then, by assigning a value to one of the variables, the bind hook predicates corresponding to both variables are executed together. be.

節51の2つのbind−hook組込述語の実行によ
り、変数X、Yにそれぞれバインド・フック述語が指定
される。次に、節51から述語eの呼出しとして、節5
2との統合が行なわれると、呼出し側の変数X、Yの両
者間で、呼出された側の引数である変数Zを通じて統合
が行なわれる。そして、節51からの述語qの呼出しと
して、節53との統合が行なわれる事により、節51の
変数Xへの値“1”の代入がおこり、第3図と同様に節
53の最初のゴールr (Z)の評価前に、バインド・
フック述語a2.alが実行され、節53はあたかも節
56のようになる。
By executing the two bind-hook built-in predicates in clause 51, bind-hook predicates are specified for variables X and Y, respectively. Next, as an invocation of predicate e from clause 51, clause 5
When integration with 2 is performed, integration is performed between variables X and Y on the calling side through variable Z, which is an argument on the called side. Then, as predicate q is called from clause 51, integration with clause 53 is performed, and the value "1" is assigned to variable X of clause 51, and the first value of clause 53 is Before evaluating the goal r (Z), bind
Hook predicate a2. al is executed, and clause 53 becomes just like clause 56.

第6図は、第5図での異なる変数間での統合による多重
バインド・フック述語の実行を本発明により実現した場
合の動作例である。
FIG. 6 is an example of the operation when the execution of multiple bind hook predicates by integrating different variables in FIG. 5 is realized according to the present invention.

同図<a+は、第5図の節51において、2つのbin
d−hook組込述語の実行が終了した直後の状態であ
り、2つのバインド・フック制御用ブロック61.62
はそれぞれ節51の変数X、Yの真の変数セルv、Wと
それぞれ対応している。
In the same figure, <a+ means that two bins are
This is the state immediately after the execution of the d-hook built-in predicate is completed, and the two bind hook control blocks 61 and 62
correspond to true variable cells v and W of variables X and Y in node 51, respectively.

同図(b)は、第5図の節51において、述語eの呼出
しとして、節52を呼出し変数x、yの統合の結果、バ
インド・フック制御用ブロック61゜62が統合され、
フック・チェインが形成された状態である。バインド・
フック述語の実行方法等は第4図の(dl、 +e)と
同様である。
FIG. 5B shows that in node 51 of FIG. 5, as a call to predicate e, node 52 is called, and as a result of integrating variables x and y, bind hook control blocks 61 and 62 are integrated,
A hook chain has been formed. bind·
The method of executing the hook predicate is the same as (dl, +e) in FIG.

以上のように、バインド・フック制御用ブロックとその
ブロック間のチェインをスタック領域上に、また、バイ
ンド・フック制御用レジスタをCPU内に設ける事によ
り、多重のバインド・フック述語の実行を実現する事が
できる。更に、本発明による機構を処理するための実行
時オーバヘッドは、呼出された節のヘッド引数の統合が
すべて成功した場合に、バインド・フック制御レジスタ
の内容をチェックする事と、引数統合時に値セルの内容
がバインド・フック制御ブロックへのポインタであるか
否かをチェックする事の2点だけのオーバヘッドとなり
、本発明によるバインド・フック機能の実現は、その機
能を実現しない場合に較べ、実行速度の低下はわずかで
ある。
As described above, multiple bind/hook predicates can be executed by providing a bind/hook control block and a chain between the blocks on the stack area, and a bind/hook control register in the CPU. I can do things. Furthermore, the runtime overhead for processing the mechanism according to the invention consists of checking the contents of the bind hook control register if all head arguments of the called clause are successfully merged, and checking the contents of the bind hook control register when the arguments are merged. There is only the overhead of checking whether the content of is a pointer to a bind hook control block, and the implementation of the bind hook function according to the present invention is faster than the case where the function is not implemented. The decrease is slight.

なお、上記実施例においては第3図及び第5図をもとに
2重のバインド・フック述語の実行方法について説明し
たが、同一変数への3重以上のバインド・フック述語登
録や、それぞれが2重以上のバインド・フック述語登録
が行なわれている異なる変数間での統合によるバインド
・フック述語の統合なども、第4図、第6図と同様に行
なえる。
In addition, in the above embodiment, the method of executing double bind/hook predicates was explained based on FIG. 3 and FIG. Integration of bind hook predicates by integrating different variables for which bind hook predicates have been registered twice or more can also be performed in the same manner as in FIGS. 4 and 6.

また、第3図の節35および第5図の節56では2つの
バインド・フック述語の実行順序を、最: 後のbin
d−hook組込述語によるものを先に実行する事とし
て定めているが、第4図(C)あるいは第6図fblの
フック・チェイン形成時に、バインド・フックHill
 i卸フ゛ロックがスタック・ボトムからスタック・ト
ップに向けて順に並ぶようにチェインを形成すれば、バ
インド・フック述語の実行はスタック・ボトムから、つ
まり、bind−hook組込述語の実行が時間的に古
いものから実行される事になる。
Also, in section 35 of FIG. 3 and section 56 of FIG. 5, the execution order of the two bind hook predicates is set to
Although it is specified that the d-hook built-in predicate is executed first, when forming the hook chain in Figure 4 (C) or Figure 6 fbl, the bind hook Hill
If we form a chain in which the blocks are arranged in order from the bottom of the stack to the top of the stack, the execution of the bind-hook predicate will start from the bottom of the stack, which means that the execution of the bind-hook built-in predicate will be executed from the bottom of the stack. The oldest one will be executed first.

さて、これまでは、変数セル用のスタック領域21上に
バインド・フック制御用ブロックおよびそのチェインを
積む場合で説明したが、これらを変数セル用のスタック
領域21とは別に主記憶上に設けたスタック領域上で管
理する事としても、今までの説明には全く変わりはない
So far, we have explained the case where the bind/hook control block and its chain are stacked on the stack area 21 for variable cells, but it is also possible to provide these in main memory separately from the stack area 21 for variable cells. Even if it is managed on the stack area, there is no change in the explanation so far.

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

以上説明したように本発明によれば、論理型プログラム
実行処理装置の主記憶上に設けられたスタック領域に、
同一変数に対して登録された1以上の述語の登録情報を
終端が接地された連鎖状に結合して格納するとともに、
その連鎖の始端へのポインタとその変数とを格納し、上
記スタック領域内の連鎖及び述語呼出しを当該装置の中
央処理装置内に備えられたレジスタを用いて管理するこ
とにより、特定の変数への値の代入操作により、その変
数及びその変数と統合される異なる変数に対してそれぞ
れ登録された1以上の述語の呼出しを行なうようにした
ので、実行効率を犠牲にすることなく、より柔軟なプロ
グラミングを可能とすることができる論理型プログラム
実行制御方式を提供することができるという効果がある
As explained above, according to the present invention, in the stack area provided on the main memory of the logical program execution processing device,
The registration information of one or more predicates registered for the same variable is combined and stored in a chain whose terminal end is grounded, and
By storing a pointer to the start of the chain and its variable, and managing the chain and predicate calls in the stack area using registers provided in the central processing unit of the device, access to a specific variable can be made. By assigning a value, one or more predicates registered for that variable and different variables that are integrated with that variable are called, allowing for more flexible programming without sacrificing execution efficiency. The present invention has the advantage that it is possible to provide a logical program execution control method that enables the following.

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

第1図は組込述語bind−hookを含むProlo
gによって記述した論理型プログラム例、第2図は第1
図プログラム例に関する本発明の実施例、第3図は同一
の変数に対して組込述語bind−hookを複数回実
行するプログラム例、第4図は第3図プログラム例に関
する本発明の実施例、第5図は組込述語bind−ho
okが実行された変数同志が統合される場合のプログラ
ム例、第6図は第5図プロゲラム例に関する本発明の実
施例である。 1・・・主記憶、2・・・中央処理装置、21゜43・
・・スタック領域、26.27.28・・・レジスタ。 なお、図中間−又は相当部分には同一符号を用いている
Figure 1 shows Prolo with a built-in predicate bind-hook.
An example of a logical type program written using g, Figure 2 is the first
An embodiment of the present invention relating to a program example, FIG. 3 is an example program that executes the built-in predicate bind-hook multiple times for the same variable, and FIG. 4 is an embodiment of the present invention relating to the program example shown in FIG. Figure 5 shows the built-in predicate bind-ho
FIG. 6 is an example of a program in which variables for which OK has been executed are integrated. FIG. 6 is an embodiment of the present invention related to the program example shown in FIG. 1... Main memory, 2... Central processing unit, 21°43.
...Stack area, 26.27.28...Register. Note that the same reference numerals are used for the middle part of the figure or corresponding parts.

Claims (1)

【特許請求の範囲】[Claims] 述語論理型プログラミング言語で記述されたプログラム
を実行する論理型プログラム実行処理装置において、特
定の変数への値の代入操作により、その変数に対して予
め登録しておいた述語を呼出す機能を実現するにあたり
、当該装置の主記憶上に設けられたスタック領域に、同
一変数に対して登録された1以上の述語の登録情報を終
端が接地された連鎖状に結合して格納するとともに、そ
の連鎖の始端へのポインタとその変数とを格納し、上記
スタック領域内の連鎖及び述語呼出しを当該装置の中央
処理装置内に備えられたレジスタを用いて管理すること
により、特定の変数への値の代入操作により、その変数
及びその変数と統合される異なる変数に対してそれぞれ
登録された1以上の述語の呼出しを行なうようにしたこ
とを特徴とする論理型プログラム実行制御方式。
In a logical program execution processing device that executes a program written in a predicate logical programming language, by assigning a value to a specific variable, a function is realized that calls a predicate registered in advance for that variable. In this process, the registration information of one or more predicates registered for the same variable is stored in a stack area provided on the main memory of the device in a chain with the terminal end grounded, and the chain is Assign a value to a specific variable by storing a pointer to the start end and its variable, and managing the chain and predicate calls in the stack area using registers provided in the central processing unit of the device. 1. A logical program execution control system characterized in that an operation calls one or more predicates registered for a variable and a different variable integrated with the variable.
JP18312685A 1985-08-22 1985-08-22 Execution control system for logical type program Granted JPS6244841A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP18312685A JPS6244841A (en) 1985-08-22 1985-08-22 Execution control system for logical type program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP18312685A JPS6244841A (en) 1985-08-22 1985-08-22 Execution control system for logical type program

Publications (2)

Publication Number Publication Date
JPS6244841A true JPS6244841A (en) 1987-02-26
JPH0350296B2 JPH0350296B2 (en) 1991-08-01

Family

ID=16130250

Family Applications (1)

Application Number Title Priority Date Filing Date
JP18312685A Granted JPS6244841A (en) 1985-08-22 1985-08-22 Execution control system for logical type program

Country Status (1)

Country Link
JP (1) JPS6244841A (en)

Also Published As

Publication number Publication date
JPH0350296B2 (en) 1991-08-01

Similar Documents

Publication Publication Date Title
US6029207A (en) Apparatus and method for dynamic linking of computer software components
US5097533A (en) System and method for interfacing computer application programs written in different languages to a software system
JPH02272627A (en) Digital computer system and method of invocation of procedure of the same
EP1031925A2 (en) Cooperative processing of tasks in multi-threaded computing system
KR19990064026A (en) Object-oriented method maintenance mechanism that does not require the computer system or its program to be stopped
US20040123308A1 (en) Hybird of implicit and explicit linkage of windows dynamic link labraries
JPH09231077A (en) Method for reducing size of computer program
US7401335B2 (en) Single stack kernel
EP0417916B1 (en) Procedure state descriptor system for digital data processors
JPS6244841A (en) Execution control system for logical type program
US11520597B2 (en) Operating system architecture for microkernel generations support
Thomas Extensibility and reuse of object-oriented synchronization components
EP0803801A1 (en) Method and apparatus for mixing objective-C and C++ objects
Giering III et al. Using POSIX threads to implement Ada tasking: Description of work in progress
Johnsen et al. A dynamic binding strategy for multiple inheritance and asynchronously communicating objects
Henrio¹ et al. Active Objects with Deterministic
KR950005242B1 (en) Shared Variable Processing Method for CHILL Parallel Processing in General Operating System
JPH01307825A (en) System for executing dynamic link through interface module
JPS6324422A (en) Coexistence system for more than two kinds of access procedures in segment system computer
JPH06250828A (en) Library module management method
JPS6168643A (en) Extension system for interpreter type language function
JPS63163636A (en) Executing system for parallel processing
Teufel Procedures
JPH083792B2 (en) Function call processing method
JPH01191232A (en) External module acquiring system

Legal Events

Date Code Title Description
EXPY Cancellation because of completion of term