Search
Table of ContentsArticle
Put PHP programs on CD-ROM Index XML to SML

### Purpose of the SML format

The task of the file format is to store non-recursive data fields in the form of a sequential file. These data fields can be either numeric or associative, and use any scalar values or other data fields, if they meet the same requirements. References are not allowed. Objects are - analogous to JSON - represented by their public object variables in the form of an associative array data. Included non-scalar values are treated recursively.

The purpose of this file format is to store parameters to initialize components of the framework. The purpose is not to store larger amounts of data in this format. In particular, the SML format is not designed as a replacement for XML.

Infinite recursions are not recognized.

#### Discussion on detection of infinite recursion

Note: The test, whether a structure contains infinite recursions or not, is not trivial. The usual approach is a path tracking procedure. However, this produces an overhead of T = O(n) steps, where n is the length of the path. The proof for this lower bound is trivial. In order to avoid such an overhead it might be considered to run this test only every x steps, where an appropriate value is to be chosen for the positive integer x with x> 1. Despite this potential optimization, quadratic running time can be expected, for the whole program, including the path checks. This is not acceptable for many applications. For reasons of performance it was decided to refrain from this type of check.

At this point I would like to note that the naive approach, to count the number of elements to check whether the number of iterations exceeds the number of elements, is not practical. In order to "count" all elements a complete traversion would be carried out. If, however, the structure did contain an infinite recursive path, the program would never terminate and the result would be undefined.

Put PHP programs on CD-ROM Index XML to SML

Thomas Meyer, www.yanaframework.net