FORTH - DIARY.ZIP - F83FILE.001

 
Output of file : F83FILE.001 contained in archive : DIARY.ZIP























FORTH-83 STANDARD

A PUBLICATION OF THE FORTH STANDARDS TEAM
















AUGUST 1983




























FORTH-83 STANDARD




COPYRIGHT c. 1983 FORTH STANDARDS TEAM

Permission is hereby granted to reproduce this document in whole
or in part provided that such reproductions refer to the fact
that the copied material is subject to copyright by the FORTH
Standards Team. No changes or modifications may be made to the
copied material unless it is clearly indicated that such changes
were not incorporated in the original copyrighted work.

The existence of a FORTH Standard does not in any respect
preclude anyone, whether the individual has approved this
Standard or not, from implementing, marketing, purchasing or
using products, processes, or procedures not conforming to the
Standard. FORTH Standards are subject to periodic review and
users are cautioned to obtain the latest editions.

ISBN 0-914699-03-2

FORTH STANDARDS TEAM
P.O. BOX 4545
MOUNTAIN VIEW, CA 94040
USA

































ii





FORTH-83 STANDARD




TABLE OF CONTENTS

1. FOREWORD ............................................... 1
2. PURPOSE ................................................ 2
3. SCOPE .................................................. 2
4. TRADEOFFS .............................................. 3
5. DEFINITIONS OF TERMS ................................... 4
6. REFERENCES ............................................. 12
7. REQUIREMENTS ........................................... 13
8. COMPLIANCE AND LABELING ................................ 15
9. USAGE .................................................. 17
10. ERROR CONDITIONS ....................................... 20
11. GLOSSARY NOTATION ...................................... 22
12. REQUIRED WORD SET ...................................... 25
13. DOUBLE NUMBER EXTENSION WORD SET ....................... 41
14. ASSEMBLER EXTENSION WORD SET ........................... 44
15. SYSTEM EXTENSION WORD SET .............................. 46
16. CONTROLLED REFERENCE WORDS ............................. 48

APPENDICES
A. FORTH STANDARDS TEAM MEMBERSHIP ................... 51
B. UNCONTROLLED REFERENCE WORDS ...................... 54
C. EXPERIMENTAL PROPOSALS ............................ 60
C.1 SEARCH ORDER SPECIFICATION AND CONTROL ....... 61
C.2 DEFINITION FIELD ADDRESS CONVERSION OPERATORS . 66
D. STANDARDS TEAM CHARTER ............................ 69
E. PROPOSAL/COMMENT FORM AND INSTRUCTIONS ............ 78




























iii





FORTH-83 STANDARD



























































iv





1. FOREWORD




1. FOREWORD


FORTH is an integrated programming approach and computer
language. FORTH was invented by Mr. Charles Moore specifically
to increase programmer productivity in the development of
computer related applications without sacrificing machine
efficiency. FORTH is a layered environment containing the
elements of a computer language as well as those of an operating
system and a machine monitor. This extensible, layered
environment provides for highly interactive program development
and testing.

In the interests of transportability of application software
written in FORTH, standardization efforts began in the mid-1970s
by the European FORTH User's Group (EFUG). This effort resulted
in the FORTH-77 Standard. As the language continued to evolve,
an interim FORTH-78 Standard was published by the FORTH Standards
Team. Following FORTH Standards Team meetings in 1979 the FORTH-
79 Standard was published in 1980.

The FORTH Standards Team is comprised of individuals who have a
great variety of experience and technical expertise with FORTH.
The FORTH Standards Team consists of both users and implementers.
Comments, proposals, and correspondence should be mailed to:
FORTH Standards Team, P.O. Box 4545, Mountain View, CA 94040 USA.

FORTH's extensibility allows the language to be expanded and
adapted to special needs and different hardware systems. A
programmer or vendor may choose to strictly adhere with the
standard, but the choice to deviate is acknowledged as beneficial
and sometimes necessary. If the standard does not explicitly
specify a requirement or restriction, a system or application may
utilize any choice without sacrificing compliance to the standard
provided that the system or application remains transportable and
obeys the other requirements of the standard.



















1





2. PURPOSE




2. PURPOSE


The purpose of this standard is to allow transportability of
FORTH-83 Standard Programs in source form among FORTH-83 Standard
Systems. A standard program shall execute equivalently on all
standard systems.



3. SCOPE


This standard shall apply to any FORTH-83 Standard Program
executing on any FORTH-83 Standard System, provided sufficient
computer resources (memory, mass storage) are available.







































2





4. TRADEOFFS




4. TRADEOFFS


When conflicting choices are made, the following order guides the
Standards Team:

1) Functional correctness - known bounds, non-ambiguous;

2) Portability - repeatable results when programs are
transported among Standard Systems;

3) Simplicity;

4) Naming clarity - uniformity of expression using descriptive
rather than procedure names, i.e., [COMPILE] rather than 'C,
and ALLOT rather than DP+! ;

5) Generality;

6) Execution speed;

7) Memory compactness;

8) Compilation speed;

9) Historical continuity;

10) Pronounceability;

11) Teachability.

























3





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. DE