Diff for /gforth/Attic/gforth.texi between versions 1.1 and 1.5

version 1.1, 1994/05/07 14:55:54 version 1.5, 1994/08/19 17:47:21
Line 106  for introductory material. Line 106  for introductory material.
 @comment node-name,     next,           previous, up  @comment node-name,     next,           previous, up
 @chapter Goals of GNU Forth  @chapter Goals of GNU Forth
 @cindex Goals  @cindex Goals
 !! Insert Goals here  The goal of the GNU Forth Project is to develop a standard model for
   ANSI Forth. This can be split into several subgoals:
   
   @itemize @bullet
   @item
   GNU Forth should conform to the ANSI Forth standard.
   @item
   It should be a model, i.e. it should define all the
   implementation-dependent things.
   @item
   It should become standard, i.e. widely accepted and used. This goal
   is the most difficult one.
   @end itemize
   
   To achieve these goals GNU Forth should be
   @itemize @bullet
   @item
   Similar to previous models (fig-Forth, F83)
   @item
   Powerful. It should provide for all the things that are considered
   necessary today and even some that are not yet considered necessary.
   @item
   Efficient. It should not get the reputation of being exceptionally
   slow.
   @item
   Free.
   @item
   Available on many machines/easy to port.
   @end itemize
   
   Have we achieved these goals? GNU Forth conforms to the ANS Forth
   standard; it may be considered a model, but we have not yet documented
   which parts of the model are stable and which parts we are likely to
   change; it certainly has not yet become a de facto standard. It has some
   similarities and some differences to previous models; It has some
   powerful features, but not yet everything that we envisioned; on RISCs
   it is as fast as interpreters programmed in assembly, on
   register-starved machines it is not so fast, but still faster than any
   other C-based interpretive implementation; it is free and available on
   many machines.
   
 @node Other Books, Invocation, Goals, Top  @node Other Books, Invocation, Goals, Top
 @chapter Other books on ANS Forth  @chapter Other books on ANS Forth
Line 177  variable @code{GFORTHPATH}; if this does Line 216  variable @code{GFORTHPATH}; if this does
 @node Notation, Arithmetic, Words, Words  @node Notation, Arithmetic, Words, Words
 @section Notation  @section Notation
   
 The Forth words are describes in this section in the glossary notation  The Forth words are described in this section in the glossary notation
 that has become a de-facto standard for Forth texts, i.e.  that has become a de-facto standard for Forth texts, i.e.
   
 @quotation  @quotation
Line 223  The name of a stack item corresponds in Line 262  The name of a stack item corresponds in
 @item name starts with  @item name starts with
 Type  Type
 @item f  @item f
 Bool, i.e. false (0) or true (-1).  Bool, i.e. @code{false} or @code{true}.
 @item c  @item c
 Char  Char
 @item w  @item w
Line 320  theoretically keep floating point number Line 359  theoretically keep floating point number
 additional difficulty, you don't know how many cells a floating point  additional difficulty, you don't know how many cells a floating point
 numkber takes. It is reportedly possible to write words in a way that  numkber takes. It is reportedly possible to write words in a way that
 they work also for a unified stack model, but we do not recommend trying  they work also for a unified stack model, but we do not recommend trying
 it. Also, a Forth system to keep the local variables on the return  it. Also, a Forth system is allowed to keep the local variables on the
 stack. This is reasonable, as local variables usually eliminate the need  return stack. This is reasonable, as local variables usually eliminate
 to use the return stack explicitely. So, if you want to produce a  the need to use the return stack explicitely. So, if you want to produce
 standard complying program and if you are using local variables in a  a standard complying program and if you are using local variables in a
 word, forget about return stack manipulations in that word (see the  word, forget about return stack manipulations in that word (see the
 standard document for the exact rules).  standard document for the exact rules).
   
 @subsetion Data stack  @subsection Data stack
 drop  drop
 nip  nip
 dup  dup
Line 397  df! Line 436  df!
 @subsection Memory block access  @subsection Memory block access
   
 move  move
 fill  
 blanks  
 erase  erase
   
   While the previous words work on address units, the rest works on
   characters.
   
   cmove
   cmove>
   fill
   blank
   
 @node Control Structures  @node Control Structures
 @section Control Structures  @section Control Structures
   
Line 417  IF Line 462  IF
   @var{code}    @var{code}
 ENDIF  ENDIF
 @end example  @end example
   or
 @example  @example
 @var{flag}  @var{flag}
 IF  IF
Line 437  system that only supplies @code{THEN} is Line 482  system that only supplies @code{THEN} is
 : endif   POSTPONE then ; immediate  : endif   POSTPONE then ; immediate
 @end example  @end example
   
 We also provide the words @code{?dup-if} and @code{?dup-not-if}, so you  [According to @cite{Webster's New Encyclopedic Dictionary}, @dfn{then
   (adv.)}  has the following meanings:
   @quotation
   ... 2b: following next after in order ... 3d: as a necessary consequence
   (if you were there, then you saw them).
   @end quotation
   Forth's @code{THEN} has the meaning 2b, @code{THEN} in Pascal
   and many other programming languages has the meaning 3d.]
   
   We also provide the words @code{?dup-if} and @code{?dup-0=-if}, so you
 can avoid using @code{?dup}.  can avoid using @code{?dup}.
   
 @example  @example
Line 527  index by @var{n} instead of by 1. The lo Line 581  index by @var{n} instead of by 1. The lo
 between @var{limit-1} and @var{limit} is crossed. E.g.:  between @var{limit-1} and @var{limit} is crossed. E.g.:
   
 4 0 ?DO  i .  2 +LOOP   prints 0 2  4 0 ?DO  i .  2 +LOOP   prints 0 2
   
 4 1 ?DO  i .  2 +LOOP   prints 1 3  4 1 ?DO  i .  2 +LOOP   prints 1 3
   
 The behaviour of @code{@var{n} +LOOP} is peculiar when @var{n} is negative:  The behaviour of @code{@var{n} +LOOP} is peculiar when @var{n} is negative:
   
 -1 0 ?DO  i .  -1 +LOOP  prints 0 -1  -1 0 ?DO  i .  -1 +LOOP  prints 0 -1
   
  0 0 ?DO  i .  -1 +LOOP  prints nothing   0 0 ?DO  i .  -1 +LOOP  prints nothing
   
 Therefore we recommend avoiding using @code{@var{n} +LOOP} with negative  Therefore we recommend avoiding using @code{@var{n} +LOOP} with negative
Line 539  Therefore we recommend avoiding using @c Line 595  Therefore we recommend avoiding using @c
 case behaves symmetrical to the positive case:  case behaves symmetrical to the positive case:
   
 -2 0 ?DO  i .  -1 +LOOP  prints 0 -1  -2 0 ?DO  i .  -1 +LOOP  prints 0 -1
   
 -1 0 ?DO  i .  -1 +LOOP  prints 0  -1 0 ?DO  i .  -1 +LOOP  prints 0
   
  0 0 ?DO  i .  -1 +LOOP  prints nothing   0 0 ?DO  i .  -1 +LOOP  prints nothing
   
 The loop is terminated when the border between @var{limit-sgn(n)} and  The loop is terminated when the border between @var{limit-sgn(n)} and
 @var{limit} is crossed. However, @code{S+LOOP} is not part of the ANS  @var{limit} is crossed. However, @code{S+LOOP} is not part of the ANS
 Forth standard.  Forth standard.
   
 The @code{?DO} can be replaced by @code{DO}. @code{DO} enters the loop  @code{?DO} can be replaced by @code{DO}. @code{DO} enters the loop even
 even when the start and the limit value are equal. We do not recommend  when the start and the limit value are equal. We do not recommend using
 using @code{DO}. It will just give you maintenance troubles.  @code{DO}. It will just give you maintenance troubles.
   
   @code{UNLOOP} is used to prepare for an abnormal loop exit, e.g., via
   @code{EXIT}. @code{UNLOOP} removes the loop control parameters from the
   return stack so @code{EXIT} can get to its return address.
   
   Another counted loop is
   @example
   @var{n}
   FOR
     @var{body}
   NEXT
   @end example
   This is the preferred loop of native code compiler writers who are too
   lazy to optimize @code{?DO} loops properly. In GNU Forth, this loop
   iterates @var{n+1} times; @code{i} produces values starting with @var{n}
   and ending with 0. Other Forth systems may differently, even if they
   support @code{FOR} loops.
   
 FOR NEXT UNLOOP  
   
 @contents  @contents
 @bye  @bye

Removed from v.1.1  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>