Skip to main content

A Model for Datalanguage Semantics (Part 2)

4.4 Some examples​

Here are some examples of structures involving objects, descriptions, and values. In these explanations and drawings, the objective is to convey some ideas about these primitive structures; considerable detail is omitted in the drawings in the interest of clarity.

Figure 4-1 shows two objects. X is of type string and has value 'ABC'. Y is of type bool and has value TRUE.

                _________________
| |
| _____________ |
| | X | |
| |_____________| |
| NAME | ____________
| _____________ | | ________ |
| | ____|_|______\| | STRING | |
| |_____________| | /| |________| |
| DESCRIPTION | | TYPE |
| _____________ | |____________|
| | | | DESCRIPTION
| |_________|___| |
| VALUE | | ____________
|___________|_____| | |
OBJECT |____________\| "ABC" |
/|____________|
VALUE
_________________
| |
| _____________ |
| | Y | |
| |_____________| |
| NAME | ____________
| _____________ | | ________ |
| | ____|_|______\| | BOOL | |
| |_____________| | /| |________| |
| DESCRIPTION | | TYPE |
| _____________ | |____________|
| | | | DESCRIPTION
| |_________|___| |
| VALUE | | ____________
|___________|_____| | |
OBJECT |____________\| TRUE |
/|____________|
VALUE

Figure 4-1
Two elementary objects

Figure 4-2 illustrates an object of type dir (a directory) and related objects. The directory has name SMITH. There are two objects entered in this directory, named X and Y.

               _________________
              |  _____________  |
              | |    SMITH    | |
              | |_____________| |
              |  NAME           |        ____________
              |  _____________  |       |  ________  |
              | |         ____|_|______\| |  DIR   | |
              | |_____________| |      /| |________| |
              |  DESCRIPTION    |       |  TYPE      |
              |  _____________  |       |____________|
              | |             | |        DESCRIPTION
              | |_________|___| |
              |  CHILD    |     |
              |___________|_____|
               OBJECT     |
               ___________V_____
              |  _____________  |
              | |      X      | |
              | |_____________| |
              |  NAME           |       _________________
              |  _____________  |      |  _____________  |
         _____|_|____         | |      | |      Y      | |
        |     | |_____________| |      | |_____________| |
        |     |  DESCRIPTION    |      |  NAME           |
        |     |  _____________  |      |  _____________  |
        |   __|_|____         | |      | |         ____|_|_____
        |  |  | |_____________| |      | |_____________| |     |
        |  |  |  VALUE          |      |  DESCRIPTION    |     |
        |  |  |  _____________  |      |  _____________  |     |
        |  |  | |         ____|_|_____\| |         ____|_|__   |
        |  |  | |_____________| |     /| |_____________| |  |  |
        |  |  |  SIBLING        |      |  VALUE          |  |  |
        |  |  |_________________|      |_________________|  |  |
        |  |   OBJECT                   OBJECT              |  |
        |  |   _________________        _________________   |  |
        |  |_\|      "ABC"      |      |      FALSE      |/_|  |
        |    /|_________________|      |_________________|\    |
        |      VALUE                    VALUE                  |
        |      _________________        _________________      |
        |     |  _____________  |      |  _____________  |     |
        |     | |    STRING   | |      | |     BOOL    | |     |
        |____\| |_____________| |      | |_____________| |/____|
             /|  TYPE           |      |  TYPE           |\
              |_________________|      |_________________|
               DESCRIPTION              DESCRIPTION

                Figure 4-2: A directory with two members

The idea of a dir is similar to the idea of a file directory in most systems. A directory is a place where one can store named objects, freely adding and deleting them. The entries in the directory are all objects whose parent is that directory. Figure 4-3 shows a more rigidly structured group of objects. Here we have R, a struct, and A and B, a pair of strings. Note that the boxes labeled 'object' in figure 4-3 bear precisely the same relationships to one another as those labeled 'object' in 4-2. However, there are two conditions which hold for 4-3 but do not hold for 4-2: (1) the value of R contains the values of A and B, and (2) the descriptions of R, A and B are all related.

Structs have the following properties: (1) name and description of each component in the struct is established when the struct is created, and (2) in a value of the struct, the order of occurrence of component values is fixed.

       _________________         _________________
      |  _____________  |       |  _____________  |
      | |      R      | |       | |    STRUCT   | |
      | |_____________| |       | |_____________| |
      |  NAME           |       |  TYPE           |
      |  _____________  |       |  _____________  |
      | |         ____|_|______\| |             | |
      | |_____________| |      /| |__________|__| |
      |  DESCRIPTION    |       |  CHILD     |    |
      |  _____________  |       |____________|____|
 _____|_|____         | |        DESCRIPTION |
|     | |_____________| |        ____________V____
|     |  VALUE          |       |  _____________  |
|     |  _____________  |       | |    STRING   | |
|     | |             | |       | |_____________| |
|     | |_________|___| |   ___\|  TYPE           |        _____________
|     |  CHILD    |     |  |   /|  _____________  |       |  _________  |
|     |___________|_____|  |    | |         ____|_|______\| | STRING  | |
|      OBJECT     |        |    | |_____________| |      /| |_________| |
|                 |        |    |  SIBLING        |       |  TYPE       |
|      ___________V_____   |    |_________________|       |_____________|
|     |  _____________  |  |     DESCRIPTION           DESCRIPTION    A
|     | |      A      | |  |                                          |
|     | |_____________| |  |     _________________                    |
|     |  NAME           |  |    |  _____________  |                   |
|     |  _____________  |  |    | |      B      | |                   |
|     | |         ____|_|__|    | |_____________| |                   |
|     | |_____________| |       |  NAME           |                   |
|     |  DESCRIPTION    |       |  _____________  |                   |
|     |  _____________  |       | |         ____|_|___________________|
|   __|_|____         | |       | |_____________| |
|  |  | |_____________| |       |  DESCRIPTION    |
|  |  |  VALUE          |       |  _____________  |
|  |  |  _____________  |       | |         ____|_|____
|  |  | |         ____|_|______\| |_____________| |    |
|  |  | |_____________| |      /|  VALUE          |    |
|  |  |  SIBLING        |       |  _____________  |    |
|  |  |_________________|       | |             | |    |
|  |   OBJECT                   | |_____________| |    |
|  |                            |  SIBLING        |    |
|  |                            |_________________|    |
|  |__________                   OBJECT   _____________|
|      _______|__________________________|_______
|____\|  _____V_______            _______V_____  |
     /| |    "ABC"    |          |     FALSE   | |      Figure 4-3
      | |_____________|          |_____________| |     A STRUCT with
      |__________________________________________|      two members

Figure 4-4 shows a list named L. Here a similar structure of objects is implied, but because of the regularity of the structure, not all the boxes labeled 'object' are actually present.

               _________________
| _____________ |
| | L | |
| |_____________| |
| NAME | ____________
| _____________ | | ________ |
| | ____|_|______\| | LIST | |
| |_____________| | /| |________| |
| DESCRIPTION | | TYPE |
| _____________ | | ________ |
| | | | | | | |
| |_______|_____| | | |______|_| |
| VALUE | | | CHILD | |
|_________|_______| |________|___|
OBJECT | DESCRIPTION |
| |
_________V_______ ________V___
| | | ________ |
| _____________ | | | STRING | |
| | "ABC" | | | |________| |
| |_____________| | | TYPE |
| _____________ | |____________|
| | "XY" | | DESCRIPTION
| |_____________| |
| _____________ |
| | "ZLM" | |
| |_____________| |
| : |
| : |
| _____________ |
| | "BBBF" | |
| |_____________| |
|_________________|
VALUE

Figure 4-4
A LIST

L has a variable number of components, all satisfying the description subordinate to L's description.

We could imagine an 'object' box for each string in L. Each of these boxes would point to its respective string and to the common description of these strings. Instead, we think in terms of creating such boxes as we need them.

4.5 Definitions of types​

Following are some more precise definitions of types, in terms of the present model. These serve the purpose of establishing more firmly the semantics of our structure of objects, descriptions and values; however, they should not be thought of as providing a definition for the completed language specification.

An object of type STRING has a value which is a sequence of characters (figure 4-1).

An object of type BOOL has a value which is a truth value (TRUE or FALSE -- figure 4-1).

An object of type DIR has subordinate objects, each having its own description and value. Subordinate objects can be added and deleted at will (figure 4-2).

An object of type STRUCT has subordinate objects, each of which has a description which is subordinate to the STRUCT's description, and a value contained in the STRUCT's value. The number, order and description of components is fixed when the STRUCT is created (figure 4-3).

An object of type LIST may be thought of as having imaginary subordinate objects, whose existence is simulated by the use of appropriate techniques in processing the LIST. Each of these has the same description, which is subordinate to the description of the LIST. Each has a distinct value, contained in the value of the LIST. In fact, only the LIST object, the LIST and component descriptions, and the values exist (figure 4-4).

An object of type DESC has a description as its value. This value is the same sort of entity which serves as the description of other objects.

An object of type FUNC has a function call as its value. We will be able to say more about this after functions have been discussed.

An object of type OPD has an operation descriptor as its value. (see 4.7 for details).