Skip to main content

A Model for Datalanguage Semantics (Part 4)

A class of primitive functions for manipulating LISTs is defined. These are called listops. All listops input a special object called an operation_descriptor or OPD.

To accomplish a complete operation on a LIST, a sequence of listops must be executed. There are semantic restrictions on the composition of such sequences, and it is best to think of the entire sequence as one large operation. The state of such an operation is maintained in the OPD.

Refer back to figure 4-4. There is one box labeled "object" in this picture; this box represents the list as a whole. To operate on any given member we need an object box to represent that member. Figure 4-8 shows the structure with an additional object box; the new box represents one member at any given moment. Its value is one of the components of the LIST value; its description is subordinate to the LIST description. In 4-8, the name of this object is M.

In 4-8 we have enough structure to provide a description and value for M, and this is sufficient to permit the execution of operations on M as an item. However, there is no direct link between object M and object L. The structure is completed by the addition of an OPD, shown in figure 4-9.

       _________________         _________________
      |                 |       |  _____________  |
      |  _____________  |       | |             | |
      | |      L      | |       | |_____________| |
      | |_____________| |       |  TYPE           |
      |  NAME           |       |  _____________  |
      |  _____________  |       | |             | |
      | |         ____|_|______\| |__________|__| |
      | |_____________| |      /|  CHILD     |    |
      |  DESCRIPTION    |       |____________|____|
      |  _____________  |        DESCRIPTION |
      | |             | |                    |
      | |_________|___| |        ____________V____
      |  VALUE    |     |       |  _____________  |
      |___________|_____|       | |    STRING   | |/___
       OBJECT     |             | |_____________| |\   |
                  |             |  TYPE           |    |
       ___________V_____        |_________________|    |
      |                 |        DESCRIPTION           |
      |  _____________  |                              |
      | |    "ABC"    | |        _________________     |
      | |_____________| |       |                 |    |
      |  _____________  |       |  _____________  |    |
      | |     "XY"    | |       | |      M      | |    |
      | |_____________| |       | |_____________| |    |
      |  _____________  |       |  NAME           |    |
      | |    "ZLM"    |/|___    |  _____________  |    |
      | |_____________|\|   |   | |         ____|_|____|
      |        :        |   |   | |_____________| |
      |        :        |   |   |  DESCRIPTION    |
      |  _____________  |   |   |  _____________  |
      | |    "BBBF"   | |   |___|_|____         | |
      | |_____________| |       | |_____________| |
      |_________________|       |  VALUE          |
       VALUE                    |_________________|
                                 OBJECT

                               Figure 4-8
                        LIST and member objects
       _________________         _________________
      |  _____________  |       |  _____________  |
      | |      L      | |       | |             | |
      | |_____________| |       | |_____________| |
      |  NAME           |       |  TYPE           |
      |  _____________  |       |  _____________  |
      | |         ____|_|______\| |             | |
      | |_____________| |      /| |__________|__| |
      |  DESCRIPTION    |       |  CHILD     |    |
      |  _____________  |       |____________|____|
      | |             | |/__     DESCRIPTION |
      | |_________|___| |\  |    ____________V____
      |  VALUE    |     |   |   |  _____________  |
      |___________|_____|   |   | |    STRING   | |/___
       OBJECT     |         |   | |_____________| |\   |
                  |         |   |  TYPE           |    |
       ___________V_____    |   |_________________|    |
      |  _____________  |   |    DESCRIPTION           |
      | |    "ABC"    | |   |    _________________     |
      | |_____________| |   |   |                 |    |
      |  _____________  |   |   |  _____________  |    |
      | |     "XY"    | |   |___|_|____         | |    |
      | |_____________| |       | |_____________| |    |
      |  _____________  |       |  LIST           |    |
      | |    "ZLM"    | |       |  _____________  |    |
      | |_____________| |       | |             | |    |
      |        :        |       | |_________|___| |    |
      |        :        |       |  MEMBER   |     |    |
      |  _____________  |       |     :     |     |    |
      | |    "BBBF"   |/|___    |     :     |     |    |
      | |_____________|\|   |   |___________|_____|    |
      |_________________|   |    OPD        |          |
       VALUE                |    ___________V_____     |
                            |   |  _____________  |    |
                            |   | |      M      | |    |
                            |   | |_____________| |    |
                            |   |  NAME           |    |
                            |   |  _____________  |    |
                            |   | |         ____|_|____|
                            |   | |_____________| |
                            |   |  DESCRIPTION    |
                            |   |  _____________  |
                            |___|_|____         | |
                                | |_____________| |
         Figure 4-9             |  VALUE          |
    OPD, LIST and member        |_________________|
                                 OBJECT

The OPD establishes the object relationship, and contains information about the sequence of primitive listops in progress. When sufficient information is maintained in the OPD, we have in 4-9 a structure which is adequate for the maintenance of the integrity of the LIST and of the global list operation. In addition to LIST and member pointers, the OPD contains information indicating: (1) which suboperations are enabled for the sequence, (2) the current suboperation, (3) the instance number of the current LIST member, (4) an end-of-list indicator. The suboperations are add/member, delete/member, change/member and get/member. All apply to the current member. Only suboperations which have been enabled at the beginning of a sequence may be executed during that sequence; eventually, the advance knowledge of intentions that is implied by this will provide important information for concurrency control and optimization.

Presently, an OPD relates a single member object to a single LIST object. This imposes an important restriction on the class of operation sequences which can be expressed. Any LIST transformation requiring simultaneous access to more than one member must be represented as more than one sequence. (And we do not yet solve the problems implied in concurrent execution of such sequences, even when both are controlled by one process.)

Any transformation of a LIST can still be achieved by storing intermediate results in temporary objects; however, it is certainly more desirable to incorporate the idea of multiple current members into the semantics of the language, than it is to use such temporaries. An important future extension of the listops will deal with this problem.

There are six listops: listop/begin, listop/end, which/member, end/of/list, open/member and close/member.

Listop/begin and listop/end perform the obvious functions of beginning and terminating a sequence of listops. Listop/begin inputs LIST and member objects, an OPD, and a specification of suboperations to enable. It initializes the OPD, including establishment of the links to LIST and MEMBER objects. After the OPD-LIST-member relationship has been established, it is only necessary to supply the OPD and auxiliary parameters as input to a listop in the sequence. From the OPD everything else can be derived.

Listop/end clears the OPD and frees any resources acquired by listop/begin.

Which/member establishes the current member for any suboperations. This is either the first LIST member, the last LIST member, or the next LIST member. This listop merely identifies which member is to be operated on; it does not make the contents of the member accessible.

Open/member and close/member bracket a suboperation. The suboperation is indicated as an argument to open/member. Open/member always establishes a pointer from the member object to the member value; close/member always clears this pointer. In addition, each of these listops may take some action, depending on the suboperation.

The details of the action would be dependent on the representation of the LIST in storage, the size of a LIST member, and choices made in implementation.

Between execution of the open/member and the close/member, the data is accessible. It can always be read; in the case of the add/member and change/member suboperations, it can also be written into.

End/of/list tests a flag in the OPD and returns an object of type BOOL. The value of the object is the same as the value of the flag; it is TRUE if a get/member, change/member or delete/member would be unsuccessful due to a which/member having moved "beyond the end". T his listop is provided so that it is possible to write procedures which terminate conditionally when all members have been processed.

Get/struct/member provides the ability to handle STRUCTs. Given a STRUCT object which points to the STRUCT value, it will establish a pointer from a given member object to the member value. (The pointer it establishes is represented by a dashed line in figure 4-10).

 _________________         _________________
|  _____________  |       |  _____________  |
| |      F      | |       | |   STRUCT    | |
| |_____________| |       | |_____________| |
|  NAME           |       |  TYPE           |
|  _____________  |       |  _____________  |
| |         ____|_|______\| |             | |
| |_____________| |      /| |__________|__| |
|  DESCRIPTION    |       |  CHILD     |    |
|  _____________  |       |____________|____|
| |             | |        DESCRIPTION |
| |___________|_| |        ____________V____         _________________
|  VALUE      |   |       |  _____________  |       |  _____________  |
|  ___________|_  |       | |    STRING   | |       | |    STRING   | |
| |           | | |       | |_____________| |       | |_____________| |
| |_________|_|_| |       |  TYPE           |       |  TYPE           |
|  CHILD    | |   |       |  _____________  |       |  _____________  |
|___________|_|___|  ____\| |             | |       | |             | |
 OBJECT     | |     |    /| |_____________| |       | |_____________| |
            | |     |     |  SIBLING        |       |  SIBLING        |
            | |     |     |_________________|       |_________________|
            | |     |      DESCRIPTION               DESCRIPTION    A
            | |     |      ______________________________________   |
            | |     |     |  ____________          ____________  |  |
            | |     |     | |    "ABC"   |        |    FALSE   | |  |
            | |_____|_____| |____________|        |____________| |  |
            |       |     |________A_____________________________|  |
            |       |  ............:                        VALUE   |
 ___________V_____  |  :   _________________                        |
|  _____________  | |  :  |  _____________  |                       |
| |      A      | | |  :  | |      B      | |                       |
| |_____________| | |  :  | |_____________| |                       |
|  NAME           | |  :  |  NAME           |                       |
|  _____________  | |  :  |  _____________  |                       |
| |         ____|_|_|  :  | |         ____|_|_______________________|
| |_____________| |    :  | |_____________| |
|  DESCRIPTION    |    :  |  DESCRIPTION    |
|  _____________  |    :  |  _____________  |
| |         ....|.|....:  | |             | |
| |_____________| |       | |_____________| |
|  VALUE          |       |  VALUE          |
|  _____________  |       |  _____________  |
| |         ____|_|______\| |             | |
| |_____________| |      /| |_____________| |
|  SIBLING        |       |  SIBLING        |
|_________________|       |_________________|        Figure 4-10
 OBJECT                    OBJECT            Effect of GET/STRUCT/MEMBER