previous contents index next
(..Declaration Part) Contents Index (..Declaration Part..)

3.1.3 Registers (RegisterDeclaration)

In the second place, we have to introduce SCARLET to the registers which it should the CA equip with.

RegisterDeclaration - Syntax:

Syntax: RegisterDeclaration

This part starts with the keyword

REGISTER

 

A single register is completely determined by giving its name Identifier and type RegisterType, which can be INT for an integer one and STRING for a string register:

RegisterType Identifier ;

At least one register has to be declared. In case of having more than one, the same must be done for each register. We automatically get a list like this:

RegisterType Identifier1 ;
RegisterType Identifier2 ;
...
RegisterType IdentifierN ;

At the same time, we have induced an order on the registers. First that might seem to be of no interest, because size and properties of the state set do not change if we choose another order. In fact, it is only a convention, which allows us not to repeat all the register names, each time we want to give the contents of a cell: it is sufficient to put the contents of the single registers in the given order, starting at the left and separated by commas.


Concluding this paragraph, we point out a possibility to simplify the style of the syntax. Instead of

RegisterType Identifier1 ;
RegisterType Identifier2 ;
...
RegisterType IdentifierN ;

for registers which are to be of the same type, we may type

RegisterType Identifier1 , Identifier2 , ..., IdentifierN ;



Example 34:

The constant {1, "1. string", 2 ,3} matches the following register declaration:

 REGISTER INT first;
          STRING second;
          INT third, fourth;

previous contents index next
(..Declaration Part) Contents Index (..Declaration Part..)