sandbox/doc/fst83/fst83-5.txt

597 lines
22 KiB
Plaintext
Raw Normal View History

2018-03-01 00:52:46 +00:00
5. DEFINITIONS OF TERMS
5. DEFINITIONS OF TERMS
These are the definitions of the terms used within this Standard.
address, byte
An unsigned 16-bit number that locates an 8-bit byte in a
standard FORTH address space over the range {0..65,535}. It
may be a native machine address or a representation on a
virtual machine, locating the addr-th byte within the
virtual byte address space. Addresses are treated as
unsigned numbers. See: "arithmetic, two's complement"
address, compilation
The numerical value compiled for a FORTH word definition
which identifies that definition. The address interpreter
uses this value to locate the machine code corresponding to
each definition.
address, native machine
The natural address representation of the host computer.
address, parameter field
The address of the first byte of memory associated with a
word definition for the storage of compilation addresses (in
a colon definition), numeric data, text characters, etc.
arithmetic, two's complement
Arithmetic is performed using two's complement integers
within a field of either 16 or 32 bits as indicated by the
operation. Addition and subtraction of two's complement
integers ignore any overflow condition. This allows numbers
treated as unsigned to produce the same results as if the
numbers had been treated as signed.
block
The 1024 bytes of data from mass storage which are
referenced by block numbers in the range {0..the number of
blocks available -1}. The actual amount of data transferred
and the translation from block number to device and physical
record is a function of the implementation. See: "block
buffer" "mass storage"
block buffer
A 1024-byte memory area where a block is made temporarily
available for use. Block buffers are uniquely assigned to
blocks. See: "9.7 Multiprogramming Impact"
byte
An assembly of 8 bits. In reference to memory, it is the
storage capacity for 8 bits.
4
5. DEFINITIONS OF TERMS
character
A 7-bit number the significance of which is given by the
ASCII standard. When contained in a larger field, the
higher order bits are zero. See: "6. REFERENCES"
compilation
The action of converting text words from the input stream
into an internal form suitable for later execution. When in
the compile state, the compilation addresses of FORTH words
are compiled into the dictionary for later execution by the
address interpreter. Numbers are compiled to be placed on
the data stack when later executed. Numbers are accepted
from the input stream unsigned or negatively signed and
converted using the value of BASE . See: "number" "number
conversion" "interpreter, text"
defining word
A word that, when executed, creates a new dictionary entry
in the compilation vocabulary. The new word name is taken
from the input stream. If the input stream is exhausted
before the new name is available, an error condition exists.
Example of defining words are: : CONSTANT CREATE
definition
See: "word definition"
dictionary
A structure of word definitions in computer memory which is
extensible and grows toward higher memory addresses.
Entries are organized in vocabularies to aid location by
name. See: "search order"
display
The process of sending one or more characters to the current
output device. These characters are typically displayed or
printed on a terminal. The selection of the current output
device is system dependent.
division, floored
Integer division in which the remainder carries the sign of
the divisor or is zero, and the quotient is rounded to its
arithmetic floor. Note that, except for error conditions,
n1 n2 SWAP OVER /MOD ROT * + is identical to n1. See:
"floor, arithmetic"
Examples:
dividend divisor remainder quotient
10 7 3 1
-10 7 4 -2
10 -7 -4 -2
-10 -7 -3 1
equivalent execution
5
5. DEFINITIONS OF TERMS
A standard program will produce the same results, exclusive
of timing dependencies, when given the same inputs on any
Standard System which has sufficient resources to execute
the program. Only standard source programs are
transportable.
error condition
An exceptional condition which requires action by the system
which may be other than the expected function. Refer to the
section "10. Error Conditions".
false
A zero number represents the false state of a flag.
flag
A number that may have one of two logical states, false or
true. See: "false" "true"
floor, arithmetic
If z is any real number, then the floor of z is the greatest
integer less than or equal to z.
The floor of +.6 is 0
The floor of -.4 is -1
free field format
Numbers are converted using the value of BASE and then
displayed with no leading zeros. A trailing space is
displayed. The number of characters displayed is the
minimum number of characters, at least one, to uniquely
represent the number. See: "number conversion"
glossary
A set of explanations in natural language to describe the
corresponding computer execution of word definitions.
immediate word
A word which executes when encountered during compilation or
interpretation. Immediate words handle special cases during
compilation. See, for example, IF LITERAL ." etc.
input stream
A sequence of characters available to the system, for
processing by the text interpreter. The input stream
conventionally may be taken from the current input device
(via the text input buffer) and mass storage (via a block
buffer). BLK , >IN , TIB and #TIB specify the input stream.
Words using or altering BLK , >IN , TIB and #TIB are
responsible for maintaining and restoring control of the
input stream.
6
5. DEFINITIONS OF TERMS
The input stream extends from the offset value of >IN to the
size of the input stream. If BLK is zero the input stream
is contained within the area addressed by TIB and is #TIB
bytes long. If BLK is non-zero the input stream is
contained within the block buffer specified by BLK and is
1024 bytes long. See: "11.8 Input Text"
interpreter, address
The machine code instructions, routine or other facilities
that execute compiled word definitions containing
compilation addresses.
interpreter, text
The word definitions(s) that repeatedly accepts a word name
from the input stream, locates the corresponding compilation
address and starts the address interpreter to execute it.
Text from the input stream interpreted as a number leaves
the corresponding value on the data stack. Numbers are
accepted from the input stream unsigned or negatively signed
and converted using the value of BASE . See: "number"
"number conversion"
layers
The grouping of word names of each Standard word set to show
like characteristics. No implementation requirements are
implied by this grouping.
layer, compiler
Word definitions which add new procedures to the dictionary
or which aid compilation by adding compilation addresses or
data structures to the dictionary.
layer, devices
Word definitions which allow access to mass storage and
computer peripheral devices.
layer, interpreter
Word definitions which support vocabularies, terminal
output, and the interpretation of text from the text input
buffer or a mass storage device by executing the
corresponding word definitions.
layer, nucleus
Word definitions generally defined in machine code that
control the execution of the fundamental operations of a
virtual FORTH machine. This includes the address
interpreter.
load
Redirection of the text interpreter's input stream to be
from mass storage. This is the general method for
compilation of new definitions into the dictionary.
mass storage
7
5. DEFINITIONS OF TERMS
Storage which might reside outside FORTH's address space.
Mass storage data is made available in the form of 1024-byte
blocks. A block is accessible within the FORTH address
space in a block buffer. When a block has been indicated as
UPDATEed (modified) the block will ultimately be transferred
to mass storage.
number
When values exist within a larger field, the most-
significant bits are zero. 16-bit numbers are represented
in memory by addressing the first of two bytes at
consecutive addresses. The byte order is unspecified by
this Standard. Double numbers are represented on the stack
with the most-significant 16 bits (with sign) most
accessible. Double numbers are represented in memory by two
consecutive 16-bit numbers. The address of the least
significant 16 bits is two greater than the address of the
most significant 16 bits. The byte order within each 16-bit
field is unspecified. See: "arithmetic, two's complement"
"number types" "9.8 Numbers" "11.7 Stack Parameters"
number conversion
Numbers are maintained internally in binary and represented
externally by using graphic characters within the ASCII
character set. Conversion between the internal and external
forms is performed using the current value of BASE to
determine the digits of a number. A digit has a value
ranging from zero to the value of BASE-1. The digit with
the value zero is represented by the ASCII character "0"
(position 3/0 with the decimal equivalent of 48). This
representation of digits proceeds through the ASCII
character set to the character "(" corresponding to the
decimal value 9. For digits with a value exceeding 9, the
ASCII graphic characters beginning with the character "A"
(position 4/1 with the decimal equivalent 65) corresponding
to the decimal value 10 are used. This sequence then
continues up to and including the digit with the decimal
value 71 which is represented by the ASCII character "~"
(position 7/14 with a decimal equivalent 126). A negative
number may be represented by preceding the digits with a
single leading minus sign, the character "-".
number types
All number types consist of some number of bits. These bits
are either arbitrary or are weighted.
8
5. DEFINITIONS OF TERMS
Signed and unsigned numbers use weighted bits. Weighted
bits within a number have a value of a power of two
beginning with the rightmost (least-significant) bit having
the value of two to the zero power. This weighting
continues to the leftmost bit increasing the power by one
for each bit. For an unsigned number this weighting pattern
includes the leftmost bit; thus, for an unsigned 16-bit
number the weight of the leftmost bit is 32,768. For a
signed number this weighting pattern includes the leftmost
bit but the weight of the leftmost bit is negated; thus, for
a signed 16-bit number the weight of the leftmost bit is
-32,768. This weighting pattern for signed numbers is
called two's complement notation.
Unspecified weighted numbers are either unsigned numbers or
signed numbers; program context determines whether the
number is signed or unsigned. See: "11.7 Stack Parameters"
pictured numeric output
The use of numeric output definitions which convert
numerical values into text strings. These definitions are
used in a sequence which resembles a symbolic 'picture' of
the desired text format. Conversion proceeds from least-
significant digit to most-significant digit, and converted
characters are stored from higher memory addresses to lower.
program
A complete specification of execution to achieve a specific
function (application task) expressed in FORTH source code
form.
receive
The process of obtaining one character from the current
input device. The selection of the current input device is
system dependent.
recursion
The process of self-reference, either directly or
indirectly.
return
The means of indicating the end of text by striking a key on
an input device. The key used is system dependent. This
key is typically called "RETURN", "CARRIAGE RETURN", or
"ENTER".
screen
Textual data arranged for editing. By convention, a screen
consists of 16 lines (numbered 0 through 15) of 64
characters each. Screens usually contain program source
text, but may be used to view mass storage data. The first
byte of a screen occupies the first byte of a mass storage
block, which is the beginning point for text interpretation
during a load.
9
5. DEFINITIONS OF TERMS
search order
A specification of the order in which selected vocabularies
in the dictionary are searched. Execution of a vocabulary
makes it the first vocabulary in the search order. The
dictionary is searched whenever a word is to be located by
its name. This order applies to all dictionary searches
unless otherwise noted. The search order begins with the
last vocabulary executed and ends with FORTH , unless
altered in a system dependent manner.
source definition
Text consisting of word names suitable for compilation or
execution by the text interpreter. Such text is usually
arranged in screens and maintained on a mass storage device.
stack, data
A last in, first out list consisting of 16-bit binary
values. This stack is primarily used to hold intermediate
values during execution of word definitions. Stack values
may represent numbers, characters, addresses, boolean
values, etc.
When the name 'stack' is used alone, it implies the data
stack.
stack, return
A last in, first out list which contains the addresses of
word definitions whose execution has not been completed by
the address interpreter. As a word definition passes
control to another definition, the return point is placed on
the return stack.
The return stack may cautiously be used for other values.
string, counted
A sequence of consecutive 8-bit bytes located in memory by
their low memory address. The byte at this address contains
a count {0..255} of the number of bytes following which are
part of the string. The count does not include the count
byte itself. Counted strings usually contain ASCII
characters.
string, text
A sequence of consecutive 8-bit bytes located in memory by
their low memory address and length in bytes. Strings
usually, but not exclusively, contain ASCII characters.
When the term 'string' is used alone or in conjunction with
other words it refers to text strings.
structure, control
10
5. DEFINITIONS OF TERMS
A group of FORTH words which when executed alter the
execution sequence. The group starts and terminates with
compiler words. Examples of control structures: DO ...
LOOP DO ... +LOOP BEGIN ... WHILE ... REPEAT BEGIN ...
UNTIL IF ... THEN IF ... ELSE ... THEN See: "9.9 Control
Structures"
transportability
This term indicates that equivalent execution results when a
program is executed on other than the system on which it was
created. See: "equivalent execution"
true
A non-zero value represents the true state of a flag. Any
non-zero value will be accepted by a standard word as
'true'; all standard words return a 16-bit value with all
bits set to one when returning a 'true' flag.
user area
An area in memory which contains the storage for user
variable.
variable, user
A variable whose data storage area is usually located in the
user area. Some system variables are maintained in the user
area so that the words may be re-entrant to different users.
vocabulary
An ordered list of word definitions. Vocabularies are an
advantage in separating different word definitions that may
have the same name. More than one definition with the same
name can exist in one vocabulary. The latter is called a
redefinition. The most recently created redefinition will
be found when the vocabulary is searched.
vocabulary, compilation
The vocabulary into which new word definitions are appended.
word
A sequence of characters terminated by one blank or the end
of the input stream. Leading blanks are ignored. Words are
usually obtained via the input stream.
word definition
A named FORTH execution procedure compiled into the
dictionary. Its execution may be defined in terms of
machine code, as a sequence of compilation address, or other
compiled words.
word name
11
5. DEFINITIONS OF TERMS
The name of a word definition. Word names are limited to 31
characters and may not contain an ASCII space. If two
definitions have different word names in the same vocabulary
they must be uniquely findable when this vocabulary is
searched. See: "vocabulary" "9.5.3 EXPECT"
word set
A named group of FORTH word definitions in the Standard.
word set, assembler extension
Additional words which facilitate programming in the native
machine language of the computer which are by nature system
dependent.
word set, double number extension
Additional words which facilitate manipulation of 32-bit
numbers.
word set, required
The minimum words needed to compile and execute Standard
Programs.
word set, system extension
Additional words which facilitate the access to internal
system characteristics.
word, standard
A named FORTH procedure definition, in the Required word set
or any extension word sets, formally reviewed and accepted
by the Standards Team.
12