File Information
File: 05-lr/acl_arc_1_sum/cleansed_text/xml_by_section/metho/65/c65-1026_metho.xml
Size: 27,143 bytes
Last Modified: 2025-10-06 14:11:04
<?xml version="1.0" standalone="yes"?> <Paper uid="C65-1026"> <Title>SPECIFICATIONS FOR A TREE PROCESSING LANGUAGE F.</Title> <Section position="2" start_page="26" end_page="26" type="metho"> <SectionTitle> AUTONOMY variable </SectionTitle> <Paragraph position="0"> can be used. Upon execution of this statement data referred to by the variable are copied down in some part of the storage and the variable is made autonomous. To change the status in the other direction, from autonomous to connected, some later described transformation statements have to be used. Generally, some statements may change the autonomy status of a variable. These changes will be described with these commands, It is possible to check the autonomy status of a variable. The predicate B AUTONOMY variable performs this function. B stands for a logical variable (variable ranging over bit strings of length one). B is set to True if the argument variable is autonomoas, to False otherwise.</Paragraph> <Section position="1" start_page="26" end_page="26" type="sub_section"> <SectionTitle> Value Assignment Statements </SectionTitle> <Paragraph position="0"> In the forthcoming chapters statements will be described which assign values to variables. If the variable to which values are assigned has already a non-empty value list the new values assigned to this variable will be added to the list, at the beginning of it, in a &quot;pushdown&quot; manner, Value assignment statements use also variables sometimes, as arguments of the statement. In such a case the first item on the value list of the argument variable is taken into consideration, and referred to hereafter as &quot;the value&quot; of the variable, though other values may follow it on the list. If the value list is empty) the value assignment statement amounts to a non-operation.</Paragraph> <Paragraph position="1"> Parent referencing is another problem that arises naturally in value assignment statements, that is to say the problem of naming the data where from the variable will get values assigned, according to the specifications of the statement. Two cases exist: (a) The parent reference is mandatory in the value assignment command. This is the case when the statement has no sense at all without a parent reference.</Paragraph> <Paragraph position="2"> (b) The parent reference is optional. In this case the following rules prevail: if it is mentioned, the value assigned is entirely contained in the specified parent reference, or else (if no suitable values are found within the reference) the assignment statement is a nonoperation. If it is not mentioned, values will be collected from the largest autonomous data to which the argument variable value of the value assignment statement is connected.</Paragraph> <Paragraph position="3"> Parent References are of the form (in Vn}, where Vn is a variable name (Tree or String). In the forthcoming chapters they will be mentioned, in statement descriptions, as &quot;Optional Parent Reference&quot; or &quot;Mandatory Parent Reference&quot;. The word &quot;parent&quot; might be replaced by &quot;string&quot;, or &quot;tree&quot;, etc. when a restrictive condition of this nature prevails, according to the nature of the statement.</Paragraph> <Paragraph position="4"> Value Assignment to Lexical Variables Assigning a value to a lexical variable can take place, in principle, in three possible ways: (1) Absolute Assignment - The lexical value collected from a tree or a string is designated by its &quot;absolute location&quot; in the parent structure, i.e., its Iverson's index vector in the tree case, or its constituent serial number in the string case. (See below for detailed explanation. ) (Z) Associative Assignment - This kind of value assignment takes place by naming that lexical value in the parent tree or string, which the user desires to assign as variable value. In this case the variable may be supplied with a value list, instead of a single value. This happens when the specified lexical value occurs more than once in the parent structuredeg The value list will then contain entries h~.ving identical lexical values but each of these entries having different connections with the parent structure.</Paragraph> <Paragraph position="5"> (3) Relative Assignment - This type of assignment uses another variable, as argument, and determines the value to be assigned in function of the value of the argument variable.</Paragraph> <Paragraph position="6"> We are going now into the details of value assignment to lexical variables. From the autonomy status point of view the following rules prevail (also valid for value assignment to string and tree variables): if the variable to which value is assigned is currently operated in the connected mode, connections with the parent structure will be conserved in the usual way. If the variable is autonomous, these connections are -lost and only lexical values (without their &quot;position information&quot;) and possible tags are transmitted.</Paragraph> <Paragraph position="7"> In order to enable the user to assign an arbitrary lexical value to a cariable (not necessarily collected from a tree or a string), the following statement is permissible: Ln = LEXICAL lexical/ m The lexical value &quot;lexical&quot; is assigned to Ln. m is an optional integer representing a tag. Words written in upper case letters represent throughout this paper - statement keywords.</Paragraph> <Paragraph position="8"> Absolute value assignments to lexical variables are of the form: (I) Ln = (m I, mz, (~) Ln = LEFT k (3) Ln = RIGHT k &quot; In the tree case, (m I, m Z, .</Paragraph> <Paragraph position="9"> vector; each m. is an integer, m 1 deg . deg rnk) Mandatory Tree Reference</Paragraph> </Section> <Section position="2" start_page="26" end_page="26" type="sub_section"> <SectionTitle> Mandatory String Reference </SectionTitle> <Paragraph position="0"/> <Paragraph position="2"> mk) denotes an Iverson's index O @ = 1 and it denotes the root of the meaning any integer in that position II f! I! ff !1 If except the enumerated ones (each k. is an integer) the signs:</Paragraph> <Paragraph position="4"> tree, m Z selects the m E -th sibling among the immediate successors of the root, m 3 selects the m 3 -th sibling among the immediate successors of the tree element selected by the previous portion of the index vector, and so on, until m k selects a final tree element that will become the value to be assigned to Lndeg In the string case, k is an integer and LEFT k of RIGHT k assigns, respectively, the k-th constituent from the left or from the right end of the string, as value to Lndeg Associative value assignments to lexical variables are of the form: Lm = lexical/tag Mandatory Parent Reference In the right side of the statement &quot;lexical&quot; denotes a lexical value and &quot;tag&quot; the description of a tagdeg One of the two descriptions &quot;lexical&quot; and &quot;tag&quot; might be omitted. The parent structure is searched for all elements or constituents that match the specified lexical value and/or the specified tag. The selected elements are added to the value list of Lno A tag specification is of the form: a, az, o . an where n is the number of digits in the tag; each a. is either an integer or an integer variable specifying the required digit in the i-th position, or one of (k 1 / k 2 / . . . / km) meaning one of the enumerated integers.</Paragraph> <Paragraph position="5"> Relative value assignments to lexical variables are of the form: Ln = NEIGHBOR Lm Optional Parent Reference where NEIGHBOR stands for one of the following keywords: ANCESTOR, L-SIBLING, R-SIBLING, L-SUCCESSOR, R-SUCCESSOR.</Paragraph> <Paragraph position="6"> The interpretation of these keywords depends on the Parent Reference, whether it is explicitly stated or not. If the Parent Structure is a tree, the interpretation is the following: (1) ANCESTOR: the nearest tree element to which the value of Lm is connected in the direction of the root of the tree.</Paragraph> <Paragraph position="7"> (2) L-SIBLING: the element preceding the value of Lm.</Paragraph> <Paragraph position="8"> in its sibling set.</Paragraph> <Paragraph position="9"> (3) R-SIBLING: the element following the value of Lm in the sibling s eto (4) L-SUCCESSOR: the first element in the sibling set whose ancestor is the value of Lm.</Paragraph> <Paragraph position="10"> (5) R-SUCCESSOR: the last element in the sibling set whose ancestor is the value of Lm.</Paragraph> <Paragraph position="11"> If the Parent Structure is a string, L-SIBLING and L-SUCCESSOR both denote the constituent to the left of the value of Lm, while R-SIBLING and R-SUCCESSOR denote the string constituent to its right. ANCESTOR denotes the leftmost constituent in the string.</Paragraph> <Paragraph position="12"> In all these statements the argument variable Lm has to be currently operated in the connected mode. The selected value, depending on which keyword is used and what the parent structure is, is assigned to the value list of Ln.</Paragraph> <Paragraph position="13"> In obvious cases the &quot;empty&quot; value might be assigned to Ln. Value Assignment to String Variables String value assignments are also absolute, associative or relative. The autonomy rules are analogous to the ones used in value assignments to lexical variables, except if stated otherwise. In order to enable the user to assign an arbitrary value to a string variable not necessarily collected from a parent structure - the following statement is permissible:</Paragraph> <Paragraph position="15"> (1) A lexical value with an optional tag (of the form lexical/ tag) (Z) a lexical variable (3) a string variable.</Paragraph> <Paragraph position="16"> The statement performs the concatenation in the order shown in the statement body, by taking the first items on the value lists of the variables involved. Parent connections of these values are not taken into consideration and Sn is made automatically autonomous (if it wasn't already), its value is the concatenated set of lexical values, with possible tagsdeg Absolute value assignment to string variables is of the form: Sn = LEVEL k Mandatory Tree Reference k is an integer selecting the k-th level of the tree referred todeg The k-th level of a tree is the string whose constituents are at distance k from the root, the distance being measured in number of subsequent ancestors up to the root.</Paragraph> <Paragraph position="17"> Lm being a connected variable, relative assignment to string variables takes place with the help of a statement of the form: Sn = WORD Lm Optional Parent Reference WORD stands for one of the keywords enumerated below; the interpretation of these keywords depends on the Parent Structure (explicite or implied) being a tree or a string. The table below enumerates all The ancestor string of the argument element is the one that connects it to the root of the tree.</Paragraph> <Paragraph position="18"> The successor string of the argument element is the sibling set having the argument ancestor element.</Paragraph> <Paragraph position="19"> as The L-successor string is the one composed of the sequence of subsequent L-SUCCESSOR elements in the downward direction.</Paragraph> <Paragraph position="20"> Same definition as above, taking the subsequent R-SUCCESSOR elements.</Paragraph> <Paragraph position="21"> but The sibling string of the argument is the successor string of its ancestor element.</Paragraph> <Paragraph position="22"> The part of the sibling string preceding the argumentdeg The longest string in which the argument is a constituent. null Same as ANCESTOR The left portion of the string upto the argument constituent.</Paragraph> <Paragraph position="23"> The right portion c~ the string from the argument constituent.</Paragraph> </Section> </Section> <Section position="3" start_page="26" end_page="26" type="metho"> <SectionTitle> R-SIBLING The part of the sibling string </SectionTitle> <Paragraph position="0"> following the argument.</Paragraph> <Paragraph position="1"> Same as R-SUCCESSOR TERMINAL The terminal string of the argu- Same as ANCESTOR ment element is composed of elements having empty successor strings and on whose ancestor strings the argument element is a constituent.</Paragraph> <Paragraph position="2"> All these statements assign the selected string as value to Sno Associative assignment to string variables takes place with a statement of the form Sn = STRING (kl, k z string structure specification) Mandatory String Reference. String structure specification is a string over the alphabet of lexical values and a few special signs; - we are going to call it a metastring0 It describes the internal composition of the Parent Reference. k I and k 2 stand for integers or integer variables denoting the k I -th and the k 2 -th constituent of the metastring0 The portion of the metastring falling between these constituents delimits a portion of the parent string. Upon execution of the statement this portion of the Parent String is attributed as value to Sno In case of more than one portion referred to in the parent string, the leftmost one is taken into consideration. In case of &quot;nomatch&quot; Sn gets the empty value.</Paragraph> <Paragraph position="3"> The metastring's internal composition is very close to the one used by the programming language COMIT. If AAAAA . . o AAAA is the form of such a metastring~ where A stands for one of its constituents, the following context-free grammar (or Backus Normal Form) would generate it: (meaning any string except the ones described by the b's. ) (meaning n arbitrary consecutive constituents in the parent string; n stands for an integer. $0 denotes the empty string. ) meaning an arbitrary string within the parent string, the empty string included. ) any lexical value/ tag description combination as described in a previous chapter.</Paragraph> <Paragraph position="4"> (meaning the first value of the variable involved, tag included, and the position, if the variable is connectedo) Value Assisnment to Tree Variables In order to enable the user to assign an arbitrary value to a tree variable, the following statement is permissible (the equivalent of the LEXICAL and CONCATENATE statements in the previous cases): Tn = STRUCTURE k I A k Z A .... knA where each k. is a level number (see COBOL, INrPL) and each A stands for one of the following possibilities: (I) A lexical value with an optional tag (Z) A lexical variable (3) A tree variable If A is a tree variable the subsequent level number should not be superior to the preceding onedeg The statement builds a tree according to the structure shown by the level numbers, by taking the first items on the value lists of the variables involved, without position information. This tree is assigned as value to Tn~ by making Tn automatically autonomous.</Paragraph> <Paragraph position="5"> Absolute, associative and relative value assignments to tree variables cannot be so clearly separated as in the previous cases. The following statement amalgamates various kinds of assignments: Tn = TREE Lm, A Optional Tree Reference where Lm is a connected variable and A is an optional list of constituents of the form (al, azP the following possibilities: (1) A lexical variable (z) ak)o_ Each a.1 stands for one of $ A lexical value and/or a tag description (see a previous chapter on the specifications) The effect of the statement is the following: a subtree is selected whose root is the value of Lm. If the A-list is empty, this entire subtree is assigned, as value, to Tn. If the A-list is not empty, all the subtree elements matched by the A-list are considered terminal (i.e. their successors are neglected) and the assigned tree value stops - at its bottom - with these matched elements. In case of conflict the element closer to the root is considered terminal. The autonomy rules are like in the previous cases.</Paragraph> <Paragraph position="6"> The following statement provides for obtaining the parent tree of a string or lexical variable:</Paragraph> <Paragraph position="8"> The broadest autonomous tree containing the argument is assigned, as value, to Tn,</Paragraph> <Section position="1" start_page="26" end_page="26" type="sub_section"> <SectionTitle> Movement of Variables </SectionTitle> <Paragraph position="0"> Variable values have to be moved, erased, :ransmitted, etc0 The following statements provide for these operations:</Paragraph> <Paragraph position="2"> where Vn and Vm are variables of the same type and k is an unsigned integer. The first k values on the value list of Vm are added to the value list of Vn, by &quot;pushing down&quot; the previous values on the list of Vn. The value list of Vm remains unchanged.</Paragraph> <Paragraph position="3"> The statement PUSHUP Vn.. k erases the first k values on the list of Vno In both cases, if k is superior to the number of values on the list, the operation stops after the exhaustion of values.</Paragraph> </Section> <Section position="2" start_page="26" end_page="26" type="sub_section"> <SectionTitle> Structure Questions </SectionTitle> <Paragraph position="0"> The user can question the structure of a variable value by comparing it to a given or partially specified pattern. The general form of such a question is: B Assignment Statement where B is a logical variable (bit string of length one) and Assignment Statement stands for any of the assignment statements described in the previous chaptersdeg The interpretation of an assignment statement in a structure question is different, however, from its original interpretatiOno An assignment statement is of the form:</Paragraph> <Paragraph position="2"> and the = sign assigns a value to Vn, according to the specification.</Paragraph> <Paragraph position="3"> When an assignment statement enters a structure question no value assignment takes place, the = sign means equality between the variable value and the specification. In case of equality B is set to True, to False otherwise.</Paragraph> <Paragraph position="4"> Below we list these structure questions with their interpretation. (In the list the various types of parent references are abbreviated. )</Paragraph> </Section> <Section position="3" start_page="26" end_page="26" type="sub_section"> <SectionTitle> Assignment Statement Structure Question Interpretation </SectionTitle> <Paragraph position="0"/> <Paragraph position="2"> Is the value of Ln equal to &quot;lexical&quot; and to the tag? Does Ln occupy the position specified by the index vector in the specified parent tree? Does Ln occupy the k-th constituent position in the specified parent string? Does Ln match lexical/tag and is it in the specified parent structure? Is the position of Ln in agreement with the specification? Is Sn composed of the constituents specified, position information being disregarded? Does Sn correspond to the k-th level string in the specified parent tree? Sn = STRING (kl, k2, specifdeg ) MSR Does Sn match the specification? As signment State ment Structure Question Interpretation</Paragraph> <Paragraph position="4"> Is the position of Sn in agreement with the specification? Is the tree value Tn composed as indicated by the structure description, position information disregarded? null Is Tn the subtree extending as indicated? Tn = PARENT Lm or Sm Are Lm or Sm located in Tn? All these structure questions compare the first item on the value list of the variable involved with the pattern specification. If the user desires to search through the whole value list he can formulate his structure question as:</Paragraph> </Section> </Section> <Section position="4" start_page="26" end_page="26" type="metho"> <SectionTitle> B EXTRACT Assignment Statement </SectionTitle> <Paragraph position="0"> In this case the whole value list is searched through and the first item encountered satisfying the pattern specification is extracted and put at the top of the value list, while B is set to True. If no item satisfying the pattern specification is encountered B is set to False and the value list remains unchanged.</Paragraph> <Paragraph position="1"> In a previous chapter the CREATE statement was described that creates an autonomous variable with an empty value list. The question</Paragraph> <Section position="1" start_page="26" end_page="26" type="sub_section"> <SectionTitle> Equality Tests </SectionTitle> <Paragraph position="0"> Given two variables Vn and Vm of the same type (both lexical, or both string or both tree) the following statement tests the equality of the variable values: B Vm - Vn whereB is a bit string of length three. The setting to True or False of this bit string is as follows: First bit True is the lexical composition of Vm is identical to the one of Vn, tags and autonomy status being disregarded. Second bit True if the largest parent structures are identical or if both variables are autonomous.</Paragraph> <Paragraph position="1"> Third bit True if the two index vectors are identicaldeg The index vector of a lexical value has been defined earlier, for string and trees it is - respectively - the index vector of the leftmost constituent and of the root. The parent structures may be different and yet the third bit set to True. If both variables are autonomous the bit is set to True.</Paragraph> <Paragraph position="2"> Numerical properties of. Data and Variables The following statements establish connections between variables and their numerical properties: X being a numeric (decimal) variable the statement X= NUMBER Vn assigns to X, as value, the number of items on the value list of Vn. The statement</Paragraph> <Paragraph position="4"> assigns to X, as value, the number one if Vn is a lexical variable, the number of constituents or tree elements of the value of Vn, if this latter is a string or tree variable. The statements implementing tag handling are:</Paragraph> <Paragraph position="6"> which assigns X, as tag, to the value of Ln.</Paragraph> <Paragraph position="7"> Transformations Transformation statements change strings and tree:~ into new strings and trees. During the processing of a transformation data may move, or get deleted. This raises the following problem: variable values are affected by these movements and they must be correspondingly modified, updated, deleted, etc. The relevant conventions are as follows: Whenever a piece of data moves all variable values equal to or entirely contained in that piece of data, have their connections updated, in function of the new position the piece of data moved occupies. If, instead of being moved, the piece of data is deleted, all variable values equal to or entirely contained in the piece of data deleted are deleted.</Paragraph> <Paragraph position="8"> Variable values overlapping with data moved or deleted are either modified or deleted. They are deleted in the following cases: (I) The argument of the assignment statement which defined the value gets deleted. (Ec. Sn - ANCESTOR Ln and Lm gets deleted by a t ransformation; then the corresponding value of</Paragraph> </Section> <Section position="2" start_page="26" end_page="26" type="sub_section"> <SectionTitle> String Transformations </SectionTitle> <Paragraph position="0"> The string transformation statement of the Processor is strongly inspired by the &quot;Rewriting rule&quot; of the COMIT programming language, but it is adapted to strings embedded in trees too.</Paragraph> <Paragraph position="1"> In the case of an autonomous string the transformation statement is a straightforward adaptation of the COMIT rule. Its form is: string structure specification = REWRITE rewrite indication Mandatory String Reference.</Paragraph> <Paragraph position="2"> The &quot;string structure specification&quot; is identical to the one used in the description of the STRING statement, in the chapter on value assignments to string variables. The &quot;rewrite indication&quot; is a sequence composed of: (I) Integers sequentially numbering the constituents of the &quot;string structure specification&quot; and showing the new position (or deletion, if an integer is omitted in the &quot;rewrite indication&quot;) of these constituents after transformation of the string.</Paragraph> <Paragraph position="3"> (2) Lexical values and string and lexical variables introducing new constituents into the string to be transformed.</Paragraph> <Paragraph position="4"> The statement verifies if the &quot;string structure specification&quot; matches the Parent Reference. In case of no match, no transformation takes place. In case of match the string is rewritten in the order of the constituents indicated by the &quot;rewrite indication&quot;.</Paragraph> <Paragraph position="5"> In the case of strings connected to trees two classes of strings have to be distinguished: vertical and horizontal strings. A string embedded in a tree is horizontal if no constituent of the string is the tree-ancestor element of another constituent. It is vertical in the opposite case.</Paragraph> <Paragraph position="6"> For vertical strings the form of the REWRITE statement is identical with the one for autonomous strings, its interpretation is, however, different: in case of match, if a constituent is moved or deleted, the entire subtree whose root is the constituent in question, is also moved or deleted, except that branch of the subtree which has an element in the string to be transformeddeg Moreover, in the new position, the former order of the elements of the moved constituent's successor string is maintained; if an element of this successor string didn't participate in the move - because of the above mentioned restriction - it is replaced by the new left neighbor of the moved constituent in the string.</Paragraph> <Paragraph position="7"> For horizontal strings the form of the REWRITE statement is slightly different:in the &quot;rewrite indication&quot; each constituent must have a left parenthesis somewhere to its left and a right parenthesis somewhere to its right and no other parenthesis can appear between the constituent and these parentheses. In other words the whole &quot;rewrite indication&quot; is simply bracketed. A left parenthesis might be followed by a right parenthesis, with no constituent in between, this couple being placed in the &quot;rewrite indication&quot;. After transformation in case of match, constituents between the same couple of parentheses will have the same ancestor element in the tree, in left-to-right order of the parenthesis couples and of the possible ancestor elements of the stringdeg A couple of parentheses with no constituent in between attributes no constituent of the string to the ancestor element in that position.</Paragraph> </Section> </Section> class="xml-element"></Paper>