previous contents index next
(..Constants..) Contents Index (Symb. Constants)

2.4.4 Cell Constants

For more or less formal reasons, cell constants are no independent part of SCARLET's grammar, but a subset of all cell type objects CellExpression. (And there it belongs to the construction {RegExpressionList}.) Nevertheless we will give a description here, because it enables us to familiarize the reader already now with the concept of partioning the state set.
 

We have already mentioned the importance of registers to form a finite state set, which is easy to handle. Instead of keeping all state information in one large variable, what will soon lead us to complex and confusing state indications, SCARLET provides a possibility to split them up into smaller units, called registers. There are two different kinds, according to SCARLET'S INT and STRING types: The first one contains integer constants, the second kind is intended for string constants. (We call them integer and string registers respectively.)
At the beginning of each program, number and types of all used registers are fixed uniquely for all cells of the automaton. In addition they are put in order by their declaration, and each register is given a (symbolic) name.
 

Then the entire state of a cell is given by the cross product of the ordered tuple of its register contents. Because of the finite range of all registers the cross product - as the resulting state set - is finite, too.


Example 6:

Let us have a look at the following state set:

S={s_0, ... ,s_n} , n in IN

Certainly it can be modeled with a single string register. But we may also use an additional integer register and form the state set like that:

{{ ''s'',0},{ ''s'',1} , ... { ''s'',n}}

Now it is quite easy to change a state: We simply have to transform the integer value by an arithmetical operation.

 

The structure of a cell induced by the registers must, of course, be evident in the syntax of cell constants, too: The (constant) contents of the different registers stand in sequence (as fixed before by the declaration), surrounded by braces and separated from each other by commas:

Syntax:

Syntax: Cell Constants

 

There has to be values for all declared registers according to their data types, which means: Normally RegConstant is out of IntConstant if the corresponding register type is INT, otherwise it is an element of StringConstant. In both cases RegConstant may also be VOID.

RegConstant - Syntax:

Syntax: RegConstant

VOID does not belong to a special register type, since it is actually kind of a device. If we assign a cell constant with VOID in some of its registers to an arbitrary cell type object, the contents of all these registers to which VOID is assigned remain unchanged. Cell constants are of data type CELL.


Example 7:

Now we think of a cell structure created of three registers with types INT, STRING, INT in right this order and some examples of cell constants. Which of them concur with the given structure?

 {"word", -567}          /* wrong */
 {-123, "state", VOID}   /* right */
 {0, , 0}                /* wrong */
 {0, "", 0}              /* right */   

previous contents index next
(..Constants..) Contents Index (Symb. Constants)