Language Elements

Translator, the first program that processes and parses SML code, recognises several different kinds of elements of SML code. Most of these elements are then assigned to various C++ classes. The figure below shows hierarchical structure of the most important classes:

Note:The hierarchy is owner related. We say that a class is an owner of another class if it either contains this class or keeps a pointer to it.

Translator Elements

There are 3 different groups of these classes:

  1. Chunk of SML code (sometimes called unit) consisting of a number of complete lines. The first line of a unit typically begins with a keyword (such as 'OBJECT:' or 'WHEN'). Translator has various strategies to recognize the last line of a unit. All these classes inherit from class 'SMLUnit'. Within a unit, there can be further units of SML code at a lower level. As all the units are created on the heap, this means that a unit has to keep a list of pointers to the units that belong to it on lower level. (For example unit 'State' keeps a pointer to its 'When' and 'Action' units.) These pointers are stored in the local data of class SMLUnit from which the units inherit. One can broadly divide these units into two subgroups :

    1. Those units refering to further units, such as 'SMIObject'. In the figure they are indicated by green colour and surrounded by a solid box.
    2. The units referring to no further units. In the figure they are indicated by yellow colour and surrounded by dotted box.
      NB: 'WHEN' unit is an exception because even though it could refer to an action, it does not store the pointer in the usual place (i.e the local data of class SMLUnit from which it inherits)

  2. Elements of SML code that do not belong to Group 1, such as for example 'Condition'. In the figure they are shown in plain text.