Download PASCAL·SO USER`S GUIDE

Transcript
APPENDIX I
IMPLEMENTATION DETAILS
•
Data Type Formats
•
Every variable in P ASCAL-80 is aligned on an even-byte, or word, boundary,
although individual elements of a PACKED structure may occupy as little as one bit
(in a PACKED ARRAY OF boolean). All interpreter operations expect their
operands to occupy at least one word, even if not all of the information in that word
is valid.
boolean
•
One word, with bit 0 indicating the value (false=O, true=1). The other bits
are ignored by the boolean operations.
char
One word, with the low byte containing the character. The high order byte
is ignored by operations using a value of type char.
integer
•
One word. The value is stored in two's complement form, so that a variable
of type integer can assume values in the range - 32768 .. 32767.
scalar
One word, with value in the range 0 .. 32767.
real
•
Two words, in INTEL floating point format.
POINTER
One word, with a value in the range 0 .. 65535.
SET
0 .. 255 words, depending upon the number of elements in the set. Sets are
stored as bit vectors, with a lower index of zero, where each bit corresponds
to a possible set element. A set variable declared as "SET OF a .. b" is
allocated (b+ 15)div16 words, all of which contain valid information. All
elements past the last word of a set are assumed to not be elements of the
set.
RECORDs and ARRAYs
•
Any number of words, depending upon the size of the structure. Arrays are
stored in row-major order. When a record or an array is an operand to a
procedure or internal operation, the structure itself is never loaded onto the
stack; just a reference (pointer) to it.
1-1