JPH0192836A - tree scanning method - Google Patents
tree scanning methodInfo
- Publication number
- JPH0192836A JPH0192836A JP62247815A JP24781587A JPH0192836A JP H0192836 A JPH0192836 A JP H0192836A JP 62247815 A JP62247815 A JP 62247815A JP 24781587 A JP24781587 A JP 24781587A JP H0192836 A JPH0192836 A JP H0192836A
- Authority
- JP
- Japan
- Prior art keywords
- subtree
- scanning
- node
- propagation
- information
- 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
Landscapes
- Devices For Executing Special Programs (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明は、節点間の属性伝播を伴なう木走査方法に関し
、特に、木を構成する節点情報の評価を、本走査前、あ
るいは本走査時に行うことが不可能である場合にも、木
走査の効率を向上することが可能な木走査方法に関する
。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a tree scanning method that involves attribute propagation between nodes. The present invention relates to a tree scanning method that can improve the efficiency of tree scanning even when it is impossible to perform tree scanning at the time of scanning.
木構造のデータを走査し、個々の節点への訪問類に、そ
の節点の情報に基づく処理をする方法は、コンパイラを
始めとする各種ソフトウェアにおいて、頻繁に用いらて
いる。A method of scanning tree-structured data and processing visits to individual nodes based on information about the nodes is frequently used in various software such as compilers.
この走査の対象となるデータは例えば、第10図のよう
に、その構成要素である節点201、および、節点20
1を結ぶ枝202とから構成される本構造200をなし
、さらに、この木構造200の節点201の中、最上部
にある節点を根と呼び、ある節点の下に他の接点が接続
されない場合、手の節点を葉と呼ぶ。また、枝202に
より接続された節点201同志の関係については1例え
ば、ある節点Xの直ぐ下に接続される節点yを、その節
点Xの子と呼び、節点Xを節点yの親と呼ぶ。The data to be scanned, for example, as shown in FIG.
The tree structure 200 has a main structure 200 consisting of branches 202 connecting the tree structure 200, and the node at the top of the nodes 201 of this tree structure 200 is called the root, and when no other contact is connected below a certain node. , the nodes of the hand are called leaves. Regarding the relationship between the nodes 201 connected by the branches 202, for example, a node y connected immediately below a certain node X is called a child of that node X, and the node X is called the parent of the node y.
さらに、親を共有する節点同志には順序関係があり、親
の節点Xの左端の子、および右端の子を、それぞれ節点
Xの長子、および末子と呼び、また。Furthermore, there is an order relationship between nodes that share a parent, and the leftmost child and rightmost child of the parent node X are called the eldest child and the youngest child of the node X, respectively.
節点Xの右隣りの節点を、節点Xの第と呼び、節点Xを
、その第に対し兄と呼ぶ。The node to the right of node X is called the node X's th node, and the node X is called the older brother of the node X.
なお、これらの節点は、木構造を構成するため、自分の
長子データの場所、および第データの場所を保持する。Note that since these nodes form a tree structure, they hold the location of their first-born data and the location of their first child data.
また、長子や第が存在しない節点は、それらの場所の代
りに特殊な値ニル(n i l)を保持する。Also, nodes where the eldest child or the th child does not exist hold a special value nil (n i l) in place of their location.
このような構造を持つ木を走査する場合、深さ優先探索
、すなわち、その木を根からスタートし。When traversing a tree with this structure, we use a depth-first search, that is, we start the tree from the root.
まず、一番人側にある子から順次下方に探索し、葉に到
達すると1つ親に戻って、当該葉の第がある場合には、
該第について探索を続け、ない場合には1つ親に戻る、
という探索によって1個々の接点に対して、該節点のす
べての子の訪問前に訪問する先順、子の訪問の中間に訪
問する中層、すべての子の訪問後に訪問する後順の全て
を含む順序で木走査を行い、その訪問順序に従い、逐次
的に該節点の訪問順序に対応したデータを配置する方法
がある6
例えば、第8図(a)のように、節点Rは3つの子を有
し、それぞれの子は、さらに、部分的木構造A−Cを有
する木構造に対して、上記の方法により、木走査を行っ
て逐次的にデータを配列すると、同図(b)のように、
部分的木構造A−Cの前の節点Rへの木走査(先順)の
結果Rz 、部分的木構造Aと部分的木構造Bとの間に
おける節点Rへの木走査(中層)の結果R2、部分的木
構造Bと部分的木構造Cとの間における節点Rへの木走
査(中層)の結果Ra、および1部分的木構造A−Cよ
り後の節点Rへの木走査(後順)の結果Raが、逐次配
置される。First, search downwards from the child closest to the person, and when a leaf is reached, return to the parent one step, and if there is a child in the leaf,
Continue searching for the corresponding number, and if there is no one, return to the parent,
This search includes, for each contact point, all of the destination order to be visited before visiting all the children of the node, the middle layer to be visited during the visit of the children, and the post-order to be visited after visiting all the children. There is a method of scanning the tree in order and sequentially arranging data corresponding to the visit order of the node according to the visit order.6 For example, as shown in Fig. 8(a), node R has three children. If the above method is used to perform a tree scan on the tree structure having the partial tree structure A to C and sequentially arrange the data, the result will be as shown in Figure (b). To,
Result Rz of tree scan (first order) to node R before partial tree structure A-C, result of tree scan (middle layer) to node R between partial tree structure A and partial tree structure B R2, the result Ra of the tree scan (middle layer) to the node R between the partial tree structure B and the partial tree structure C, and the tree scan (afterward) to the node R after the partial tree structure A-C. (order) results Ra are arranged sequentially.
従って、木走査において、現在本走査の対象となってい
る節点は、自分の子の総数+1個の状態を有する。この
状態が1節点についての走査段階であり、0から該節点
の子の総数までの整数により表現する。また1個々の節
点は、各走査段階における属性、すなわち、逐次的に配
置する内容R1〜R4、あるいは、それらの内容R1〜
R4を指示する情報を備える。Therefore, in tree scanning, the node currently targeted for main scanning has a state equal to the total number of its children plus one. This state is a scanning stage for one node, and is expressed by an integer from 0 to the total number of children of the node. In addition, each node has attributes at each scanning stage, that is, the contents R1 to R4 to be arranged sequentially, or the contents R1 to R4.
Information indicating R4 is provided.
このような木走査方法は、特に、本走査開始以前に、全
ての節点の属性の評価は低コストで行うことが可能な場
合、あるいは、本走査開始以前には困難であるが、本走
査時の訪問類に従い、個々の属性の評価が可能である場
合等について適用される。Such a tree scanning method is particularly useful when it is possible to evaluate the attributes of all nodes at low cost before the start of the main scan, or when it is difficult to evaluate the attributes of all the nodes before the start of the main scan, or This applies to cases where it is possible to evaluate individual attributes according to the type of visit.
しかし、節点同志が依存しあい、ある節点の属性評価の
ため、木全体を走査する必要がある場合、あるいは、属
性の評価に必要な情報が膨大であり。However, when the nodes depend on each other and it is necessary to scan the entire tree to evaluate the attributes of a certain node, or when the information required to evaluate the attributes is enormous.
−回の走査において、全ての節点の属性を配置すること
が不可能である場合等、個々の節点の属性の評価順序が
規定され、その評価順序と本走査における各節点への本
走査順序とが一致していない場合は、このような方法を
適用して各操作を行うことができない。- In cases where it is impossible to arrange the attributes of all nodes in one scan, the evaluation order of the attributes of each node is specified, and the evaluation order and the main scan order for each node in the main scan are If they do not match, each operation cannot be performed by applying such a method.
例えば、′アルゴリズム子データ構造=プログラム、N
、1tirth著2片山卓也訳、1979年1日本コン
ピュータ協会刊”に記載されている方法では、本構造の
根を出発点として木全体を走査し、個々の節点訪問的に
先順、中履、後順毎に処理を行っている。このため、−
回の走査で処理対象となる節点が限定されている場合、
その走査において、全く処理されない節点も含む木全体
に対する走査を繰り返す必要があった。For example, 'algorithm child data structure = program, N
In the method described in ``, 1st, 2, Translated by Takuya Katayama, 1979, 1, Published by Japan Computer Association'', the entire tree is scanned starting from the root of this structure, and each node is visited in order, Processing is performed for each subsequent order.For this reason, -
If the number of nodes to be processed in one scan is limited,
In this scan, it was necessary to repeatedly scan the entire tree, including nodes that were not processed at all.
上記従来技術では、−回の走査で処理対象となる節点が
限定されている場合、木全体を繰り返して走査するため
、処理の効率に問題があった。In the above-mentioned conventional technology, if the number of nodes to be processed in - times of scanning is limited, the entire tree is repeatedly scanned, which poses a problem in processing efficiency.
また1例えば1個々の節点を訪問したときの処理結果を
逐次構造に配置する場合等、処理対象が異なる節点の処
理同志が相互に干渉しあう場合については配慮がなされ
ず、このような場合に対する処理は容易でなかった。Also, no consideration is given to cases where processing of different nodes interfere with each other, for example, when processing results from visiting individual nodes are arranged in a sequential structure, and the The process was not easy.
特願昭61−280032では、このような問題点を改
善し、複数回の本走査を必要とする場合の処理効率を向
上することができ、また、各走査の処理結果が干渉しあ
う場合でも、正しい処理結果を得ることが可能な木走査
方法、および装置を提供するために、節点から構成され
た木構造データを蓄積する手段を備え、各節点は、その
木構造における走査段階を示す属性と、その属性の評価
順序を節点単位に規定する種別とを持ち、木構造データ
の各節点の走査段階に対応する属、性の評価結果を、メ
モリ上に深さ優先探索順に逐次的に並べる処理を、属性
の評価順序に従い1段階的に行う木走査装置において、
上記メモリは2個のメモリから構成され、上記種別が等
しく、連結した節点群を部分木として認識し、その部分
木の根の走査時に、部分木の開始位置、および終了位置
にあることを示す記号を、それぞれ、先順、および後順
に逐次的に並べ、部分木の中間に位置することを示す記
号を、その部分木の各葉において、その種別と異なる種
別の子の走査から戻った時点で、2個のメモリの一方に
、逐次的に並べる第1の処理を行う手段、該第1処理手
段により、各種別毎に逐次的に並べられたデータ列を探
索しながら、当該種別に属さない部分木の開始記号、中
間記号、および終了記号を、2個のメモリの他方に複写
し、当該種別に属する部分木の開始記号を発見すると、
その部分木走査の開始を指示し、中間記号、および終了
記号を発見すると、部分木走査の再開を指示する第2の
処理を行う手段、および、該第2処理手段の指示により
、当該種別に属する部分木の走査を行い、その部分木の
属性を該2個のメモリの他方に展開する第3の手段を備
え、第1処理手段により、該逐次データ列を該一方のメ
モリに展開し、第2処理手段により、逐次データ列を探
索し。Japanese Patent Application No. 61-280032 improves these problems and improves processing efficiency when multiple main scans are required, and even when the processing results of each scan interfere with each other. In order to provide a tree scanning method and apparatus capable of obtaining correct processing results, the method includes means for accumulating tree structure data composed of nodes, and each node has an attribute indicating the scanning stage in the tree structure. and a type that defines the evaluation order of the attributes on a node-by-node basis, and the evaluation results of attributes and properties corresponding to the scanning stage of each node of the tree structure data are sequentially arranged in the memory in depth-first search order. In a tree scanning device that performs processing in one step according to the evaluation order of attributes,
The above-mentioned memory is composed of two memories, which are of the same type, recognize a connected group of nodes as a subtree, and when scanning the root of the subtree, they write symbols indicating that they are at the start and end positions of the subtree. , respectively, are arranged sequentially in the preceding order and the subsequent order, and a symbol indicating the position in the middle of the subtree is placed in each leaf of the subtree, at the time of returning from scanning children of a type different from that type. means for performing a first process of sequentially arranging data in one of the two memories; the first processing means searches for data strings sequentially arranged for each type, and searches for data strings that do not belong to the type; When the start symbol, intermediate symbol, and end symbol of the tree are copied to the other of the two memories and the start symbol of the subtree belonging to the type is found,
means for instructing the start of the subtree scan, and upon finding an intermediate symbol and an end symbol, performing a second process for instructing the resumption of the subtree scan; a third means for scanning the subtree to which it belongs and expanding the attributes of the subtree to the other of the two memories; the first processing means expanding the sequential data string to the one memory; The second processing means sequentially searches the data string.
該第3処理手段は、第2処理手段の開始指示を受け、部
分木の走査を開始し、その種別と異なる種別の節点を検
出すると、走査を一時中断して、第2処理手段により、
再び、一方のメモリに格納された逐次データ列の探索を
行い、また、第3処理手段は、第2処理手段の再開指示
により、部分木走査を再開し、走査と並行して、当該種
別に属する部分木の属性を、他方のメモリ上に展開する
処理を行う。The third processing means receives the start instruction from the second processing means, starts scanning the subtree, and when detecting a node of a type different from that type, temporarily suspends the scanning, and the second processing means performs the following operations.
The sequential data string stored in one memory is searched again, and the third processing means resumes subtree scanning in response to the restart instruction from the second processing means, and in parallel with the scanning, searches for the relevant type. Performs processing to expand the attributes of the subtree to which it belongs onto the other memory.
上記従来技術は、複数回の本走査を必要とする場合の処
理効率を向上させることができるが、ある節点から祖先
への属性伝播が発生する際、伝播属性が生成される節点
とこれを参照する節点を評価するタイミングが異なる場
合について配慮されていない。The above conventional technology can improve processing efficiency when multiple main scans are required, but when attribute propagation occurs from a certain node to an ancestor, the node where the propagated attribute is generated and this reference No consideration is given to the case where the timing of evaluating nodes is different.
本発明の目的は、異なるタイミングで不走査が行なわれ
る場合にも属性を伝播することを可能とし、正しい結果
を得ることができるような本走査方法及び装置を提供す
ることにある。An object of the present invention is to provide a scanning method and apparatus that can propagate attributes even when non-scanning is performed at different timings and can obtain correct results.
上記目的は、木構造データにおける各節点において、あ
る伝播情報の伝播元或いは伝播先であるかどうかを識別
する情報を設けておき、部分木の認識を行ないながら2
個のメモリの一方に開始記号、中間記号、終了記号を逐
次的に並べる第1の処理の際に、その伝播情報の伝播元
と、最も上位の伝播先とをつなぐ経路の集合を伝播可能
領域として認識し、該領域探索時に伝播元の出現類に序
数を割りつけておき、該領域単位に伝播元の個数分の伝
播情報格納場所を確保してその場所情報を伝播可能領域
の根に格納する一方、部分木の根の走査時に同情報を開
始位置を示す記号に設定しておくことにより、部分木の
走査を行ないその部分木の属性を2個のメモリの他方に
展開する第3の処理の際に、まずその部分木の根に格納
されている伝播情報格納場所情報をとり出して部分木の
探索を行ない、伝播元節点到着の際、節点の属性評価結
果を伝播情報格納場所内の同節点の順序数に対応する位
置に設定し、伝播元節点到着の際、接点評価に必要な情
報を伝播情報格納場所から得ることにより、達成される
。The above purpose is to provide information to identify whether each node in the tree structure data is a propagation source or propagation destination of certain propagation information, and to
During the first process of sequentially arranging start symbols, intermediate symbols, and end symbols in one of the memories, a set of paths connecting the propagation source and the highest propagation destination of the propagation information is defined as the propagable area. When searching the area, assign an ordinal number to the occurrence class of the propagation source, secure a storage location for propagation information for the number of propagation sources for each area, and store the location information at the root of the propagable area. On the other hand, by setting the same information to a symbol indicating the start position when scanning the root of the subtree, the third process of scanning the subtree and expanding the attributes of the subtree to the other of the two memories can be performed. In this case, the propagation information storage location information stored in the root of the subtree is first retrieved and the subtree is searched, and when the propagation source node arrives, the attribute evaluation result of the node is searched for the propagation information storage location information of the same node in the propagation information storage location. This is achieved by setting the position corresponding to the ordinal number and obtaining the information necessary for contact evaluation from the propagation information storage location upon arrival at the propagation source node.
本発明においては、各走査の対象となる節点群を種別し
て色付けし、同じ個を持つ節点が連結した節点群を部分
木と見なして、その部分木を管理し、各部分木走査と管
理とがコル−チン的に呼び合う。In the present invention, the node group that is the target of each scan is classified and colored, the node group in which nodes having the same number are connected is regarded as a subtree, and the subtree is managed, and each subtree is scanned and managed. They call each other in a Korchin style.
すなわち、部分木の集まりは、個々の部分木の根を識別
子とする括弧構造として管理され、その部分木の集まり
を管理するため、−回の走査の間に、その括弧構造を複
写する。その複写中に、現在の種別の部分木が出現する
と、複写を中断して部分木の走査を開始し、括弧構造の
中に処理結果を反映させ1部分木の走査完了前に異種節
点に到達すると、該当部分の括弧構造の複写を続行する
。That is, a collection of subtrees is managed as a parenthesis structure with the root of each subtree as an identifier, and in order to manage the collection of subtrees, the parenthesis structure is copied during - times of scanning. During the copying, if a subtree of the current type appears, the copying is interrupted and scanning of the subtree is started, the processing result is reflected in the parenthesis structure, and the heterogeneous node is reached before the scanning of the first subtree is completed. Then, copying of the parenthesis structure of the corresponding part continues.
ある属性情報の伝播可能領域に複数の部分木が含まれる
とき、伝播元が評価した属性を格納する伝播情報格納場
所の場所情報を、伝播可能領域の根と同様に部分木の根
に予め格納しているので、伝播元を含む部分木の走査の
際に評価格納された伝播情報は、伝播情報格納場所を介
して伝播先を含む部分木の走査の際に伝播先に対して伝
播することが可能となる。When multiple subtrees are included in the propagable area of certain attribute information, the location information of the propagation information storage location that stores the attribute evaluated by the propagation source is stored in advance at the root of the subtree in the same way as the root of the propagable area. Therefore, the propagation information evaluated and stored when scanning the subtree containing the propagation source can be propagated to the propagation destination when scanning the subtree containing the propagation destination via the propagation information storage location. becomes.
以下1本発明の一実施例を図面により説明する。 An embodiment of the present invention will be described below with reference to the drawings.
第5図は1本発明の一実施例における節点、および部分
木の説明図、第6図は本発明の一実施例における逐次デ
ータ列の説明図である。FIG. 5 is an explanatory diagram of nodes and subtrees in one embodiment of the present invention, and FIG. 6 is an explanatory diagram of sequential data strings in one embodiment of the present invention.
本実施例における本走査方式では、予め、第5図(a)
のように、走査対象となる木を構成する節点の集合を、
各節点の評価順序によって分類し、その分類に対応して
1点線で分けられた部分集合を、その節点の種別A−C
とする。また、個々の節点は、各節点の属する種別の名
称を保持し、走査対象の木は、第5図(b)のように、
その種別A−Cに基づいて色付けされる。In the main scanning method of this embodiment, in advance, as shown in FIG. 5(a),
The set of nodes that make up the tree to be scanned is
Classify each node according to the evaluation order, and divide the subsets by one-dot lines according to the classification into the node types A-C.
shall be. In addition, each node retains the name of the type to which each node belongs, and the tree to be scanned is as shown in Figure 5(b).
It is colored based on its type A-C.
なお、木構造を構成する部分木については、下記の通り
定義する。Note that the subtrees that make up the tree structure are defined as follows.
(i)木全体の根、あるいは親の種別と異なる種別であ
る節点を、属する部分木の根とする。(i) The root of the entire tree, or a node whose type is different from the parent type, is set as the root of the subtree to which it belongs.
(n)ある部分木に属する節点の子の種別が、親の種別
と一致するとき、子はその部分木に属する。(n) When the type of the child of a node belonging to a certain subtree matches the type of the parent, the child belongs to that subtree.
(■)葉、あるいは、全ての子の種別が自分の種別と異
なる節点を、属する部分木の葉とする。(■) A leaf or a node whose type of all children is different from its own type is set as a leaf of the subtree to which it belongs.
従って、以上の定義により、第5図(b)のように、点
線で区切られた領域が、以上の定義による部分木を示す
、また、個々の部分木の根の場所により、各部分木を識
別する。Therefore, according to the above definition, as shown in FIG. 5(b), the areas separated by dotted lines indicate the subtrees according to the above definition, and each subtree can be identified by the location of the root of each subtree. .
更に節点属性評価時に、該節点の子孫の有する情報を参
照する必要のある場合がある。このような情報を伝播情
報と呼ぶ、伝播情報は、この値を定義する節点から、そ
れを参照する可能性のある先祖の節点にまで伝播される
。Furthermore, when evaluating node attributes, it may be necessary to refer to information held by descendants of the node. Such information is called propagation information, and the propagation information is propagated from the node that defines this value to the ancestor nodes that may refer to it.
伝播情報は幾つかの種類に分類され、伝播はこの種類別
に行なわれる。すなわちある伝播情報の定義と参照は、
伝播情報の種類名を指定することにより行なわれる。Propagation information is classified into several types, and propagation is performed for each type. In other words, the definition and reference of a certain propagation information is
This is done by specifying the type name of the propagation information.
一つの種類の伝播情報を定義する節点をその伝播情報の
伝播光、参照する節点を伝播先と呼ぶ。A node that defines one type of propagation information is called a propagation light of that propagation information, and a reference node is called a propagation destination.
一つの伝播元に対して祖先の伝播先は一般に複数個存在
しうる。又、伝播元も複数個存在し得る。Generally, there can be multiple ancestral propagation destinations for one propagation source. Also, there may be multiple propagation sources.
ある節点の一つの伝播情報の伝播可能な領域は、伝播元
から最も遠い祖先の伝播先までの経路である。又、一つ
の伝播情報の伝播可能な領域は、個々の伝播元について
の伝播可能な領域の集合であり、これを伝播可能領域と
呼ぶ、第7図に伝播可能領域の例を示す。伝播可能領域
は以下のように定義される木構造である。The propagable area of one propagation information of a certain node is the path from the propagation source to the propagation destination of the farthest ancestor. Further, the propagable area of one piece of propagation information is a set of propagable areas for individual propagation sources, and this is called a propagable area. FIG. 7 shows an example of the propagable area. The propagable area is a tree structure defined as follows.
(i)伝播元を葉とする。(i) Let the propagation source be a leaf.
(it)伝播先のうち最も上位の節点を根とする。(it) The highest node among the propagation destinations is set as the root.
(iii)先祖に伝播先がありかつ子孫に伝播元がある
節点はすべて該木構造に属する。(iii) All nodes whose ancestors have propagation destinations and whose descendants have propagation sources belong to the tree structure.
伝播可能領域は一般に(i)ある部分木に含まれる場合
、(if)複数の部分木に含まれる場合がある。(i)
の場合は、その部分木の走査時にのみ当該伝播情報の定
義、参照が行なわれる。(3i)の場合は、伝播情報の
定義を伴う走査とは異なる走査において当該伝播情報を
伝播する必要がある。In general, a propagable region may be (i) included in a certain subtree, or (if) included in multiple subtrees. (i)
In this case, the relevant propagation information is defined and referenced only when scanning that subtree. In the case of (3i), it is necessary to propagate the propagation information in a scan different from the scan that involves the definition of the propagation information.
伝播情報の定義を伴う走査は、これの参照を伴う走査よ
り先んじて行なわれる必要があり、各部分木の評価順序
はこの条件を満足するものとする。A scan involving the definition of propagation information must be performed before a scan involving the reference thereof, and the evaluation order of each subtree shall satisfy this condition.
このように対象となる木に色付けすると、まず、本走査
を行って、第6図(、)のように、逐次。When the target tree is colored in this way, the main scan is first performed, and the images are scanned sequentially as shown in Figure 6 (,).
走査した節点の場所、その節点の種別、および、その節
点と、その節点が属する領域の境界との位置関係を示す
マークにより1部分木を認識する。A partial tree is recognized by marks indicating the location of the scanned node, the type of the node, and the positional relationship between the node and the boundary of the area to which the node belongs.
ある伝播情報に関して初めて、或いは伝播元の子孫にお
いて初めての伝播元節点に到達したときこれをこの伝播
情報の伝播可能領域の根として認識し、伝播情報格納場
所の先頭アドレスを得て子孫の走査中、当該伝播可能領
域内にいるという情報とともに保ち続ける。又このとき
伝播元節点の数え上げのためのカウンタ値をOに設定し
ておく。When reaching a propagation source node for the first time for a certain propagation information, or for the first time in a descendant of a propagation source, this is recognized as the root of the propagable area for this propagation information, and the start address of the propagation information storage location is obtained while scanning the descendants. , along with the information that it is within the relevant propagation area. Also, at this time, a counter value for counting the propagation source nodes is set to O.
伝播可能領域内で当該伝播情報の伝播元に到達したとき
、当該伝播可能領域内にいるという情報及びカウンタ値
を節点情報として一時退避した後。When the source of the propagation information is reached within the propagation area, the information that the information is within the propagation area and the counter value are temporarily saved as node information.
同情報をリセットして子孫の走査を行なう、同伝播元に
後頭な到達すると同情報及びカウンタ値を復帰し、その
値を節点情報として格納した後、カウンタ値を+1して
おく。The same information is reset and the descendants are scanned. When the same propagation source is reached, the same information and the counter value are restored, and after storing the value as node information, the counter value is incremented by 1.
この場合、親−と異なる種別の節点においては。In this case, for nodes of a different type from the parent.
先順で、その節点を新しい部分木の節と認識し。The node is recognized as a node of a new subtree in the prior order.
伝播先より保持してきた伝播情報格納場所の先頭アドレ
ス、その節点の場所9種別、および、開始記号を保持す
るデータ(開始記号データ)を、逐次データ列の末尾に
配置する。The start address of the propagation information storage location held from the propagation destination, the nine types of locations of the nodes, and data holding the start symbol (start symbol data) are placed at the end of the sequential data string.
伝播可能領域の走査を終了し、該領域に戻った時点で、
伝播情報格納場所の先頭アドレスから、(伝播情報1単
位の寸法)×(カウンタ値)分の領域を該格納場所とし
て確保する。Upon finishing scanning the propagable area and returning to the area,
An area corresponding to (dimension of one unit of propagation information) x (counter value) from the start address of the propagation information storage location is secured as the storage location.
また、ある節点において、走査段階がi(i≧1)の場
合、第i子の種別が、その節点の種別と異なれば、種別
、および中間記号を保持するデータ(中間記号データ)
を、逐次データ列の末尾に配置する。In addition, when the scanning stage is i (i≧1) at a certain node, if the type of the i-th child is different from the type of that node, data holding the type and intermediate symbol (intermediate symbol data)
is placed at the end of the sequential data string.
さらに、ある部分木において、最後に出現する中間記号
データは末尾から削除し、その部分木の根においては、
後頭で、種別、および終了記号を保持するデータ(終了
記号データ)を逐次データ列の末尾に配置する。Furthermore, in a certain subtree, the intermediate symbol data that appears last is deleted from the end, and at the root of that subtree,
At the beginning, data holding the type and end symbol (end symbol data) is placed at the end of the sequential data string.
この認識により、第5図(b)に示した木構造から、第
6図(b)のような構成の逐次データ列を展開する。By this recognition, a sequential data string having a structure as shown in FIG. 6(b) is developed from the tree structure shown in FIG. 5(b).
こうして作成した逐次データ列は、第5図(b)の木を
、第6図(Q)のように、各種別A−Cを示す部分木を
単位とする木とすると、この木を第6図(d)のように
、括弧構造で表現することができる。従って、第6図(
b)の逐次データ列における開始記号、終了記号、およ
び中間記号は、それぞれ、この括弧構造の左括弧、右括
弧、および区切りに対応する。The sequential data string created in this way is, if the tree in Figure 5(b) is a tree whose units are subtrees indicating each type A-C, as shown in Figure 6(Q), this tree is the 6th tree. As shown in figure (d), it can be expressed using a parenthesis structure. Therefore, Fig. 6 (
The start symbol, end symbol, and intermediate symbol in the sequential data string in b) correspond to the left parenthesis, right parenthesis, and delimiter of this parenthesis structure, respectively.
また、この逐次データ列を初期逐次データ列と呼び、評
価順序を示す種別に従い、若い種別から順次、逐次デー
タ列の探索を行って、目的とする逐次データ列を得る。Further, this sequential data string is called an initial sequential data string, and sequential data strings are searched in order from the youngest type according to the type indicating the evaluation order to obtain a target sequential data string.
なお、第1回目の探索を行う種別については、初期逐次
データ列を原始逐次データ列と見なし、第2回目以降の
種別については、前回の目的逐次データ列を原始逐次デ
ータ列と見なす。Note that for the first type of search, the initial sequential data string is regarded as the primitive sequential data sequence, and for the second and subsequent types, the previous target sequential data sequence is regarded as the primitive sequential data sequence.
このような原始逐次データ列を探索し、目的逐次データ
列を展開する場合、まず、その原始逐次データ列の先端
から末尾までの逐次的な探索を行いながら、各データの
種別が目的とする当該種別と一致しなければ、そのデー
タを目的逐次データ列の末尾の配置する。When searching such a primitive sequential data string and developing a target sequential data string, first, while sequentially searching from the beginning to the end of the primitive sequential data string, each data type is If it does not match the type, the data is placed at the end of the target sequential data string.
その探索中に、当該種別と一致する開始記号データに到
達した場合、開始記号データ中の伝播情報格納場所の先
頭アドレスを含む開始指示データを作成し、そのデータ
の保持する節点の場所から部分木走査を開始し、当該種
別と異なる節点が出現して、その部分木走査を中断する
か、あるいは。During the search, if start symbol data matching the type is reached, start instruction data including the start address of the propagation information storage location in the start symbol data is created, and a subtree is created from the location of the node held by that data. Start scanning, a node different from the relevant type appears, and interrupt the subtree scanning, or.
その部分木走査が終了することを待った後、その次のデ
ータから探索を続行する。After waiting for the subtree scan to complete, the search continues from the next data.
また、その探索中に、当該種別と一致する中間記号デー
タ、または終了記号データに到達した場合、その到達以
前に当該種別と異なる節点が出現したため、−時中断し
ていた部分木走査を再開し、さらに、当該種別と異なる
節点が出現して、その部分木走査が中断するか、あるい
は終了することを待った後、次のデータから探索を続行
する。なお、指示した時点で当該部分木走査が終了して
いる場合、そのデータの次のデータから探索を続行する
。Also, during the search, if intermediate symbol data or end symbol data that matches the type is reached, a node different from the type appears before reaching the intermediate symbol data or end symbol data, so the subtree scan that was interrupted at - is restarted. , Furthermore, after waiting for a node different from the relevant type to appear and the subtree scan to be interrupted or completed, the search continues from the next data. Note that if the subtree scan has been completed at the time of the instruction, the search continues from the next data.
このように、原始逐次データ列から当該種別の逐次デー
タを探索して、目的逐次データ列を得る過程において、
指示された節点を根とする部分木走査を開始し、本走査
される個々の節点について、その走査段階に対応する属
性が必要ならば、その時点で評価し、その値を目的逐次
データ列の末尾に配置する。In this way, in the process of searching for the relevant type of sequential data from the source sequential data string and obtaining the target sequential data string,
Starts a subtree traversal with the indicated node as the root, and for each node to be main traversed, if an attribute corresponding to that traversal stage is required, it is evaluated at that point, and its value is added to the target sequential data sequence. Place at the end.
このとき開始指示データ中の伝播情報格納場所の先頭ア
ドレスを現在の伝播情報の場所情報として保持する。又
部分木走査において現在の伝播情報を正しく伝播するた
めのスタック構造を生成する。走査中に伝播元に先順で
到達したとき、それまでの伝播情報格納場所先頭アドレ
スをスタックにブツシュし、その子孫については該伝播
情報の伝播は行なわないものとして走査を行なう、また
伝播元では伝播情報の属性値を評価し、後層でスタック
から伝播情報格納場所先頭アドレスを復帰させて、評価
結果を、先頭アドレスから(伝播情報1単位の寸法)×
(カウンタ値)分のオフセットの位置に格納しておく、
伝播元においては、中履、後頭で属性評価を行なう際、
現在の伝播情報格納場所先頭アドレスと、必要とする伝
播元のカウンタ値から、任意の伝播元の伝播情報格納場
所の値を参照することができる。At this time, the start address of the propagation information storage location in the start instruction data is held as location information of the current propagation information. It also generates a stack structure for correctly propagating current propagation information during subtree scanning. When a propagation source is reached in order of priority during scanning, the first address of the propagation information storage location up to that point is pushed onto the stack, and scanning is performed assuming that the propagation information will not be propagated for its descendants. Evaluate the attribute value of the propagation information, restore the first address of the propagation information storage location from the stack in the later layer, and write the evaluation result from the first address (dimension of one unit of propagation information) x
Store it at the offset position of (counter value),
At the propagation source, when performing attribute evaluations on the middle and back of the head,
The value of the propagation information storage location of any propagation source can be referenced from the current propagation information storage location start address and the counter value of the required propagation source.
例えば、ある節点において、第i子がその部分木に属さ
ない場合、走査段階iの直前の状態で走査を中断し、指
示待ちとなる。For example, if the i-th child at a certain node does not belong to that subtree, the scan is interrupted immediately before the scan stage i and waits for an instruction.
この場合、その逐次データが当該種別と一致する中間記
号データ、あるいは終了記号データであれば、再開指示
を行い、対応する部分木走査を、中断した節点の走査段
階iから再開する。なお、対応する部分木走査が存在し
ない場合、すなわち、その部分木走査が既に走査を終了
している場合は。In this case, if the sequential data is intermediate symbol data or end symbol data that matches the type, a restart instruction is issued and the corresponding subtree scan is restarted from the interrupted node scan stage i. Note that if there is no corresponding subtree scan, that is, if the subtree scan has already finished scanning.
再び指示待ちとなる。Waiting for instructions again.
原始逐次データ列の探索において、原始逐次データ列の
末尾データの処理終了が、一つの種別に対する原始逐次
データ列の探索、および部分木走査の完結を意味し、次
の種別が存在する場合は、いままでの目的逐次データ列
を原始逐次データ列と見なして、次の種別の逐次データ
を得るため。In the search for a primitive sequential data string, the end of processing the last data of the primitive sequential data string means the completion of the search for the primitive sequential data string for one type and the subtree scan, and if the next type exists, Purpose: To obtain the next type of sequential data by regarding the sequential data string as a primitive sequential data string.
その先頭から原始逐次データ列の探索を開始する。The search for the primitive sequential data string starts from the beginning.
また、本実施例における本走査方式では1部分木走査中
に、ある節点の種別が当該種別と一致しないため1部分
木走査を中断し、さらに、その逐次データのマークが中
間記号、あるいは終了記号であるため、再開指示を行い
、その時点の中間記号データ、および終了記号データと
対応する開始記号データから開始された部分木走査を再
開する場合、個々の部分本走査に必要な環境、節点、お
よび走査段階等、部分木走査を再開する位置を示す情報
(部分木走査情報)を保持する場所、つまり部分木走査
情報ポインタをスタック構造で管理する。この部分木走
査情報ポインタは、本走査再開指示の際、対応する部分
木走査の開始位置を示す情報として使用される。このた
め、新しい開始記号データ到達時に、それまで用いてい
た部分木走査情報ポインタを、そのスタックにブツシュ
し。In addition, in the main scanning method of this embodiment, during scanning of one subtree, the type of a certain node does not match the type, so the scanning of one subtree is interrupted, and furthermore, the mark of the sequential data is an intermediate symbol or an end symbol. Therefore, when issuing a restart instruction and restarting a subtree scan that started from the intermediate symbol data at that point and the start symbol data corresponding to the end symbol data, the environment, nodes, and A location for holding information (subtree scanning information) indicating the position where subtree scanning is restarted, such as the subtree scanning stage and the scanning stage, that is, a subtree scanning information pointer, is managed in a stack structure. This subtree scan information pointer is used as information indicating the starting position of the corresponding subtree scan when instructing to restart the main scan. Therefore, when new start symbol data is reached, the subtree scan information pointer that was used up until then is pushed onto the stack.
終了記号データ到達時に、そのスタックからポツプする
。When the terminal symbol data is reached, it is popped from the stack.
第1図は、本発明の一実施例における木走査装置の構成
図である。FIG. 1 is a block diagram of a tree scanning device according to an embodiment of the present invention.
本実施例の木走査装[1は、本走査制御装置2゜初期本
走査回路3.木走査情報蓄積回路4.木構造蓄積回路5
.逐次データ探索回路62部分水走査管理情報蓄積回路
72部分木走査回路89部分木走査情報蓄積回路9.逐
次データ読出・書込切換回路10.および逐次データ蓄
積回路11゜12を備える。The tree scanning device of this embodiment [1 is a main scanning control device 2゜initial main scanning circuit 3. Tree scanning information storage circuit 4. Tree structure storage circuit 5
.. Sequential data search circuit 62 partial water scanning management information storage circuit 72 partial tree scanning circuit 89 partial tree scanning information storage circuit 9. Sequential data read/write switching circuit 10. and sequential data storage circuits 11 and 12.
木構造蓄積回路5は、予め、木構造情報26゜各節点の
属性情報27等の木構造データを蓄積し、ある節点の長
子、および第の場所等の構造情報や、その節点の各走査
段階の属性情報の参照、あるいは更新要求等の木構造ア
クセス21.28に対し、該当する節点情報22.29
を出力する。The tree structure storage circuit 5 stores tree structure data such as tree structure information 26 and attribute information 27 of each node in advance, and stores structure information such as the eldest child of a certain node and the second location, and each scanning stage of the node. For tree structure access 21.28 such as attribute information reference or update request, corresponding node information 22.29
Output.
本走査制御回路2は、本走査開始信号13が入力される
と、逐次データ続出・書込切換回路10に対して初期信
号17を出力し、さらに、初期水走査回路3に対して開
始信号15を出力する6また、本走査制御回路2は、種
別情報14が入力されると、この入力が、初期水走査回
路3に対する開始信号15の出力より後に行われた場合
、および、逐次データ探索回路6に対する開始信号19
の出力より後に行われた場合は、それぞれ、初期水走査
回路3から送られる終了信号16の入力、および、逐次
データ探索回路6から送られる終了信号20に入力を待
ち、終了信号16.あるいは20が入力されると、逐次
データ続出・書込切換回路10に切換信号18を出力し
、さらに、逐次データ探索回路6に対して該当する種別
の探索の開始信号19を出力する。When the main scan start signal 13 is input, the main scan control circuit 2 outputs an initial signal 17 to the sequential data output/write switching circuit 10, and further outputs a start signal 15 to the initial water scan circuit 3. 6 Further, when the type information 14 is inputted, the present scanning control circuit 2 outputs the data search circuit 6 if this input is performed after the output of the start signal 15 to the initial water scanning circuit 3, and the sequential data search circuit. Start signal 19 for 6
If the output is performed after the output of the end signal 16 ., the end signal 16 . Alternatively, when 20 is input, the switching signal 18 is output to the sequential data output/write switching circuit 10, and furthermore, the start signal 19 for the corresponding type of search is output to the sequential data search circuit 6.
逐次データ読出・書込切換回路10は、初期信号17が
入力されると、逐次データ蓄積回路11を目的逐次デー
タ列の蓄積場所として割り当てるため、入力される逐次
データ25.35のチャネルと、逐次データ蓄積回路1
1への書込データである逐次データ41のチャネルとを
接続し、また、逐次データ読出・書込切換回路10への
読出信号36、および、逐次データ読出・書込切換回路
10からの出力である逐次データ37のチャネルと、逐
次データ蓄積回路12への読出信号46、および、逐次
データ蓄積回路12からの読出データである逐次データ
47のチャネルとを接続して、逐次データ蓄積回路11
に対し、リセット信号40を出力する。その後、逐次デ
ータ25が入力される毎に、逐次データ蓄積回路11に
書き込まれる逐次データ41として出力する。When the initial signal 17 is input, the sequential data read/write switching circuit 10 allocates the sequential data storage circuit 11 as the storage location of the target sequential data string. Data storage circuit 1
1, and the read signal 36 to the sequential data read/write switching circuit 10 and the output from the sequential data reading/writing switching circuit 10. A certain channel of sequential data 37 is connected to a read signal 46 to the sequential data storage circuit 12 and a channel of sequential data 47 which is read data from the sequential data storage circuit 12, and the sequential data storage circuit 11 is connected.
In response, a reset signal 40 is output. Thereafter, each time the sequential data 25 is input, it is output as sequential data 41 written to the sequential data storage circuit 11.
また、逐次データ読出・書込切換回路10は、切換信号
18が入力されると、入力される逐次データ25.35
のチャネルと、逐次データ蓄積回路11へ書き込まれる
逐次データ41のチャネルとが接続されている場合、そ
の入力データ25゜35のチャネルを、逐次データ蓄積
回路12へ書き込まれる逐次データ45のチャネルに切
り換えて接続し、その入力データ25.35のチャネル
と、逐次データ蓄積回路12へ書き込まれる逐次データ
45のチャネルとが接続されている場合は、その入力デ
ータ25.35のチャネルを、逐次データ蓄積回路11
へ書き込まれる逐次データ41のチャネルに切り換えて
接続する。Further, when the switching signal 18 is input, the sequential data read/write switching circuit 10 controls the input sequential data 25.35.
When the channel of the sequential data 41 written to the sequential data storage circuit 11 is connected, the channel of the input data 25° 35 is switched to the channel of the sequential data 45 written to the sequential data storage circuit 12. If the input data 25.35 channel is connected to the sequential data 45 channel written to the sequential data storage circuit 12, the input data 25.35 channel is connected to the sequential data storage circuit 12. 11
The channel of the sequential data 41 to be written to is switched and connected.
さらに、読出信号36、および、逐次データ探索回路6
に出力される逐次データ37のチャネルと、続出信号4
6.および、逐次データ蓄積回路12から読み出される
逐次データ47のチャネルとが接続されている場合、読
出信号36、および逐次データ探索回路6に出力される
逐次データ37のチャネルを、続出信号42.および逐
次データ43のチャネルに切り換えて接続し、逐次デ−
タ蓄積回路11に対してリセット信号44を出力する。Furthermore, the read signal 36 and the sequential data search circuit 6
channel of sequential data 37 output to
6. When the channel of the sequential data 47 read from the sequential data storage circuit 12 is connected, the read signal 36 and the channel of the sequential data 37 output to the sequential data search circuit 6 are connected to the successive signal 42 . and sequential data channel 43 and connect to the sequential data channel.
A reset signal 44 is output to the data storage circuit 11.
また、逆に、読出信号42、および逐次データ37のチ
ャネルと、読出信号42.および逐次データ43のチャ
ネルとが接続されている場合、続出信号36、および逐
次データ37のチャネルを、読出信号46、および逐次
データ47のチャネルに切り換えて接続し、逐次データ
蓄積回路12に対して、リセット信号44を出力する。Conversely, the read signal 42 and the sequential data 37 channel and the read signal 42 . and the channel of sequential data 43 are connected, the channel of successive signal 36 and sequential data 37 is switched and connected to the channel of read signal 46 and sequential data 47, and connected to sequential data storage circuit 12. , outputs a reset signal 44.
その後、逐次データ読出・書込切換回路10は。After that, the sequential data read/write switching circuit 10.
逐次データ35を入力する毎に、チャネルが接続されて
いる側の逐次データ蓄積回路11、あるいは12へ書き
込まれる逐次データ42、あるいは46として出力する
。また、続出信号36を入力する毎に、チャネルが接続
されている側の逐次データ蓄積回路11、あるいは12
へ、読出信号42、あるいは46として出力し、逐次デ
ータ蓄積回路11、あるいは12から、それぞれ読み出
される逐次データ43、あるいは47を入力して、出力
データ′37として出力する。Every time the sequential data 35 is input, it is output as sequential data 42 or 46 written to the sequential data storage circuit 11 or 12 to which the channel is connected. Also, each time the successive signal 36 is input, the sequential data storage circuit 11 or 12 on the side to which the channel is connected is
is outputted as a read signal 42 or 46, and inputs sequential data 43 or 47 read from the sequential data storage circuit 11 or 12, respectively, and outputs it as output data '37.
逐次データ蓄積回路11.12は、入力されたデータを
逐次的に配置する記憶部と、記憶部において、末尾に配
置されたデータの場所を示すポインタとを備え、リセッ
ト信号40.44が入力されると、ポインタが記憶部の
先頭の場所に設定し、書込データとして逐次データ41
.45が入力されると、現在のポインタを1デ一タ分、
進めて、そのポインタが示す場所に、その書込データ4
1゜45を格納し、読出信号42,46が入力されると
、現在のポインタが示す場所の逐次データ43゜47を
読出データとして出力し、そのポンタを1データ分戻す
。The sequential data storage circuit 11.12 includes a storage section for sequentially arranging input data, and a pointer indicating the location of the data arranged at the end in the storage section, and receives a reset signal 40.44. Then, the pointer is set to the beginning of the storage section, and the sequential data 41 is written as write data.
.. When 45 is input, the current pointer is moved by 1 data,
Move forward and write the write data 4 to the location indicated by the pointer.
1°45 is stored, and when read signals 42 and 46 are input, sequential data 43°47 at the location indicated by the current pointer is output as read data, and the pointer is returned by one data.
これらのデータは、節点2種別、マーク、および伝播情
報格納場所先頭アドレスの4つのフィールドから構成さ
れたデータか、あるいは、属性データである。その節点
フィールドは節点データの場所を保持し1種別フィール
ドは節点の種別を保持し、マーク・フィールドはデータ
の開始記号。These data are data composed of four fields: two types of nodes, a mark, and a first address of a propagation information storage location, or are attribute data. The node field holds the location of the node data, the type field holds the type of node, and the mark field holds the start symbol of the data.
中間記号、および終了記号の何れかを保持する。Retains either an intermediate symbol or a terminal symbol.
従って、節点フィールド、種別フィールド、およびマー
ク・フィールドから構成されるデータは、まだ展開され
ていない種別の部分木に関する情報であり、属性データ
は、既に展開された節点の属性情報自体を示す。Therefore, the data composed of the node field, type field, and mark field is information regarding the subtree of the type that has not yet been expanded, and the attribute data indicates the attribute information itself of the node that has already been expanded.
第2図は、本発明の一実施例における初期本走査回路の
初期逐次データ列の作成処理フローチャートである。な
お、MODEは、走査時における現在の節点の場所を示
し、N0DEIは、現在の節点の子の場所を示す。FIG. 2 is a flowchart of the initial sequential data string creation process of the initial main scanning circuit in one embodiment of the present invention. Note that MODE indicates the location of the current node at the time of scanning, and NODEI indicates the location of the child of the current node.
第1図のように、初期本走査回路3は、本走査情報蓄積
回路4に対してブツシュ操作、およびポツプ操作を行い
、本走査情報蓄積口M4は、初期本走査回路3のブツシ
ュ操作により、待避情報23を入力してスタック構造の
末尾に蓄積し、初期本走査回路3のポツプ操作により、
スタック構造の末尾の情報を取り出して、復帰情報24
として出力する。As shown in FIG. 1, the initial main scanning circuit 3 performs push and pop operations on the main scanning information storage circuit 4, and the main scanning information storage port M4 is opened by the button operation of the initial main scanning circuit 3. The save information 23 is input and accumulated at the end of the stack structure, and by pop operation of the initial main scanning circuit 3,
Extract the information at the end of the stack structure and return the return information 24
Output as .
第2図のように、まず、本走査制御回路2が開始信号1
5を出力すると、初期本走査回路3は、この開始信号1
5を入力し、木構造蓄積回路5に格納された木構造の根
から探索を始める。As shown in FIG. 2, first, the main scanning control circuit 2 sends a start signal 1
5, the initial main scanning circuit 3 outputs this start signal 1.
5 is input, and the search starts from the root of the tree structure stored in the tree structure storage circuit 5.
MODEが、ある伝播情報について伝播可能領域でない
節点の子であり、かつその伝播情報を参照する伝播元節
点である場合は(74) 、伝播情報格納場所として使
用可能な領域の先頭アドレスを得て、本アドレスを現在
の伝播情報格納場所先頭アドレスとしく75)、そうで
ないときは、先祖の設定した伝播情報格納場所先頭アド
レスを現在のそれとする。If MODE is a child of a node that is not a propagable area for certain propagation information and is a propagation source node that refers to that propagation information (74), obtain the start address of the area that can be used as a storage location for propagation information. , this address is set as the current propagation information storage location start address 75), and if not, the propagation information storage location start address set by the ancestor is set as the current one.
この本走査における現在の節点の場所を示すMODEが
根であるか、あるいは、そのMODEの種別が親の種別
と異なる場合、部分木の根であると判断しく60)、そ
の節点について、現在の伝播情報格納場所先頭アドレス
を含む開始記号データを作成して(61)、逐次データ
読出・書込切換回路10を介し、目的逐次データ蓄積回
路11に書き込む(62)。If the MODE indicating the location of the current node in this main scan is the root, or if the type of MODE is different from the parent type, it is determined to be the root of the subtree60), and the current propagation information is Start symbol data including the first address of the storage location is created (61) and written into the target sequential data storage circuit 11 via the sequential data read/write switching circuit 10 (62).
次に、そのMODEの長子から順に、子孫の長子を走査
するため、現在のMODE、N0DEL。Next, in order to scan the first child of descendants in order from the first child of that MODE, the current MODE, N0DEL.
親の種類及び現在の伝播情報格納場所先頭アドレスを、
本走査情報蓄積回路4にブツシュしく65)。The parent type and current propagation information storage location start address,
65) in the main scanning information storage circuit 4.
子の情報を設定し直して(66) 、 1abel 1
に戻り、N0DEの種別が親の種別と等しいか否かを判
断する(60)。Reset the child information (66), 1abel 1
Returning to , it is determined whether the type of N0DE is equal to the type of the parent (60).
また、部分木の根において、第が存在しない場合(67
)、逐次データ列の末尾が中間記号データならば、中間
記号データを削除し、終了記号データを作成して逐次デ
ータ列の末尾に配置する(68)。Also, if the root of the subtree does not exist (67
), if the end of the sequential data string is intermediate symbol data, the intermediate symbol data is deleted, and end symbol data is created and placed at the end of the sequential data string (68).
さらに、子の走査から戻った時点で、本走査情報蓄積回
路4をポツプして、現在の情報を復帰する(69)、な
お、ポツプする情報がないときは処理を終る。Furthermore, when returning from the child scan, the main scanning information storage circuit 4 is popped and the current information is restored (69).If there is no information to be popped, the process ends.
また、子の種別と自分の種別とが異なると判断すると(
70)、その節点について、中間記号データを作成しく
71)、逐次データ読出・書込切換回路10を介して、
目的逐次データ蓄積回路11に書き込む(72)。Also, if it is determined that the child's type is different from your own type (
70), create intermediate symbol data for that node 71), and sequentially through the data read/write switching circuit 10,
The target is written to the sequential data storage circuit 11 (72).
こうして、中間記号データの書き込みが終了すると、N
0DEIにN0DE1の第を設定して(73)、ラベル
(label) 2に戻り、MODEIがnilか否か
を判断する(64)。In this way, when writing of intermediate symbol data is completed, N
The number N0DE1 is set in 0DEI (73), the process returns to label 2, and it is determined whether MODEI is nil or not (64).
第3図は本発明の一実施例の逐次データ探索回路におけ
る原始逐次データ列から目的逐次データ列への展開処理
フローチャートである。なお、逐次データ蓄積回路11
は、原始逐次データ列を蓄積し、逐次データ蓄積回路1
2は目先逐次データ列を蓄積するものとし、また、逐次
データ読出・書込切換回路10の経由については言及し
ない。FIG. 3 is a flowchart of processing for expanding a source sequential data string into a target sequential data string in a sequential data search circuit according to an embodiment of the present invention. Note that the sequential data storage circuit 11
stores the primitive sequential data string, and the sequential data storage circuit 1
2 is assumed to store a sequential data string at the moment, and the passage through the sequential data read/write switching circuit 10 is not mentioned.
第1図のように、逐次データ探索回路6は、部分木走査
管理情報蓄積回路7に対してブツシュ操作を行い、部分
木走査管理情報蓄積回路7は、待避情報30を入力して
、スタック構造の末尾に蓄積し、逐次データ探索回路6
のポツプ操作により。As shown in FIG. 1, the sequential data search circuit 6 performs a push operation on the subtree scanning management information storage circuit 7, and the subtree scanning management information storage circuit 7 inputs the save information 30 and creates a stack structure. is accumulated at the end of the data search circuit 6.
By pop operation.
スタック構造の末尾の情報を取り出して、復帰情報31
として出力する。Extract the information at the end of the stack structure and return the return information 31
Output as .
第3図のように、まず、逐次データ探索回路6は、本走
査制御回路2から開始信号19を入力すると、逐次デー
タ蓄積回路11内の原始逐次データ列の先頭から探索を
行うため、データを読み出す(80,93) 。As shown in FIG. 3, first, when the sequential data search circuit 6 receives the start signal 19 from the main scanning control circuit 2, the sequential data search circuit 6 searches from the beginning of the primitive sequential data string in the sequential data storage circuit 11. Read (80, 93).
読み出すデータが空データであれば(81)、本走査制
御回路2に終了信号20を出力し、本走査制御回路2か
らの開始信号19を待つ状態となる。If the data to be read is empty data (81), the end signal 20 is output to the main scan control circuit 2, and the state waits for the start signal 19 from the main scan control circuit 2.
読み出すデータが有れば(81)、そのデータの種別フ
ィールドの値が、現在の種別と一致するか否かを調べ(
82)、異なる場合、そのデータを逐次データ蓄積回路
12に書き込む(84)。If there is data to read (81), check whether the value of the type field of that data matches the current type (
82), and if different, the data is sequentially written into the data storage circuit 12 (84).
そのデータの種別フィールドの値が、現在の種別と一致
する場合1次に、そのデータのマークを調べる(83)
。If the value of the type field of the data matches the current type, first check the mark of the data (83)
.
マーク・フィールドが開始記号であれば、現在の部分木
走査のための情報の中1部分木走査情報蓄積回路9内の
場所を示す値(部分木走査情報ポインタ)を待避情報3
0として、部分木走査管理情報蓄積回路7にブツシュし
く85)、新しい部分木走査の開始を節点フィールドの
節点の場所を伴う部分木走査開始信号32により、部分
木走査回路8に指示しく86)、部分木走査回路8から
の部分木走査停止信号34を待つ(87)、なお、この
部分木走査停止信号34は、新しい部分木走査のための
部分木走査情報ポインタを伴い、逐次データ探索回路6
は、現在の部分木走査の環境の場所を部分木走査管理情
報蓄積回路7にブツシュするまで、−時的に保持する。If the mark field is a start symbol, the value (subtree scanning information pointer) indicating the location in the first subtree scanning information storage circuit 9 in the information for the current subtree scanning is saved as the save information 3.
0 to the subtree scanning management information storage circuit 7 85), and instructs the subtree scanning circuit 8 to start a new subtree scanning using the subtree scanning start signal 32 accompanied by the location of the node in the node field 86). , waits for the subtree scanning stop signal 34 from the subtree scanning circuit 8 (87). Note that this subtree scanning stop signal 34 is accompanied by a subtree scanning information pointer for scanning a new subtree, and the sequential data search circuit 6
temporarily holds the location of the current subtree scanning environment until it is written to the subtree scanning management information storage circuit 7.
その後1部分木走査回路信号34が入力されると、再び
、逐次データ蓄積回路11からデータを読み出す(93
)。After that, when the 1 subtree scanning circuit signal 34 is input, data is read out from the sequential data storage circuit 11 again (93
).
また、マーク・フィールドが中間記号であれば、部分木
走査回路8に対して、現在の部分木走査情報ポインタ3
0を伴う部分木走査再開信号33により、この部分木走
査の再開を指示しく88)。Furthermore, if the mark field is an intermediate symbol, the current subtree scanning information pointer 3 is sent to the subtree scanning circuit 8.
The subtree scanning restart signal 33 with 0 instructs restart of this subtree scanning 88).
部分木走査回路8からの部分木走査停止信号34を待つ
(89)、こうして、部分木走査停止信号34が入力さ
れると、再び、逐次データ蓄積回路11からデータを読
み出す(93)。It waits for the subtree scanning stop signal 34 from the subtree scanning circuit 8 (89). When the subtree scanning stop signal 34 is input in this way, data is sequentially read from the data storage circuit 11 again (93).
さらに、マーク・フィールドが終了記号であれば、中間
記号の場合(88,89)と同様に、現在の部分木走査
の再開を指示しく90)、部分木走査回路8からの部分
木走査停止信号34を待ち(91)、その後、部分木走
査管理情報蓄積回路7から最新の部分木走査情報ポイン
タ31をポツプして(92)、再び、逐次データ蓄積回
路11からデータを読み出す(93)。Furthermore, if the mark field is an end symbol, the subtree scanning stop signal from the subtree scanning circuit 8 is issued to instruct restart of the current subtree scanning, as in the case of an intermediate symbol (88, 89). 34 (91), then pops the latest subtree scanning information pointer 31 from the subtree scanning management information storage circuit 7 (92), and reads data from the sequential data storage circuit 11 again (93).
第4図は、本発明の一実施例の部分木走査回路における
木構造から目的逐次データ列への展開処理フローチャー
トである。なお9M0DEは、走査時における現在の節
点の場所を示し、MODElは、現在の節点の子の場所
を示し、5TAGEは、N0DEの走査段階を示す。FIG. 4 is a flowchart of processing for expanding a tree structure into a target sequential data string in a subtree scanning circuit according to an embodiment of the present invention. Note that 9M0DE indicates the location of the current node at the time of scanning, MODEl indicates the location of the child of the current node, and 5TAGE indicates the scanning stage of N0DE.
第1図のように、部分木走査回路8の生成操作により、
部分木走査情報蓄積回路9は、生成信号48を入力して
、新しい部分木に対応する領域を循保し、その場所(部
分木走査情報ポインタ49)を部分木走査回路8に出力
し1部分木走査回路8のブツシュ操作により、待避情報
38を入力して、待避情報38が伴う部分木走査情報ポ
インタの指定する領域上のスタック構造の末尾に蓄積し
、部分木走査回路8のポツプ操作により、同様に、指定
する領域上のスタック構造の末尾の情報を取り出し、復
帰情報39として出力する。As shown in FIG. 1, by the generation operation of the subtree scanning circuit 8,
The subtree scanning information storage circuit 9 inputs the generation signal 48, circulates the area corresponding to the new subtree, outputs the location (subtree scanning information pointer 49) to the subtree scanning circuit 8, and stores one part. By the push operation of the tree scanning circuit 8, the save information 38 is input, and the save information 38 is accumulated at the end of the stack structure in the area designated by the subtree scanning information pointer, and by the pop operation of the subtree scanning circuit 8. , Similarly, the information at the end of the stack structure on the designated area is extracted and output as restoration information 39.
第4図のように、部分木走査回路8は、逐次データ探索
回路6から節点の場所、及び伝播情報格納場所先頭アド
レスを伴う開始信号32を入力すると、該伝播情報格納
場所先頭アドレスを現在の伝播情報格納場所先頭アドレ
スとして設定し、木構造蓄積回路5内の木構造を、その
節点を根として走査する。この場合、部分木走査回路8
は、部分木走査情報蓄積回路9に生成信号48を出力し
て、部分木走査情報ポインタ49を入力する(100,
101)。As shown in FIG. 4, when the subtree scanning circuit 8 receives a start signal 32 accompanied by the location of the node and the first address of the propagation information storage location from the sequential data search circuit 6, the subtree scanning circuit 8 converts the first address of the propagation information storage location to the current one. The node is set as the start address of the propagation information storage location, and the tree structure in the tree structure storage circuit 5 is scanned with that node as the root. In this case, the subtree scanning circuit 8
outputs the generation signal 48 to the subtree scanning information storage circuit 9 and inputs the subtree scanning information pointer 49 (100,
101).
N0DEがある伝播情報の伝播光であり、かつ伝播情報
格納場所先頭アドレスが割り付けられている場合は、こ
れをこの伝播情報の伝播可能領域の根と解釈しく115
)、現在の伝播情報格納場所先頭アドレスを部分木走査
情報蓄積回路9内のスタック構造に退避する一方(11
6)、当節点の伝播情報格納場所先頭アドレスを現在の
伝播情報格納場所先頭アドレスとして設定する(117
)。If N0DE is a propagation light of a certain propagation information and the first address of the propagation information storage location is assigned, this should be interpreted as the root of the propagation possible area of this propagation information.
), while saving the current propagation information storage location start address to the stack structure in the subtree scanning information storage circuit 9 (11
6), Set the propagation information storage location start address of this node as the current propagation information storage location start address (117
).
又、N0DEがある伝播情報の伝播光である場合は、当
該情報の評価を行なった後にその結果を現在の伝播情報
格納場所先頭アドレスから(伝播情報1単位の寸法)X
(当該節点のカウンタ値)分増分した位置に格納してお
く(119)。In addition, if N0DE is the propagation light of a certain propagation information, after evaluating the information, the result is transferred from the current propagation information storage location start address (dimensions of 1 unit of propagation information)
It is stored at a position incremented by (counter value of the node) (119).
MODEの種別が当該種別と異なる場合(102)、そ
の部分木走査情報ポインタを伴う部分木走査停止信号3
4を逐次データ探索回路6に対して出力し、動作を中断
する(103)、逐次データ探索回路6から部分木走査
再開信号33が入力されると、その部分木走査再開信号
33に伴う部分木走査情報ポインタを、部分木走査情報
蓄積回路9上の現在の領域を示すポインタとして設定し
、動作を再開する(104)。If the type of MODE is different from the relevant type (102), the subtree scanning stop signal 3 accompanied by the subtree scanning information pointer
4 is output to the sequential data search circuit 6 and the operation is interrupted (103). When the subtree scan restart signal 33 is input from the sequential data search circuit 6, the subtree scan resume signal 33 is output to the sequential data search circuit 6. The scanning information pointer is set as a pointer indicating the current area on the subtree scanning information storage circuit 9, and the operation is restarted (104).
また、MODEの種別が当該種別と一致する場合(10
2) 、5TAGE=OにおけるN0DEの属性を逐次
データ50として、逐次データ蓄積回路12に書き込む
・106,106)、さらに。Also, if the type of MODE matches the relevant type (10
2) Write the attribute of N0DE at 5TAGE=O as sequential data 50 to the sequential data storage circuit 12 (106, 106), and further.
N0DEIにMODEの長子を設定する(107)。The first child of MODE is set in N0DEI (107).
N0DEIがn1lt’なければ(108’)、N0D
Eの長子から順に、子孫の長子を走査するため、現在(
7)MODE、N0DEI、および5TAGEを1部分
木走査情報蓄積回路9の現在の領域にブツシュしく10
9)、子の情報を設定し直して(110)、再び、 1
abel 1に戻り、MODEの種別が現在の種別と一
致するか否かを確める(102)。If N0DEI is not n1lt'(108'), N0D
Currently (
7) Push MODE, N0DEI, and 5TAGE into the current area of the subtree scanning information storage circuit 9.
9), reset the child information (110), and again, 1
Returning to abel 1, it is determined whether the type of MODE matches the current type (102).
また、N0DEがnilならば(108)、子の操作か
ら戻った時点で、部分木走査情報蓄積回路9上の現在の
領域からポツプして、現在の情報を復帰する(111)
。If N0DE is nil (108), when returning from child operation, pop from the current area on the subtree scanning information storage circuit 9 and restore the current information (111).
.
この場合、ポツプするデータが無ければ(112)、こ
の部分木の走査を終了し1部分本走査情報ポインタが示
す領域を放棄して、逐次データ探索回路6に対し、部分
木走査停止信号34を出力して、部分木走査開始信号3
2.あるいは部分木走査再開信号33を待つ。In this case, if there is no data to pop (112), scanning of this subtree is completed, the area indicated by the 1 partial main scanning information pointer is abandoned, and a subtree scanning stop signal 34 is sent to the sequential data search circuit 6. Output subtree scanning start signal 3
2. Alternatively, it waits for the subtree scanning restart signal 33.
また、復帰情報39があれば(112)、その5TAG
Eをオウンドアツブしく113)、その5TAGEにお
けるN0DEの属性を示す逐次データ50を逐次データ
蓄積回路12に書き込み(114)、第の走査を行うた
め、N0DELに、NoDElの第を設定り、て(11
5) 、再び。Also, if there is return information 39 (112), its 5TAG
Own add E (113), write sequential data 50 indicating the attribute of N0DE in that 5TAGE to the sequential data storage circuit 12 (114), set NoDEL to N0DEL in order to perform the second scan, and write (11
5), again.
1abel 2に戻り、MODEがnilか否かを確め
る(108)、なお、部分木走査再開信号33に伴う部
分木走査情報ポインタの示す領域が既に放棄されている
場合1以上の処理を実行することなく部分木走査停止信
号34を出力し、部分木走査開始信号32、あるいは部
分木走査再開信号33を待つ。Return to 1abel 2 and check whether MODE is nil (108). If the area indicated by the subtree scan information pointer accompanying the subtree scan restart signal 33 has already been abandoned, execute one or more processes. It outputs the subtree scanning stop signal 34 without doing anything, and waits for the subtree scanning start signal 32 or the subtree scanning restart signal 33.
本発明によれば、木構造のデータを処理する本走査にお
いて、節点の走査順に節点を処理することが不可能であ
り、複数回の走査が必要な場合、個々の走査では、対象
となる節点の周辺のみ走査するため、処理効率を向上す
ることができる。According to the present invention, in the main scan for processing tree-structured data, if it is impossible to process nodes in the order in which they are scanned and multiple scans are required, in each scan, the target node Since only the periphery of the image is scanned, processing efficiency can be improved.
はた、各節点を処理するために必要な情報を一括して保
有できない等の理由から、複数回の走査で対処しきれな
い場合でも、木全体を一回の走査で処理した場合と同様
の節点処理結果を得ることができる。In addition, even if the information required to process each node cannot be stored all at once, it is not possible to handle the problem with multiple scans. Nodal processing results can be obtained.
このとき、ある節点の特定の属性値を、その節点の祖先
に対して伝播する機構を有するので、合成属性の伝播を
伴う本走査においても適用が可能となる。At this time, since it has a mechanism for propagating a specific attribute value of a certain node to the ancestors of that node, it can also be applied to the main scan that involves the propagation of composite attributes.
第1図は本発明の一実施例における木走査装置の構成図
、第2図は本発明の一実施例における初期木走査回路の
初期逐次データ列の作成処理フローチャート、第3図は
本発明の一実施例の原始逐次データ列から目的逐次デー
タ列への展開処理フローチャート、第4図は本発明の一
実施例の部分木走査回路における木構造から目的逐次デ
ータ列への展開処理フローチャート、第5図は本発明の
一実施例における節点、および部分木の説明図。
第6図は本発明の一実施例における逐次データ列の説明
図、第7図は伝播可能領域の説明図、第8図は木構造デ
ータに対する操作の説明図、第9図は部分木と伝播可能
領域の関連説明図、第10図は木構造の説明図である。
1・・・木走査装置、2・・・本走査制御回路、3・・
・初期木走査回路、4・・・本走査情報蓄積回路、5・
・・木構造蓄積回路、6・・・逐次データ探索回路、7
・・・部分木走査管理情報蓄積回路、8・・・部分木走
査回路、9・・・部分木走査情報蓄積回路、10・・・
逐次データ続出・書込切換回路、11.12・・・逐次
データ蓄積回路、13・・・本走査開始信号、14・・
・種別情報。
15.19・・・開始信号、16.20・・・終了信号
。
17・・・初期信号、18・・・切換信号、21.28
・・・木構造アクセス、22.29・・・節点情報、2
3゜30.38・・・待避情報、24,31,39・・
・復帰情報、25,35,37,41,43,45゜4
7.50・・・逐次データ、26・・・木構造情報、2
7・・・属性情報、32・・・部分木走査開始信号、3
3・・・部分木走査再開信号、34・・・部分木走査停
止信号、36,42,46・・・読出信号、40゜44
・・・リセット信号、48・・・生成信号5.49・・
・部分木走査情報ポインタ、200・・・木構造、20
1凛 5図
悼)昨、セ、め1本
(す種別1’ J ) PELT +7 :iq f=
Ljri7A、 B、 C野、g、 、社別石
弄 6 肥
(し)
茅 6 図
(dン
uL>
(A(C(B)、βC14,C,A)ン)(トンン6(
ンプr本葺蓮
糾FIG. 1 is a block diagram of a tree scanning device according to an embodiment of the present invention, FIG. 2 is a flowchart of an initial sequential data string creation process of an initial tree scanning circuit according to an embodiment of the present invention, and FIG. 3 is a block diagram of a tree scanning device according to an embodiment of the present invention. FIG. 4 is a flowchart of an expansion process from a source sequential data string to a target sequential data string according to an embodiment of the present invention; FIG. The figure is an explanatory diagram of nodes and subtrees in one embodiment of the present invention. Fig. 6 is an explanatory diagram of a sequential data string in an embodiment of the present invention, Fig. 7 is an explanatory diagram of a propagable area, Fig. 8 is an explanatory diagram of operations on tree-structured data, and Fig. 9 is a subtree and propagation diagram. A related explanatory diagram of possible regions, FIG. 10 is an explanatory diagram of a tree structure. 1... Tree scanning device, 2... Main scanning control circuit, 3...
・Initial tree scanning circuit, 4...Main scanning information storage circuit, 5.
...Tree structure storage circuit, 6...Sequential data search circuit, 7
... Subtree scanning management information storage circuit, 8... Subtree scanning circuit, 9... Subtree scanning information storage circuit, 10...
Sequential data output/write switching circuit, 11.12... Sequential data accumulation circuit, 13... Main scan start signal, 14...
・Type information. 15.19...Start signal, 16.20...End signal. 17...Initial signal, 18...Switching signal, 21.28
...Tree structure access, 22.29...Node information, 2
3゜30.38...Evacuation information, 24,31,39...
・Return information, 25, 35, 37, 41, 43, 45°4
7.50... Sequential data, 26... Tree structure information, 2
7... Attribute information, 32... Subtree scanning start signal, 3
3... Subtree scanning restart signal, 34... Subtree scanning stop signal, 36, 42, 46... Read signal, 40° 44
...Reset signal, 48...Generation signal 5.49...
・Subtree scanning information pointer, 200...Tree structure, 20
1 Rin 5 Zu Mourning) Yesterday, Se, Me 1 book (Su type 1' J) PELT +7: iq f=
Ljri7A, B, C field, g, , Shabetsu stone play 6 Fertilization (shi) Kaya 6 Figure (dunuL> (A(C(B),βC14,C,A)n)(tonn6(
ump r honbuki lotus paste
Claims (1)
え、該節点は、iが1以上、かつ、該節点の子の総数以
下の整数であれば、該節点の第1子の走査前、あるいは
、第i子の走査後であるという該木構造における走査段
階を示す属性と、該属性の評価順序を節点単位に規定す
る種別とを持ち、該木構造データの各節点の走査段階に
対応する属性の評価結果を、メモリ上に深さ優先探索順
に逐次的に並べる処理を、該属性の評価順序に従い、段
階的に行う際に、ある節点の保有する属性を該節点の祖
先の属性評価において参照する必要のある木走査装置に
おいて、上記メモリは2個のメモリから構成され、上記
種別が等しく、連結した節点群を部分木として認識し、
又ある伝播対象となる伝播情報を生成する伝播元節点を
葉とし、該節点と、最早その先祖において該伝播情報を
参照しない、該伝播情報を参照する伝播先節点とをつな
ぐ経路の集合を、該伝播情報に関する伝播可能領域とし
て認識し、該領域単位に該領域内の伝播元節点個数分の
伝播情報格納場所を確保してその場所情報を該伝播可能
領域の根に格納し、各部分木の根の走査時に該根の最も
近い祖先の伝播可能領域の根の保持する伝播情報格納場
所情報を保持した該部分木の開始位置にあることを示す
記号、および終了位置にあることを示す記号を、それぞ
れ先順、および後順に逐次的に並べ、該部分木の中間に
位置することを示す記号を、該部分木の各葉において、
該種別と異なる種別の子の走査から戻った時点で、該2
個のメモリの一方に、逐次的に並べる第1の処借を行う
手段、該第1処理手段により各該種別毎に逐次的に並べ
られたデータ列を探索しながら、当該種別に属さない部
分木の該開始記号、該中間記号、および該終了記号を、
該2個のメモリの他方に複写し、当該種別に属する部分
木の該開始記号を発見すると、該部分木走査の開始を指
示し、該中間記号、および該終了記号を発見すると、該
部分木走査の再開を指示する第2の処理を行う手段、お
よび、該第2処理手段の指示により、当該種別に属する
部分木の走査を行い、該部分木の属性を該2個のメモリ
の他方に展開する処理を行う第3の手段を備え、該第1
処理手段により、該逐次データ列を該一方のメモリに展
開し、該第2処理手段により、該逐次データ列を探索し
、該第3処理手段は、該第2処理手段の該開始指示を受
け、該部分木の走査を開始し、該種別と異なる種別の節
点を検出すると、該走査を一時中断して、該第2処理手
段により、再び、該一方のメモリに格納された該逐次デ
ータ列の探索を行い、また、該第3処理手段は、該第2
処理手段の該再開指示により、該部分木走査を再開し、
該走査と並行して、当該種別に属する部分木の属性を、
該他方のメモリ上に展開する処理を行うことを特徴とす
る木走査方法。1. A means for storing tree structure data composed of nodes is provided, and if i is an integer greater than or equal to 1 and less than or equal to the total number of children of the node, the node is stored before scanning the first child of the node. , or has an attribute indicating the scanning stage in the tree structure that is after the scanning of the i-th child, and a type that defines the evaluation order of the attribute for each node, and When performing the process of sequentially arranging the evaluation results of the corresponding attributes in memory in depth-first search order according to the evaluation order of the attributes, the attributes held by a certain node are compared to the attributes of the ancestors of the node. In the tree scanning device that needs to be referenced in the evaluation, the memory is composed of two memories, the types are the same, and the connected node group is recognized as a subtree,
In addition, a propagation source node that generates propagation information that is a propagation target is taken as a leaf, and a set of paths connecting this node and propagation destination nodes that refer to the propagation information that no longer refer to the propagation information in their ancestors is defined as It is recognized as a propagable area related to the propagation information, secures a propagation information storage location for the number of propagation source nodes in the area for each area, stores the location information at the root of the propagable area, and stores the location information at the root of each subtree. When scanning, a symbol indicating that the subtree is at the start position and an end position of the subtree holding the propagation information storage location information held by the root of the propagable area of the nearest ancestor of the root, and a symbol indicating that it is at the end position, Each leaf of the subtree is arranged sequentially in the order of the first and second order, and a symbol indicating that it is located in the middle of the subtree is placed in each leaf of the subtree.
Upon returning from scanning a child of a type different from this type, the 2
means for sequentially arranging data strings in one of the memories; a first processing means for searching data strings sequentially arranged for each type; The start symbol, the middle symbol, and the end symbol of the tree are
When the start symbol of the subtree belonging to the type is found, the start of scanning of the subtree is instructed, and when the intermediate symbol and the end symbol are found, the subtree is copied to the other of the two memories. means for performing a second process for instructing resumption of scanning, and scanning the subtree belonging to the type according to the instruction from the second processing means, and storing the attributes of the subtree in the other of the two memories. a third means for performing a process of expanding;
The processing means develops the sequential data string in the one memory, the second processing means searches for the sequential data string, and the third processing means receives the start instruction from the second processing means. , starts scanning the subtree, and when a node of a type different from the type is detected, the scanning is temporarily interrupted, and the second processing means again reads the sequential data string stored in the one memory. The third processing means searches for the second
restarting the subtree scanning according to the restart instruction from the processing means;
In parallel with the scanning, the attributes of the subtrees belonging to the type are
A tree scanning method characterized by performing a process of expanding onto the other memory.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP62247815A JPH0192836A (en) | 1987-10-02 | 1987-10-02 | tree scanning method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP62247815A JPH0192836A (en) | 1987-10-02 | 1987-10-02 | tree scanning method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0192836A true JPH0192836A (en) | 1989-04-12 |
Family
ID=17169076
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP62247815A Pending JPH0192836A (en) | 1987-10-02 | 1987-10-02 | tree scanning method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0192836A (en) |
-
1987
- 1987-10-02 JP JP62247815A patent/JPH0192836A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3554459B2 (en) | Text data registration search method | |
| US4868743A (en) | Traversal method of processing tree structure information and apparatus using the same | |
| US7457799B2 (en) | Apparatus and method for searching data of structured document | |
| JP2000339306A (en) | Document preparing device | |
| JPH1166095A (en) | Data management device | |
| CN111581440A (en) | Hardware acceleration B + tree operation device and method thereof | |
| JP2000003366A (en) | Document registration method, document search method, its execution device, and medium recording processing program for it | |
| JP2925042B2 (en) | Information link generation method | |
| JPS63178321A (en) | Tree scanning method | |
| JPS63132339A (en) | Tree scanning method and device | |
| JPH0581102A (en) | System for controlling table | |
| CN120067713B (en) | A heterogeneous collaborative subgraph matching method for dynamic graphs | |
| JP3395362B2 (en) | Document processing device | |
| JPH10307840A (en) | Information processing apparatus and method | |
| JP3037776B2 (en) | Term decomposition device | |
| JPH11175376A (en) | Updating method and updating device for data base and recording medium in which updating method is written | |
| JP2002530785A (en) | Digital memory structure and device and management method thereof | |
| JP2002099688A (en) | Workflow management system and in-use item moving method | |
| JPH06175862A (en) | Electronic computer | |
| JPH05151292A (en) | Route search processing method | |
| JPH07210570A (en) | Directed graph editing processor | |
| JPS62248031A (en) | Data managing method | |
| JP2003006196A (en) | Data retrieval apparatus, method, program and data structure | |
| JPH1153246A (en) | Automatic updating apparatus and method for hyperlink device | |
| JPH064341A (en) | Debug information access method |