4. TYPES AND VALUES
4.1 Syntax
xvalue ::= integer|MINUS integer|octalinteger|truncated|count|charsequence|string
integer ::= digit|integer digit
octaldigit ::= 0|1|2|3|4|5|6|7|8|9
octalinteger ::= #octaldigit|octalinteger octaldigit
truncated ::= integer T integer|MINUS integer T integer
count ::= integer CNT
charsequence ::= 'ch'|'ch ch'|'ch ch ch'|'ch ch ch ch'
ch ::= char|''|_|"
string ::= "stlist"
stlist ::= st|stlist st
st ::= char|" "|_|'
rvalue ::= real|MINUS real
real ::= fraction|fraction & exponent|integer & exponent
fraction ::= integer . digit|fraction digit
exponent ::= integer|MINUS integer
xxvalue ::= integer D|MINUS integer D|octalinteger D
rrvalue ::= real L|MINUS real L
_ is a space sign in the PLASYD Manual printed.
4.2 Introduction
This section deals with the values that can be associated with cells and accumulators
of the types INTEGER, REAL, LONG INTEGER and LONG REAL.
PLASYD allows another type LOGICAL which is completely equivalent with INTEGER.
The two types may be used interchangeably. However, LOGICAL is usually used in cases
where no arithmetic is being carried out. For example, the individual bits of a
variable might be used as a set of markers in which case it would be sensible to define
it as LOGICAL. The compiler makes no distinction between cells of integer and logical
type. In general, integer values are always associated with integer variables and
so on. However, it is possible to associate integer or real values with long
integer and long real variables respectively.
4.3 Integer Values
The 24-bit 1900 storage word which makes up an integer cell,
or an integer accumulator, may be considered to hold:
- 24-bits considered as separate values of 0 or 1
- 4 six-bit characters
- an octal number in the range of 0 to 77777777 octal
- a decimal number in the range -8388608 to 8388607
Integer values (xvalue) are defined in a PLASYD program as:
-
Integer. A positive or negative decimal integer in the range
given above. Positive integers are written without a sign while negative integers are preceded
by the reserved word MINUS. The individual digits making up an integer may not be separated by spaces.
The integer number is held internally in 24-bit two's complement binary form.
Examples are:
3671 29 0 4052 8388607
MINUS 6 MINUS 2732 MINUS 8388608
-
Octal Integer. This consists of a sequence between 1 and 8 octal digits preceded by the symbol #.
Spaces or other layout characters may occur between the symbol # and the first digit but nowhere else.
The number will be stored in the right most octal positions of the word.
Unspecified octal positions to the left are set to zero.
The first two of the following examples therefore have the same value:
#00000770 #770 #273 #27
#12345670 #1 #00000000
-
Truncated Numbers. These are mainly used for setting up addresses.
There must be no spaces between the T and numbers on either side.
If the number is considered as aTb then its value is the rightmost b bits of the number a.
It will normally only be used with b = 12, 15 or 22 although other values are possible.
If a is negative it can be used to set up negative addresses.
Some examples with corresponding octal values are:
12T15 #00000014
1976215T22 #07423627
MINUS 12T15 #00077764
8000000T12 #00001000
MINUS 8000000T12 #00007000
-
Count. This is an integer number in the range 0 to 511 which is
to be held in the most significant 9 bits of the word with the remaining digits set to zero.
No spaces are allowed between the number and the word CNT.
Some examples with equivalent octal values are:
257CNT #40100000
511CNT #77700000
2CNT #00200000
-
Character Sequence. The character sequence (charsequence) consists of from one to four characters
of the 1900 character set enclosed within the single quote marks '.
The single quote character itself is represented in the sequence by two consecutive single quotes
which count as one of the four possible characters.
A space can be used as one of the six-bit characters.
The characters are held in the right most six-bit character positions of the integer variable
with any unspecified character positions being set to zero.
The six-bit values associated with the 1900 character set are given in Appendix 1.
Some examples with corresponding octal values are as follows:
'%' #00000025
'+23' #00330203
'ABCD' #41424344
'''A''' #00274127
'2 3' #00022003
'2 3 ' #02200320
'' #00000000
Note that the null string is allowed by the compiler.
-
String. A string consists of one to four characters enclosed
within the double quote marks. The double quote character itself is represented by two consecutive
double quote marks. Unlike character sequences, the characters in a string are held in the leftmost six-bit
character positions of the integer variable with any unspecified character positions being set to the space
character. Some examples with corresponding octal values are as follows:
"%" #25202020
" " #20202020
"" #20202020
"ABCD" #41424344
4.4 Real Values
A real variable consists of either the floating point accumulator A1 or a real cell consisting
of two consecutive 24-bit words in main store.
A real variable can hold a (generally normalised) floating point binary number in standard 1900 format.
The numbers are held with an accuracy of about 11 decimal digits in the range -5.6 × 1076 to 5.6 × 1076.
The smallest number other than zero which can be represented is about 10-77. Real values (rvalue)
are defined in a PLASYD program as:
-
Fractional Number. A fractional number (fraction) consists of
an integer number followed by a decimal point and one or more integers.
There should be no spaces between the integers and decimal point.
The numbers may be signed. For example:
0.13261 321.67 215.0
MINUS 136.0 MINUS 0.141579
-
Fractional Number with Exponent. Any fractional number may be
followed by an & and an integer number.
The integer is taken to be a power of ten by which the fractional number is multiplied.
There must be no spaces between the fraction and the & symbol. Spaces can occur between the & and the
exponent but are not necessary.
The exponent may be signed. For example:
1.4&20 1.4&MINUS 20 1.4& MINUS 20
MINUS 0.5613&3 1.414& MINUS 6
-
Integer Number with Exponent. An integer number followed by an exponent will also be considered
a real number. Again no space is allowed between the integer and &. Spaces can occur between
the & and exponent. For example:
3&6 7&MINUS 6 3& 5 43& MINUS 12
41107&25 MINUS 47& MINUS 3
4.5 Long Integer Values
A long integer variable consists of either two adjacent integer accumulators or two adjacent 24-bit words
in main store. Long integers must be within the range -140737488355328 and 140737488355327.
As an octal value, it may consist of up to sixteen octal digits.
Long integer values (xxvalue) are defined in a PLASYD program as:
-
Integer. A positive or negative decimal integer in the range
given above and followed by the letter D. Neither the individual digits nor the letter D
and preceding digit should be separated by spaces. For example:
27D MINUS 37221567854D
-
Octal Integer. This consists of a sequence of 1 to 16 octal
digits preceded by the symbol #. Spaces or other layout characters may occur between the #
symbol and the first digit but not elsewhere.
The number will be stored in the right-most octal positions of the word.
Unspecified octal positions to the left are set to zero.
The following two examples represent the same value:
#76767676767676D #0076767676767676D
4.6 Long Real Values
A long real variable can be manipulated on the 1906A and some 1900's when the necessary hardware is available.
A long real variable consists of either the floating point accumulator and mantissa extension or, alternatively,
four consecutive 24-bit words in main store. A long real variable can hold a (generally normalised)
floating point binary number.
Long real values (rrvalue) are defined in a PLASYD program as:
-
Real Number. Any of the methods (Fractional Number, Fractional Number with Exponent,
Integer Number with Exponent) of defining a real number can be used for defining a Long real number
by following the number immediately with the letter L. No space should exist between the last digit
and the letter L. Otherwise the constraints are similar to those for real values except that the
range is as above. For example:
0.13261L 3.17854758432L
MINUS 1785.34L
1.4&80L 1.75& MINUS 20L
MINUS 3.1758477285&60L
3185642&50L
MINUS 777554& MINUS 40L