Theme One • A Program Of Inquiry : 9

Re: Laws Of Form Discussions • (1)(2)(3)
Re: Peirce List Discussions • (1)(2)

We have seen how to take an abstract logical graph of a sort a person might have in mind to represent a logical state of affairs and translate it into a string of characters a computer can translate into a concrete data structure.

Now we look a little more closely at the finer details of those data structures, as they work out in this particular sequence of representations.

Coding Logical Graphs

It is possible to write a program that parses cactus expressions into fairly close facsimiles of cactus graphs as pointer graph structures in computer memory, doing this in such a way that edges correspond to addresses and nodes correspond to records.  I did exactly that in early forerunners of the present program, but it turned out to form a more robust strategy in the long run, in spite of the seemingly exorbitant investment in nodes at the outset, to implement a more articulate but more indirect type of parsing algorithm, one in which the punctuation marks are not just tacitly converted to addresses in passing but recorded as nodes in roughly the same way as the ordinary identifiers, or paints.

Figure 3 illustrates this type of parsing algorithm, showing the form of pointer graph that results from parsing the cactus expression in Figure 2.  A traversal of this graph naturally reconstructs the cactus string that parses into it.

```                                    o-----o
o------|--o  |
|  o---o  |  |
o->| ) |--o  |
o---o     |
^   o-----o
|  /   o-----o                o-----o
o--------------------|-/----|--o  |  o-------------|--o  |
|  o---o  o---o  o---o< o---o  |  |  |  o---o  o---o  |  |
o->| a |->| , |->| ( |->| ) |--o  |  o->| d |->| ) |--o  |
o---o  o---o  o---o  o---o     |     o---o  o---o     |
^   o--------------------------o     ^   o------------o
|  /                                 |  /                 o-----o
o------|-/----------------------------------|-/------------------|--o  |
|  o---o< o---o  o---o  o---o   o---o   o---o< o---o  o---o  o---o  |  |
o->| ( |->| , |->| b |->| c |-->| , |-->| ( |->| b |->| e |->| ) |--o  |
o---o  o---o  o---o  o---o   o---o   o---o  o---o  o---o  o---o     |
^   o---------------------------------------------------------------o
|  /
o------|-/---------------------o
|  o---o< o---o  o---o  o---o  |
o->| ( |->| a |->| c |->| e |--o
o---o  o---o  o---o  o---o
^
|
@

( ( a , ( ) ) , b c , ( d ) b e ) a c e

Figure 3.  Parse Graph and Traverse String
```

A pointer graph of the type shown in Figure 3 has the underlying form of a cactus graph and will normally be convenient to describe in those terms, so long as we remember its level of abstraction lies a step further in the direction of concrete implementation than the last thing we called by that name.

1 Response to Theme One • A Program Of Inquiry : 9

This site uses Akismet to reduce spam. Learn how your comment data is processed.