Skip to content
Commits on Source (3)
\annex{Alphabetic list of words} % F (informative annex)}}}
\label{annex:index}
In the following list, the last, four-digit, part of the reference
number establishes a sequence corresponding to the alphabetic ordering
of all standard words. The first two or three parts indicate the word
set and glossary section in which the word is defined.
~\par
\makeatletter
% \indexentry{section}{number}{sub}{name}{wordset}{ext}{proposal}{label}[english]
\newcommand{\indexentry}{
\@starfalse
\@ifnextchar*{\alpha@star}{\alpha@entry}
}
\newcommand{\alpha@star}[1]{
\@startrue
\alpha@entry
}
\newlength{\alpha@length}
\ifshowref
\setlength{\alpha@length}{0.2\textwidth}
\else
\setlength{\alpha@length}{0.3\textwidth}
\fi
\newcommand{\alpha@entry}[9]{%
\def\Prop{#7}
%
% Enable the change bar for * words
%
\if@star\cbstart\fi%
%
% Word Number - Hyper linked to its definition
%
\def\Tmp{#2}%
\makebox[5em][r]{\hyperref{}{#5}{#8}{%
#1.\ifx\Tmp\empty\rule[.8ex]{2em}{.5pt}\else
\ifx\Prop\empty #2\else\uline{#2}\fi
\fi}}%
%
% The word sub-number
%
\def\Tmp{#3}% {12}%
\makebox[2em][l]{%
\ifx\Tmp\empty\else\hyperref{}{#5}{#8}{%
\ifx\Prop\empty .#3\else\uline{.#3}\fi
}\fi}
%
% Standard Extension Proposal
%
% \ifdraft
\def\Tmp{#7}%
\ifx\Tmp\empty\else
\marginpar{\textsf{\sout{\tiny #7}}}
\fi%
% \fi%
%
% Word Label - If we are showing reference
%
\ifshowref
\makebox[6em]{%
\def\Tmpa{#8}%
\def\Tmpb{#4}%
\ifx\Tmpa\Tmpb\else\texttt{\small #8}\fi
}%
\fi%
%
% Word Name - Hyperlinked to its definition
%
\makebox[\alpha@length][l]{%
\hyperref{}{#5}{#8}{\textbf{\texttt{#4}}}
\quad
\dotfill
}%
%
% English Pronunciation (if given)
%
\def\Tmp{#9}%
\ifx\Tmp\empty ~\else ``#9''\fi
\dotfill%
%
% Word list
%
\MakeUppercase{#5}%
\def\Tmp{#6}%
\ifx\Tmp\empty\else ~EXT\fi
%
% Page reference
%
\makebox[3em]{\dotfill\pageref{#5:#8}}%
%
% Disable the change bar
%
\if@star\cbend\fi%
\@starfalse
%
% End of line - \par is need to flush the marginpar
%
\par
}
\makeatother
\begingroup
\parskip=0pt
\IfFileExists{\jobname.wds}{
\input{\jobname.wds}
}{
\IfFileExists{\jobname.wrd}{
\begin{center}
\textbf{Unsorted List}
\end{center}
\input{\jobname.wrd}
}{
File not found !
}
}
\endgroup
This diff is collapsed.
\chapter{Documentation requirements}
\label{doc}
When it is impossible or infeasible for a system or program to
define a particular behavior itself, it is permissible to state
that the behavior is unspecifiable and to explain the circumstances
and reasons why this is so.
\section{System documentation} % 4.1
\label{doc:system}
\subsection{Implementation-defined options} % 4.1.1
The implementation-defined items in the following list represent
characteristics and choices left to the discretion of the
implementor, provided that the requirements of this Standard are
met. A system shall document the values for, or behaviors of, each
item.
\begin{itemize}
\item aligned address requirements \xref[Addresses]{usage:addr};
\item behavior of \wref{core:EMIT}{EMIT} for non-graphic characters;
\item character editing of \wref{core:ACCEPT}{ACCEPT};
\item character set (\xref[Character types]{usage:char},
\wref{core:EMIT}{EMIT}, \wref{core:KEY}{KEY});
\item character-aligned address requirements
(\xref[Addresses]{usage:addr});
\item character-set-extensions matching characteristics
(\xref[Finding definition names]{usage:find});
\item conditions under which control characters match a space
delimiter (\xref[Delimiters]{usage:delim});
\item format of the control-flow stack
(\xref[Control-flow stack]{usage:controlstack});
\item conversion of digits larger than thirty-five
(\xref[Digit conversion]{usage:digits});
\item display after input terminates in \wref{core:ACCEPT}{ACCEPT};
\item exception abort sequence (as in \wref{core:ABORTq}{ABORT"});
\item input line terminator (\xref[User input device]{usage:input});
\item maximum size of a counted string, in characters
(\xref[Counted strings]{usage:cstring}, \wref{core:WORD}{WORD});
\item maximum size of a parsed string
(\xref[Parsing]{usage:parsing});
\item maximum size of a definition name, in characters
(\xref[Definition names]{usage:names});
\item maximum string length for
\wref{core:ENVIRONMENTq}{ENVIRONMENT?}, in characters;
\item method of selecting \xref[User input device]{usage:input};
\item method of selecting \xref[User output device]{usage:output};
\item methods of dictionary compilation
(\xref[The Forth dictionary]{usage:dict});
\item number of bits in one address unit
(\xref[Addresses]{usage:addr});
\item number representation and arithmetic
(\xref[Internal number representation]{usage:number});
\item ranges for \param{n}, \param{+n}, \param{u}, \param{d},
\param{+d}, and \param{ud}
(\xref[Single-cell types]{usage:cell},
\xref[Cell-pair types]{usage:2cell});
\item read-only data-space regions
(\xref[Data space]{usage:dataspace});
\item size of buffer at \wref{core:WORD}{WORD}
(\xref[Other transient regions]{usage:transient});
\item size of one cell in address units
(\xref[Single-cell types]{usage:cell});
\item size of one character in address units
(\xref[Character types]{usage:char});
\item size of the keyboard terminal input buffer
(\xref[Input buffers]{usage:inbuf});
\item size of the pictured numeric output string buffer
(\xref[Other transient regions]{usage:transient});
\item size of the scratch area whose address is returned by
\wref{core:PAD}{PAD} \\
(\xref[Other transient regions]{usage:transient});
\item system case-sensitivity characteristics
(\xref[Finding definition names]{usage:find});
\item system prompt (\xref[The Forth text interpreter]{usage:dict},
\wref{core:QUIT}{QUIT});
\item type of division rounding (\xref[Integer division]{usage:div},
\wref{core:*/}{*/}, \wref{core:*/MOD}{*/MOD}, \wref{core:/}{/},
\wref{core:/MOD}{/MOD}, \wref{core:MOD}{MOD});
\item values of \wref{core:STATE}{STATE} when true;
\item values returned after arithmetic overflow
(\xref[Other integer operations]{usage:intops});
\item whether the current definition can be found after
\wref{core:DOES}{DOES>} (\wref{core::}{:}).
\end{itemize}
\subsection{Ambiguous conditions} % 4.1.2 ===========================
\label{doc:ambiguous}
A system shall document the system action taken upon each of the
general or specific ambiguous conditions identified in this
Standard. See \xref[Possible actions on an ambiguous condition]{usage:ambiguous}.
The following general ambiguous conditions could occur because of a
combination of factors:
\begin{itemize}
\item a \emph{name} is neither a valid definition name nor a valid
number during text interpretation (\xref[The Forth text
interpreter]{usage:command});
\item a definition name exceeded the maximum length allowed
(\xref[Definition names]{usage:names});
\item addressing a region not listed in \xref[Data Space]{usage:dataspace};
\item argument type incompatible with specified input parameter,
e.g., passing a \emph{flag} to a word expecting an \emph{n}
(\xref[Data types]{usage:data});
\item attempting to obtain the execution token, (e.g., with
\wref{core:'}{'}, \wref{core:FIND}{FIND}, etc. of a definition
with undefined interpretation semantics;
\item dividing by zero
(\wref{core:*/}{*/},
\wref{core:*/MOD}{*/MOD},
\wref{core:/}{/},
\wref{core:/MOD}{/MOD},
\wref{core:FM/MOD}{FM/MOD},
\wref{core:MOD}{MOD},
\wref{core:SM/REM}{SM/REM},
\wref{core:UM/MOD}{UM/MOD},
\wref{double:M*/}{M*/});
\item insufficient data-stack space or return-stack space (stack
overflow);
\item insufficient space for loop-control parameters;
\item insufficient space in the dictionary;
\item interpretating a word with undefined interpretation semantics;
\item modifying the contents of the input buffer or a string literal
(\xref[Text-literal regions]{usage:"literal},
\xref[Input buffers]{usage:inbuf});
\item overflow of a pictured numeric output string;
\item parsed string overflow;
\item producing a result out of range, e.g., multiplication
(using \word{*}) results in a value too big to be represented by
a single-cell integer
(\wref{core:*}{*},
\wref{core:*/}{*/},
\wref{core:*/MOD}{*/MOD},
\wref{core:toNUMBER}{>NUMBER},
\wref{core:FM/MOD}{FM/MOD},
\wref{core:SM/REM}{SM/REM},
\wref{core:UM/MOD}{UM/MOD},
\wref{double:M*/}{M*/});
\item reading from an empty data stack or return stack
(stack underflow);
\item unexpected end of input buffer, resulting in an attempt to
use a zero-length string as a \emph{name};
\end{itemize}
The following specific ambiguous conditions are noted in the
glossary entries of the relevant words:
\begin{itemize}
\item \word{toIN} greater than size of input buffer
(\xref[Parsing]{usage:parsing});
\item \wref{core:RECURSE}{RECURSE} appears after
\wref{core:DOES}{DOES>};
\item argument input source different than current input source for
\wref{core:RESTORE-INPUT}{RESTORE-INPUT};
\item data space containing definitions is de-allocated
(\xref[Contiguous regions]{usage:contiguous});
\item data space read/write with incorrect alignment
(\xref[Address alignment]{usage:aaddr});
\item data-space pointer not properly aligned
(\wref{core:,}{,}, \wref{core:C,}{C,});
\item less than \param{u}+2 stack items (\wref{core:PICK}{PICK},
\wref{core:ROLL}{ROLL});
\item loop-control parameters not available
(\wref{core:+LOOP}{+LOOP},
\wref{core:I}{I},
\wref{core:J}{J},
\wref{core:LEAVE}{LEAVE},
\wref{core:LOOP}{LOOP},
\wref{core:UNLOOP}{UNLOOP});
\item most recent definition does not have a \emph{name}
(\wref{core:IMMEDIATE}{IMMEDIATE});
\item \wref{core:TO}{TO} not followed directly by a \emph{name}
defined by a word with ``\word{TO} \emph{name} runtime''
semantics (\wref{core:VALUE}{VALUE} and
\wref{local:LOCAL}{(LOCAL)});
\item \emph{name} not found \wref{core:'}{'},
\wref{core:POSTPONE}{POSTPONE}, \wref{core:[']}{[']},
\wref{core:[COMPILE]}{[COMPILE]});
\item parameters are not of the same type \wref{core:DO}{DO},
\wref{core:qDO}{?DO}, \wref{core:WITHIN}{WITHIN});
\item \wref{core:POSTPONE}{POSTPONE},
\wref{core:[COMPILE]}{[COMPILE]},
\wref{core:'}{'} or
\wref{core:[']}{[']} applied to \wref{core:TO}{TO};
\item string longer than a counted string returned by
\wref{core:WORD}{WORD};
\item $u$ greater than or equal to the number of bits in a cell
(\wref{core:LSHIFT}{LSHIFT}, \wref{core:RSHIFT}{RSHIFT});
\item word not defined via \wref{core:CREATE}{CREATE}
(\wref{core:toBODY}{>BODY}, \wref{core:DOES}{DOES>});
\item words improperly used outside
\wref{core:num-start}{<\num} and \wref{core:num-end}{\num>}
(\wref{core:num}{\num}, \wref{core:numS}{\num{}S},
\wref{core:HOLD}{HOLD},
\wref{core:HOLDS}{},
\wref{core:SIGN}{SIGN}).
\end{itemize}
\remove{x:rc0}{The following specific ambiguous conditions are have been introduced
as a consequence of specific extensions.}
\begin{description}
\item[\textsf{X:deferred}\strike{2.5}{45}]\cbstart~\cbend
% ==== X:Deferred ====
\begin{itemize}
\item access to a deferred word, a word defined by \wref{core:DEFER}{DEFER},
which has yet to be assigned to an \param{xt}.
\item access to a deferred word, a word defined by \wref{core:DEFER}{DEFER},
which was not defined by \wref{core:DEFER}{DEFER}.
\item \wref{core:POSTPONE}{POSTPONE}, \wref{core:[COMPILE]}{[COMPILE]},
\wref{core:[']}{[']} or \wref{core:'}{'} applied to \wref{core:ACTION-OF}{ACTION-OF}
or \wref{core:IS}{IS}.
\end{itemize}
% ==== X: Escaped Strings ====
\item[\textsf{X:escaped-strings}\strike{2.5}{80}]\cbstart~\cbend
\begin{itemize}
\item \bs{x} is not followed by two hexadecimal characters (\wref{core:Seq}{}).
\item a \bs{} is placed before any character, other than those defined in
\wref{core:Seq}{}.
\end{itemize}
\end{description}
\subsection{Other system documentation} % 4.1.3
A system shall provide the following information:
\begin{itemize}
\item list of non-standard words using \wref{core:PAD}{PAD}
(\xref[Other transient regions]{usage:transient});
\item operator's terminal facilities available;
\item program data space available, in address units;
\item return stack space available, in cells;
\item stack space available, in cells;
\item system dictionary space required, in address units.
\end{itemize}
\section{Program documentation} % 4.2 ===============================
\label{doc:program}
\subsection{Environmental dependencies} % 4.2.1
\label{doc:env}
A program shall document the following environmental dependencies,
where they apply, and should document other known environmental
dependencies:
\begin{itemize}
\item considering the pictured numeric output string buffer a fixed
area with unchanging access parameters
(\xref[Other transient regions]{usage:transient});
\item depending on the presence or absence of non-graphic characters
in a received string (\wref{core:ACCEPT}{ACCEPT});
\item relying on a particular rounding direction
(\xref[Integer division]{usage:div});
\item requiring a particular number representation and arithmetic \\
(\xref[Internal number representation]{usage:number});
\item requiring non-standard words or techniques
(\xref[Usage requirements]{usage});
\item requiring the ability to send or receive control characters
(\xref[Control characters]{usage:control},
\wref{core:KEY}{KEY});
\item using control characters to perform specific functions
\wref{core:EMIT}{EMIT}, \wref{core:TYPE}{TYPE});
\item using flags as arithmetic operands
(\xref[Flags]{usage:flags});
\item using lower case for standard definition names or depending
on the case sensitivity of a system
(\xref[Definition names]{usage:names});
\item using definition names of more than 31 characters in length
(\xref{usage:names});
\item using the graphic character with a value of hex 24
(\xref[Graphic characters]{usage:ASCII}).
\end{itemize}
\subsection{Other program documentation} % 4.2.2
A program shall also document:
\begin{itemize}
\item minimum operator's terminal facilities required;
\item whether a Standard System exists after the program is loaded.
\end{itemize}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
% history package
%
% Actually it should be called changes but that is already used by
% the docstrip system.
%
% This is a first draft of a change history package and is not
% ready for public distribution. It is provided on an "as you find
% it" basis, and no support is offered.
%
% The code has been developed by Dr. Peter Knaggs.
%
% 0.1 PjK Original Code
% 0.2 PjK Complete rewrite of original code
% Introducing \@history@test
% 0.3 PjK Added History Log
% 0.4 PjK \@history@test now useable in inner paragraphs
% Fixed problem with \openhistory
% Added silent labelling on same page (\@history@label)
\def\fileversion{0.4}
\def\filedate{04 Aug 2007 17:08:00 BST}
\def\filename{history.sty}
\def\Copyright{Copyright (C) 2007 Peter Knaggs,
University of Bournemouth, England}
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{history}[2007/08/04]
\typeout{Package `history' <\filedate>.}
\typeout{\Copyright}
\newif\if@history@final
\DeclareOption{final}{\@history@finaltrue}
\DeclareOption{draft}{\@history@finalfalse}
\ExecuteOptions{draft}
\ProcessOptions
\RequirePackage[outerbars]{changebar}[2004/02/20]
\setlength{\changebarwidth}{1pt}
\RequirePackage[normalem]{ulem}[2000/05/26]
% Define a file to record the changes / history
\newwrite\@history@file
\newif\if@history@open
\@history@openfalse
\newcommand{\openhistory}[1][\jobname.hst]{%
\if@history@open
\immediate\closeout\@history@file
\fi
\immediate\openout\@history@file=#1
\@history@opentrue
\typeout{Writing Change History to #1}
}
\newcommand{\closehistory}{%
\if@history@open
\immediate\closeout\@history@file
\@history@openfalse
\fi
}
% Define a list of accepted changes
\def\@history@accepted{}
\def\accept#1{\edef\@history@accepted{\zap@space#1 \@empty,\@history@accepted}}
\@onlypreamble\accept
% Define a list of rejected changes
\def\@history@rejected{}
\def\reject#1{\edef\@history@rejected{\zap@space#1 \@empty,\@history@rejected}}
\@onlypreamble\reject
\newcommand{\listaccepted}{%
\@for\temp@a:=\@history@accepted\do{\temp@a }
}
\newcommand{\listrejected}{%
\@for\temp@a:=\@history@rejected\do{\temp@a }
}
\newcommand{\@history@nolabel}{\@latex@error
{Change on line \the\inputlineno\space has no label}
{Give the damn thing a label.}%
}
\newcommand{\@history@review}{\@latex@error
{The change \temp@a\space is neither accepted or rejected}
{Add the change label to either the \noexpand\accept or \noexpand\reject list.}%
}
% The \@history@label macro is used to hold the last displayed label.
% It is used to control the printing of the change label in the margin
% note.
\def\@history@label{}
% The \@history@test macro is the work horse of this package. It take
% a number of parameters as follows:
%
% label: The label of a change (may be left blank)
% accept: The Latex code required to typeset the change if it has been
% accepted
% reject: The LaTeX code for typesetting the change if it was rejected
% review: The code to typeset a change under review
%
% log: the log entry text
%
% If the label is blank a warning will be produced.
\newif\if@tempswb
\newcommand{\@history@test}[5]{% {label}{accept}{reject}{review}{log}
\edef\temp@a{#1}% Remember the change label
\@tempswatrue % Change Processed
\@tempswbfalse % Don't Log the change
%
\ifx\temp@a\empty % The label is empty
\if@history@final
\@history@nolabel
\fi
\def\temp@a{noname}%
\fi
%
% Change is accepted
%
\@for\temp@b:=\@history@accepted\do
{\ifx\temp@a\temp@b
\@tempswafalse % Change shown
\@tempswbtrue % Log the change
{#2}% % Show the accepted text
\fi}%
%
% Change is rejected
%
\@for\temp@b:=\@history@rejected\do
{\ifx\temp@a\temp@b
\@tempswafalse % Change Shown
{#3}% % Show the rejected text
\fi}%
%
% Neither Accepted or Rejected, so must be in review
%
\if@tempswa
\if@history@final
% Review in a Final revision - Something wrong with this
\@history@review
\fi
\@tempswbtrue% Log the review
\ifinner\@tempswatrue\else\@tempswafalse\fi
\cbstart% Start the change bar
\if@tempswa
% We are in an inner paragraph
% Fix the extra vspace \cbstart puts in for us.
\vspace*{-0.5\baselineskip}%
\fi%
{#4}% Output the change text
\if@tempswa
% Margin par is not allowed in an inner paragraph
\else
% Make up the last displayed label, on this page
\edef\temp@b{\thepage.\temp@a}
% Have we seen this label before?
\ifx\temp@b\@history@label
% Yes - then ignore the label
\else
% No - Must be a either a new label, or the
% first label on this page. Output the label
\marginpar{\tiny\temp@a{\color{white}c:b}}
% Remember the label for next time.
\edef\@history@label{\temp@b}
\fi
\fi
\cbend% Make the end of the Change bar
\fi
%
% Write a log entry
%
\if@history@open
\if@tempswb
\immediate\write\@history@file{%
\string\@historylog@%
{\temp@a}% Change Label
{\thepage}% Page Number
{\@currentlabel}%
#5% Log entry
}%
\fi
\fi
}
\newcommand{\place}[2]{% {label}{text}
\@history@test%
{#1}% Change Label
{#2}% Accepted text
{}% Rejected text
{\uline{#2}}% Review text
{place{#2}}% Log text
}
\newcommand{\remove}[2]{% {label}{text}
\@history@test%
{#1}% Change Label
{}% Accepted text
{#2}% Rejected text
{\sout{#2}}% Review text
{remove{#2}}% Log text
}
\newcommand{\replace}[3]{% {label}{old}{new}
\@history@test%
{#1}% Change Label
{#3}% Accepted text
{#2}% Rejected text
{\sout{#2}\uline{#3}}% Review text
{replace{#2}{#3}}% Log text
}
{\Large\bfseries
American National Standard for Information Systems --- \\[2pt]
Programming Language --- \\[2pt]
Forth
}
\chapter{Introduction}
\section{Purpose}
The purpose of this Standard is to promote the portability of Forth
programs for use on a wide variety of computing systems, to facilitate
the communication of programs, programming techniques, and ideas among
Forth programmers, and to serve as a basis for the future evolution of
the Forth language.
\section{Scope}
This Standard specifies an interface between a Forth System and a
Forth Program by defining the words provided by a Standard System.
\subsection{Inclusions}
This Standard specifies:
\begin{itemize}
\item the forms that a program written in the Forth language may take;
\item the rules for interpreting the meaning of a program and its data.
\end{itemize}
\subsection{Exclusions} % 1.2.2
\label{intro:exclusions}
This Standard does not specify:
\begin{itemize}
\item the mechanism by which programs are transformed for use on
computing systems;
\item the operations required for setup and control of the use of
programs on computing systems;
\item the method of transcription of programs or their input or
output data to or from a storage medium;
\item the program and Forth system behavior when the rules of this
Standard fail to establish an interpretation;
\item the size or complexity of a program and its data that will
exceed the capacity of any specific computing system or the
capability of a particular Forth system;
\item the physical properties of input/output records, files, and units;
\item the physical properties and implementation of storage.
\end{itemize}
\section{Document organization}
\subsection{Word sets}
This Standard groups Forth words and capabilities into \emph{word sets}
under a name indicating some shared aspect, typically their common
functional area. Each word set may have an extension, containing words
that offer additional functionality. These words are not required in an
implementation of the word set.
The ``Core'' word set, defined in sections 1 through 6, contains the
required words and capabilities of a Standard System. The other word
sets, defined in sections \ref{wordlist:block} through
\ref{wordlist:string}, are optional, making it possible to provide
Standard Systems with tailored levels of functionality.
\subsubsection{Text sections}
Within each word set, section 1 contains introductory and explanatory
material and section 2 introduces terms and notation used throughout
the Standard. There are no requirements in these sections.
Sections 3 and 4 contain the usage and documentation requirements,
respectively, for Standard Systems and Programs, while section 5
specifies their labeling.
\subsubsection{Glossary sections}
Section 6 of each word set specifies the required behavior of the
definitions in the word set and the extensions word set.
\subsection{Annexes}
The annexes do not contain any required material.
Annex \ref{annex:rationale} provides some of the rationale behind the
committee's decisions in creating this Standard, as well as
implementation examples. It has the same section numbering as the
body of the Standard to make it easy to relate each requirements
section to its rationale section.
Annex \ref{annex:bib} is a short bibliography on Forth.
Annex \ref{annex:intro} provides an introduction to Forth.
Annex \ref{annex:diff} discusses the compatibility of ANS Forth
with earlier Forths, emphasizing the differences from Forth 83.
Annex \ref{annex:port} presents some techniques for writing portable
programs in ANS Forth.
\remove{x:rc0}{%
Annex \ref{annex:test} presents a test suite to test the operation
of a system complies with the definitions documented in this
standard.}
Annex \ref{annex:index} includes the words from all word sets in a
single list, and serves as an index of ANS Forth words.
\section{Future directions}
\subsection{New technology}
This Standard adopts certain words and practices that are
increasingly found in common practice. New words have also
been adopted to ease creation of portable programs.
\subsection{Obsolescent features}
\label{intro:obsoleat}
This Standard adopts certain words and practices that cause
some previously used words and practices to become obsolescent.
Although retained here because of their widespread use, their
use in new implementations or new programs is discouraged,
as they may be withdrawn from future revisions of the Standard.
This Standard designates the following word as obsolescent:
\setwordlist{core}
\begin{tabular}{rl@{\qquad}rl@{\qquad}rl}
\ref{tools:FORGET} & \word[tools]{FORGET} \\
\end{tabular}
This standard designates the following practice as obsolescent:
\begin{itemize}
\item Requiring floating-point numbers to be kept on the data stack.
(This has always been an environmental dependency.)
\item Using \word{ENVIRONMENTq} to enquire whether a word set is present.
\end{itemize}
This diff is collapsed.
\chapter{Terms, notation, and references}
The phrase ``See:'' is used throughout this Standard to direct the
reader to other sections of the Standard that have a direct bearing
on the current section.
In this Standard, ``shall'' states a requirement on a system or
program; conversely, ``shall not'' is a prohibition; ``need not''
means ``is not required to''; ``should'' describes a recommendation
of the Standard; and ``may'', depending on context, means ``is allowed
to'' or ``might happen''.
Throughout the Standard, typefaces are used in the following manner:
\begin{itemize}
\item This proportional serif typeface is used for text, with
\textit{italic} used for symbols and the first appearance of new
terms;
\item A bold proportional sans-serif typeface is used for
\textbf{headings};
\item A bold monospaced serif typeface is used for Forth-language
\textbf{\texttt{text}}.
\end{itemize}
\section{Definitions of terms}
\label{notation:terms}
Terms defined in this section are used generally throughout this
Standard. Additional terms specific to individual word sets are
defined in those word sets. Other terms are defined at their first
appearance, indicated by italic type. Terms not defined in this
Standard are to be construed according to the \emph{Dictionary for
Information Systems,} ANSI X3.172-1990.
\begin{description}
\item[address unit:]
Depending on context, either
1) the units into which a Forth address space is divided for the
purposes of locating data objects such as characters and variables;
2) the physical memory storage elements corresponding to those units;
3) the contents of such a memory storage element; or
4) the units in which the length of a region of memory is expressed.
\item[aligned address:]
The address of a memory location at which a character, cell, cell
pair, or double-cell integer can be accessed.
\item[ambiguous condition:]
A circumstance for which this Standard does not prescribe a
specific behavior for Forth systems and programs.
Ambiguous conditions include such things as the absence of a needed
delimiter while parsing, attempted access to a nonexistent file, or
attempted use of a nonexistent word. An ambiguous condition also
exists when a Standard word is passed values that are improper or
out of range.
\item[cell:]
The primary unit of information in the architecture of a Forth
system.
\item[cell pair:]
Two cells that are treated as a single unit.
\item[character:]
Depending on context, either
1) a storage unit capable of holding a character; or
2) a member of a character set.
\item[character-aligned address:]
The address of a memory location at which a character can be
accessed.
\item[character string:]
Data space that is associated with a sequence of consecutive
character-aligned addresses. Character strings usually contain
text. Unless otherwise indicated, the term ``string'' means
``character string''.
\item[code space:]
The logical area of the dictionary in which word semantics are
implemented.
\item[compile:]
To transform source code into dictionary definitions.
\item[compilation semantics:]
The behavior of a Forth definition when its name is encountered
by the text interpreter in compilation state.
\item[counted string:]
A data structure consisting of one character containing a length
followed by zero or more contiguous data characters. Normally,
counted strings contain text.
\item[cross compiler:]
A system that compiles a program for later execution in an
environment that may be physically and logically different
from the compiling environment. In a cross compiler, the term
``host'' applies to the compiling environment, and the term
``target'' applies to the run-time environment.
\item[current definition:]
The definition whose compilation has been started but not yet ended.
\item[data field:]
The data space associated with a word defined via \word{CREATE}.
\item[data space:]
The logical area of the dictionary that can be accessed.
\item[data-space pointer:]
The address of the next available data space location, i.e., the
value returned by \word{HERE}.
\item[data stack:]
A stack that may be used for passing parameters between
definitions. When there is no possibility of confusion, the
data stack is referred to as ``the stack''. Contrast with
\textbf{return stack}.
\item[data type:]
Tn identifier for the set of values that a data object may have.
\item[defining word:]
A Forth word that creates a new definition when executed.
\item[definition:]
A Forth execution procedure compiled into the dictionary.
\item[dictionary:]
An extensible structure that contains definitions and
associated data space.
\item[display:]
To send one or more characters to the user output device.
\item[environmental dependencies:]
A program's implicit assumptions about a Forth system's
implementation options or underlying hardware. For example,
a program that assumes a cell size greater than 16 bits is
said to have an environmental dependency.
\item[execution semantics:]
The behavior of a Forth definition when it is executed.
\item[execution token:]
A value that identifies the execution semantics of a definition.
\item[find:]
To search the dictionary for a definition name matching a given
string.
\item[immediate word:]
A Forth word whose compilation semantics are to perform its
execution semantics.
\item[implementation defined:]
Denotes system behaviors or features that must be provided and
documented by a system but whose further details are not prescribed
by this Standard.
\item[implementation dependent:]
Denotes system behaviors or features that must be provided by a
system but whose further details are not prescribed by this Standard.
\item[input buffer:]
A region of memory containing the sequence of characters from the
input source that is currently accessible to a program.
\item[input source:]
The device, file, block, or other entity that supplies characters
to refill the input buffer.
\item[input source specification:]
A set of information describing a particular state of the input
source, input buffer, and parse area. This information is
sufficient, when saved and restored properly, to enable the nesting
of parsing operations on the same or different input sources.
\item[interpretation semantics:]
The behavior of a Forth definition when its name is encountered
by the text interpreter in interpretation state.
\item[keyboard event:]
A value received by the system denoting a user action at the user
input device. The term ``keyboard'' in this document does not
exclude other types of user input devices.
\item[line:]
A sequence of characters followed by an actual or implied line
terminator.
\item[name space:]
The logical area of the dictionary in which definition names are
stored.
\item[number:]
In this Standard, ``number'' used without other qualification means
``integer''. Similarly, ``double number'' means ``double-cell
integer''.
\item[parse:]
To select and exclude a character string from the parse area using
a specified set of delimiting characters, called delimiters.
\item[parse area:]
The portion of the input buffer that has not yet been parsed, and
is thus available to the system for subsequent processing by the
text interpreter and other parsing operations.
\item[pictured-numeric output:]
A number display format in which the number is converted using
Forth words that resemble a symbolic ``picture'' of the desired
output.
\item[program:]
A complete specification of execution to achieve a specific
function (application task) expressed in Forth source code form.
\item[receive:]
To obtain characters from the user input device.
\item[return stack:]
A stack that may be used for program execution nesting, do-loop
execution, temporary storage, and other purposes.
\item[standard word:]
A named Forth procedure, formally specified in this Standard.
\item[user input device:]
The input device currently selected as the source of received
data, typically a keyboard.
\item[user output device:]
The output device currently selected as the destination of
display data.
\item[variable:]
A named region of data space located and accessed by its memory
address.
\item[word:]
Depending on context, either
1) the name of a Forth definition; or
2) a parsed sequence of non-space characters,
which could be the name of a Forth definition.
\item[word list:]
A list of associated Forth definition names that may be examined
during a dictionary search.
\item[word set:]
A set of Forth definitions grouped together in this Standard
under a name indicating some shared aspect, typically their
common functional area.
\end{description}
\section{Notation} % ================================================
\label{notations}
% ---------- X:enhanced-locals ----------
\cbstart\patch{x:enhanced-locals}
\uline{The following notation is used to define the syntax of the external
representation of numbers:}
\begin{itemize}
\item \uline{Each component of a number is defined with a rule consisting
of the name of the component (italicized in angle-brackets,
e.g., \arg{decdigit}), the characters \textsf{:=} and a concatenation
of tokens and metacharacters;}
\item \uline{Tokens may be literal characters (in bold face, e.g.,
\textbf{E}) or rule names in angle brackets (e.g.,
\linebreak \arg{decdigit});}
\item \uline{The metacharacter * is used to specify zero or more occurrences of
the preceding token (e.g., \arg{decdigit}*);}
\item \uline{Tokens enclosed with [ and ] are optional (e.g., [\textbf{-}]);}
\item \uline{Vertical bars separate choices from a list of tokens enclosed
with braces (e.g., \{ \textbf{0} {\textbar} \textbf{1} \}).}
\end{itemize}
\begin{list}{}{
\setlength{\labelwidth}{1.7em} % <== Magic number, width of indent
\setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\labelsep}
}
\item[See:]
\xref[3.4.1.3 Text interpreter input number conversion]{usage:numbers},
\xref[12.3.7 Text interpreter input number conversion]{float:conv},
\wref{floating:toFLOAT}{},
\wref{floating:FSd}{FS.} and
\wref{local:b:}{}.
\end{list}
\cbend
% --------------------
\subsection{Numeric notation}
\label{notation:numeric}
Unless otherwise stated, all references to numbers apply to signed
single-cell integers. The inclusive range of values is shown as
\textbf{\{\textit{from {\ldots} to}\}}. The allowable range for the
contents of an address is shown in double braces, particularly for
the contents of variables,
e.g., \word{BASE} \textbf{\{\{2 {\ldots} 36\}\}}.
% ---------- X:number-prefix ----------
\cbstart\patch{x:enhanced-locals}
\sout{The following notation is used to define the syntax of the external
representation of numbers:}
\begin{itemize}
\item \sout{Each component of a number is defined with a rule consisting
of the name of the component (italicized in angle-brackets,
e.g., \arg{decdigit}), the characters \textsf{:=} and a concatenation
of tokens and metacharacters;}
\item \sout{Tokens may be literal characters (in bold face, e.g.,
\textbf{E}) or rule names in angle brackets (e.g.,
\linebreak \arg{decdigit});}
\item \sout{The metacharacter * is used to specify zero or more occurrences of
the preceding token (e.g., \arg{decdigit}*);}
\item \sout{Tokens enclosed with [ and ] are optional (e.g., [\textbf{-}]);}
\item \sout{Vertical bars separate choices from a list of tokens enclosed
with braces (e.g., \{ \textbf{0} {\textbar} \textbf{1} \}).}
\end{itemize}
\cbend
% --------------------
\subsection{Stack notation}
Stack parameters input to and output from a definition are described
using the notation:
\begin{quote}
\stack[stack-id]{before}{after}
\end{quote}
where \emph{stack-id} specifies which stack is being described,
\param{before} represents the stack-parameter data types before
execution of the definition and \param{after} represents them
after execution. The symbols used in \param{before} and \param{after}
are shown in table \ref{table:datatypes}.
The control-flow-stack \emph{stack-id} is ``C:'', the data-stack
\emph{stack-id} is ``S:'', and the return-stack \emph{stack-id}
is ``R:''. When there is no confusion, the data-stack
\emph{stack-id} may be omitted.
When there are alternate \param{after} representations, they are
described by ``\param{after_1 | after_2}''. The top of the stack is
to the right. Only those stack items required for or provided by
execution of the definition are shown.
\subsection{Parsed-text notation}
\label{notation:parsed}
If, in addition to using stack parameters, a definition parses text,
that text is specified by an abbreviation from table \ref{table:syntax},
shown surrounded by double-quotes and placed between the \param{before}
parameters and the ``-{}-'' separator in the first stack described, e.g.,
\begin{quote}
\stack[S]{before "parsed-text-abbreviation"}{after}
\end{quote}
\begin{table}[ht]
\begin{center}
\caption{Parsed text abbreviations}
\label{table:syntax}
\begin{tabular}{ll}
\hline\hline
Abbreviation & Description \\
\hline
\param{<char>} & the delimiting character marking the end of
the string being parsed \\
\param{<chars>} & zero or more consecutive occurrences of the
character \param{<char>} \\
\param{<space>} & a delimiting space character \\
\param{<spaces>}& zero or more consecutive occurrences of the
character \param{<space>} \\
\param{<quote>} & a delimiting double quote \\
\param{<paren>} & a delimiting right parenthesis \\
\param{<eol>} & an implied delimiter marking the end of a line \\
\param{ccc} & a parsed sequence of arbitrary characters,
excluding the delimiter character \\
\param{name} & a token delimited by space, equivalent to
\param{ccc<space>} or \param{ccc<eol>} \\
\hline\hline
\end{tabular}
\end{center}
\end{table}
\subsection{Glossary notation}
The glossary entries for each word set are listed in the standard
ASCII collating sequence. Each glossary entry specifies an ANS
Forth word and consists of two parts:
an \emph{index line} and the \emph{semantic description} of the
definition.
\subsubsection{Glossary index line}
The index line is a single-line entry containing, from left to right:
\begin{itemize}
\item Section number, the last four digits of which assign a
unique sequential number to all words included in this Standard;
\item \textbf{DEFINITION-NAME} in upper-case, mono-spaced,
bold-face letters;
\item Natural-language pronunciation in quotes if it differs from English;
\item Word-set designator from table \ref{table:wordsets}.
The designation for extensions word sets includes ``EXT''.
\item \textsf{Extension designator} in sans-serif font under the
Word-set designator for words which have been added to the
Standard via the named extension.
\end{itemize}
\begin{table}[ht]
\begin{center}
\caption{Word set designators}
\label{table:wordsets}
\begin{tabular}{lr}
\hline\hline
Word set & Designator \\
\hline
Core word set & CORE \\
Block word set & BLOCK \\
Double-Number word set & DOUBLE \\
Exception word set & EXCEPTION \\
Facility word set & FACILITY \\
File-Access word set & FILE \\
Floating-Point word set & FLOATING \\
Locals word set & LOCALS \\
Memory-Allocation word set & MEMORY \\
Programming-Tools word set & TOOLS \\
Search-Order word set & SEARCH \\
String-Handling word set & STRING \\
\hline\hline
\end{tabular}
\end{center}
\end{table}
\subsubsection{Glossary semantic description}
The first paragraph of the semantic description contains a stack
notation for each stack affected by execution of the word. The
remaining paragraphs contain a text description of the semantics.
See \xref[Semantics]{usage:semantics}.
\section{References}
The following national and international standards are referenced
in this Standard:
\begin{itemize}
\item ANSI X3.172-1990 \textit{Dictionary for Information Systems},
(\xref[Definition of terms]{notation:terms});
\item ANSI X3.4-1974 \textit{American Standard Code for Information
Interchange} (ASCII),
(\xref[Graphic characters]{usage:ASCII});
\item ISO 646-1983 \textit{ISO 7-bit coded characterset for
information interchange, International Reference Version} (IRV)
(\xref[Graphic characters]{usage:ASCII})\footnote{Available from
the American National Standards Institute, 11 West 42nd Street,
New York, NY 10036.};
\item ANSI/IEEE 754-1985 \textit{Floating-point Standard},
(\xref[(12.2.1) Definition of terms]{float:terms}).
\end{itemize}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.