BASIC MLP LESSON 2D
Coordinate Conjunction Strings (and, or, but, ",")

Lesson 1A Lesson 1B Lesson 2X Lesson 2A Lesson 2B Lesson 2C Lesson 2D

-
The Fourth Update to eg2X — eg2D

Read Document 2X and Homework 2D.

Files in use:
Grammar 2D
Dictionary 2D
Parse directive 2D
The Old Stone Tower
Sentences 2D

The grammar eg2D introduces a limited conjunction mechanism. It provides for the conjoining of LXR type definitions and specified strings. The conjunctions are and, or, but and comma. The corresponding conjunction strings (new BNF definitions) are <ANDSTG>, <ORSTG>, <BUTSTG> and <COMMASTG>. An example of <ANDSTG> in an LXR type definition (<LNR>) is the portion and Vikings in arrowheads, buttons and Vikings; and (with a non-conjunctional comma preceding and) in arrowheads, buttons, and Vikings. An example of string conjoining is conjoined <ASSERTION>s (They found a tower and they dug under it). However, the grammar cannot handle conjoined <ASSERTION>s where the <SUBJECT> of the second <ASSERTION> is missing (They found a tower and dug under it). The missing second SUBJECT is actually a silent repeat of the preceding <SUBJECT> (They found a tower and [they] dug under it).

To incorporate the conjunction mechanism few changes are needed in the BNF component of the grammar. Most of the work is done by new and revised routines and restrictions. In addition to the four new BNF definitions mentioned above, there is <Q-CONJ>, whose initial value is <*NULL>. For example,

<ANDSTG> ::= AND <Q-CONJ> .
<Q-CONJ> ::= <*NULL> .

The <*NULL> is replaced in the course of parsing by a generated definition for the conjunction string (e.g. <ANDSTG>) based on the context in which it occurs. The generated structure repeats the parse tree structure which precedes the occurrence of the conjunction in the sentence. For example, when and occurs after an <ASSERTION> has been constructed (They found a tower), the content of <ANDSTG> can be another instance of <ASSERTION> (they dug under it).

The generation of conjunction strings is carried out within the execution of DCONJ0 by the operator GENERATE, which replaces the <*NULL> value of <Q-CONJ> by a repeat of the elements of the structure to which the conjunction string (e.g. <ANDSTG>) is attached. This is a case of interrupting the normal syntax-driven parsing procedure to dynamically generate new BNF definitions not originally in the grammar. The interrupt is signalled from the dictionary as soon as a conjunction word becomes the current sentence word to be analyzed. For example, and in the dictionary has the definition

AND
SPWORD: (ANDSTG).

This says that and is defined as belonging to the category SPWORD ("Special Process WORD"), which has the attribute ANDSTG, the name of the grammar definition associated with and. When and becomes the current sentence word to be analyzed, the parser begins the "special process" of generating an <ANDSTG>, which it then uses to parse the upcoming sentence words.

Several restrictions limit the nodes to which the very general Special Process mechanism is applied. Some others impose other constraints. In particular:

DCONJ0
generates the definition for Q-CONJ by going up and to the left, going through <COMMASTG> if the comma occurs as a punctuation comma, and then building under <Q-CONJ> the node it has located.
DCONJ1
checks that all preceding elements on the level of the conjunction string are not empty. For example, this will prevent the conjunction mechanism from trying to build a conjunction string when it encounters an and at the beginning of a sentence.
DCONJ2
prevents the attaching of a conjunction to the right of another conjunction.
DCONJ4
rules out a comma as a conjunction comma if no and or or or but follows.
DCONJ5
limits the nodes of the parse tree to which a conjunction string can be attached. This eliminates redundanies due to the way the string grammar is represented in BNF definitions. E.g. <NSTGO> is defined as <NSTG>; both will subsume the same sentence words, so if the parser generates a definition for <Q-CONJ> consisting of <NSTGO> CONJ <NSTGO> and another consisting of <NSTG> CONJ <NSTG>, these would produce redundant analyses.
WCONJ1
checks that an empty Q-CONJ has not been built.

In addition to the six new conjunction restrictions, the restrictions WAGREE and WAGREE-VO have been revised to take account of conjunctions. Also the new routine LOOKAHEAD is defined. It is used by DCONJ4, which checks for an and or but or or ahead before accepting a comma as a conjunction.

To accommodate conjunctions, the CORE routine is modified so that in descending through nodes of the parse tree it is blocked by ADJSET1, not ADJSET. ADJSET1 is a new type list that includes all the nodes listed in ADJSET and, in addition, ANDSTG, BUTSTG, COMMASTG, and ORSTG. This ensures that CORE will remain within the confines of one string and not pass through conjuncts, just as CORE was prevented by ADJSET from reaching into an adjunct instead of landing on the central element of an LXR type node.

The presence of a conjunction string also affects routines that move upward in the parse tree. For example, in parsing the phrase the tower that was built by the Vikings and that Columbus discovered, the permission to accept a <*NULLWH> as the value of <OBJECT> following the verb discovered (i.e. with '[ ]' representing <*NULLWH>: and that Columbus discovered [ ]) is given by the restriction WWH2, which uses the upward-looking routine NONSEG-IMMSTG to locate an immediate <WHS-N>. This routine must be modified to allow passage through a conjunction string (in this example <ANDSTG>) so as to reach the "omitting string" <WHS-N> that is above <ANDSTG> in the parse tree.

In addition to the six new conjunction restrictions, WAGREE, WAGREE-VO, WCOUNT1, and WVC1 have been revised to handle conjunctions (but not all cases). Also the new routine LOOKAHEAD is defined, used by DCONJ4 as noted above.

Another modification is the inclusion of an optional <INTRODUCER> preceeding <CENTER>. This may be either and or but (And then they dug). These words do not function as conjunctions within the sentence in which they occur. Since they are at the beginning of the sentence, there is no previous structure from which the dynamic generation of a conjunction string can be based.

A few additions are also needed in the dictionary, specifically the conjunction words.

CHANGES MADE IN THE GRAMMAR

*BNF
SENTENCE add INTRODUCER
INTRODUCER new
ANDSTG new
BUTSTG new
ORSTG new
COMMASTG new
Q-CONJ new
*LISTS
ADJSET1 new
STRING add Q-CONJ
*RESTR
LOOKAHEAD new
WAGREE revise for CONJUNCTION
WAGREE-VO revise for CONJUNCTION
DCONJ0 new
DCONJ1 new
DCONJ2 new
DCONJ4 new
DCONJ5 new
WCONJ1 new

CHANGES MADE IN THE DICTIONARY

AND add SPWORD:(ANDSTG)
BUT add SPWORD:(BUTSTG)
OR add SPWORD:(ORSTG)
',' add SPWORD:(COMMASTG)