celldec ::=xcelldec|rcelldec|xxcelldec|rrcelldec αcelldec ::=αtype αitemlist; {α=x|r|xx|rr} xtype ::=INTEGER|LOGICAL rtype ::=REAL xxtype ::=LONG INTEGER rrtype ::=LONG REAL αitemlist ::=αitem|αitemlist,αitem {α=x|r|xx|rr} αitem ::=αidentifier|αidentifier=αinitial|αidentifier(integer)| αidentifier(integer)=(αinitiallist) {α=x|r|xx|rr} αinitiallist ::=αinitial|αinitial*integer|αinitiallist,αinitial| αinitiallist,αinitial*integer {α=x|r|xx|rr} αidentifier ::=identifier {α=x|r|xx|rr}
Before any cell is used it must be given an identifier as a name and the compiler must know its type. This is done by the cell declaration. As has been defined in Chapter 12, all declarations must appear at the beginning of a block before any executable statements. Each declaration consists of the symbol denoting the type followed by a number of items which will be given consecutive storage locations. Each item is separated from the next by a comma. Items can take one of the following forms:
INTEGER A, B, C; REAL D, E, F; LONG REAL G; LONG INTEGER ALONGIDENTIFIER, ANOTHERLONGONE;If this set of statements appeared in a program then 17 1900 words would be allocated.
INTEGER AR(20),BR(10); REAL CR(40); LONG REAL DR(10);The integer cells will use 30 1900 words, the real cells 80 and the long real 40. Note that the first element of the array AR can be accessed as AR(0) and the last by AR(19). Also there is no reason why AR(20) should not be used when referring to the cell BR(0).
REAL A=1.7, B=].38&MINUS 7, C=MINUS 37.5; INTEGER D=7, E=#22, F='ABCD'; LONG REAL G=1.75L; LONG INTEGER H=275D; INTEGER I=@LIX, J=$LIX(3), K=£LIA(-1); INTEGER L=CHAR 3, M=CHAR 2 OF @LIX; INTEGER N=@SQUARE, M=@LBL;The last example assumes SQUARE has been defined as a procedure and LBL as a label.
INTEGER P=6CNT+3, Q=l7CNT+@LIX, R=5CNT+27T2; INTEGER S=!FAD(3,LRX); T="ABCD";
INTEGER AR(20)=(1*12,2*8), BR(10)=(5*7); REAL CR(40)=(1.7*25,2.9,1.9*14); LONG REAL DR(10) = (2.7L*10); INTEGER ER(5)=("ABCDEFGH1JKLMNOPQRST"); INTEGER FR(2)=("A""B' DEF"); INTEGER GR(5)*(1,@LIX,CHAR3,@SQUARE,!FAD(3,LIX));Note that in the first declaration only the elements BR(0) to BR(6) are set to 5. The remainder have no defined value initially.
The cell type INTEGER can also be written LOGICAL. The two are completely interchangeable. They have been included to aid in the differentiation between 24-bit quantities used as numbers upon which arithmetic operations are performed and 24-bit quantities used as a set of individual bits. However, no check is made that INTEGER declarations are used if arithmetic is to be performed and LOGICAL declarations are used if logical operations are to be performed.