A Forth with strong static type checking. (https://web.archive.org/web/20120129051615/http://home.vrweb.de/~stephan.becher/forth/)

root

StrongForth 1.4
===============


Contents:

1. Introduction
2. Files
3. ANS compliance
4. Known issues
5. Version history
6. Next steps
7. Contact



1. Introduction

StrongForth is a programming language that is very close to ANS 
Forth. One of the biggest differences is that it includes strong 
static type-checking. ANS Forth itself is often called "typeless" 
or "untyped", which means that neither interpreter nor compiler 
do any type-checking when applying a function (a "word") to one 
or more operands. It is completely up to the programmer to chose 
the correct functions. In StrongForth, the interpreter and the 
compiler check if a function matches the operands on the stack. 
This allows finding type mismatches and unbalanced loops and 
conditional branches already at compile time. Additionally, it 
is possible to overload words by using the same name for 
different functions, as long as each word expects a different 
set of parameters on the stack. 

The majority of Forth users might believe that strong static 
typing is not Forth-like. Nevertheless, the implementation of
StrongForth proves that Forth can incorporate static
type-checking without increasing the complexity of the language.

StrongForth is a 16-bit pure text-mode application that runs in 
the DOS-box of every Windows PC. StrongForth is distributed under 
the GNU General Public license (see copying.txt). Sources and 
build instructions are separately available at 
http://home.vrweb.de/stephan.becher/forth.




2. Files

The complete package consists of 26 files:

readme.txt          This file.
forth.exe           Run this file to start StrongForth 1.4.
forth.blk           1000 Forth blocks.
copying.txt         GNU General Public License.
glossary.txt        Complete glossary as text, to be used by HELP.
doc\toc.htm         StrongForth documentation table of contents.
doc\intro.htm       An introduction to StrongForth.
doc\crossref.htm    An ANS Forth - StrongForth cross reference list.
doc\editor.htm      Reference of the line editor.
doc\asm.htm         Reference of the StrongForth assembler/disassembler.
doc\facility.htm    Reference of the StrongForth Facility word set.
doc\tools.htm       Reference of the StrongForth Programming-Tools word set.
doc\utilities.htm   Documentation of samples and utilities.
doc\oop.htm         Documentation of the Object Oriented Programming library.
doc\gforth.htm      StrongForth glossary.
doc\gblock.htm      Glossary of the StrongForth Block word set.
doc\gexception.htm  Glossary of the StrongForth Exception word set.
doc\gfacility.htm   Glossary of the StrongForth Facility word set.
doc\gDOS.htm        Glossary of the StrongForth File-Access word set.
doc\gfloat.htm      Glossary of the StrongForth Floating-Point word set.
doc\gtools.htm      Glossary of the StrongForth Programming-Tools word set.
doc\gmalloc.htm     Glossary of the StrongForth Memory-Allocation word set.
doc\gsearch.htm     Glossary of the StrongForth Search-Order word set.
doc\geditor.htm     Glossary of the line editor.
doc\goop.htm        Glossary of the Object Oriented Programming library.
doc\fdl.txt         GNU Free Documentation License.

To install StrongForth, simply unpack the ZIP file into a new 
directory. Before running forth.exe, this directory should be 
made the working directory. Standard words are recognized in 
upper case only, because StrongForth is case sensitive. Integer 
literals have data type UNSIGNED by default, and data type SIGNED 
if preceded by a sign character (- or +). Literals with a 
trailing decimal point are double-cell numbers. Floating-point 
numbers are always decimal and have an exponent indicated by an 
"E". To exit StrongForth, type BYE.

During execution of forth.exe, all console input and output is 
logged in a text file named forth.log. This feature is for 
evaluation purposes only and will be removed or modified in 
future versions.

This is the contents of the block file forth.blk:

block  001         License conditions
block  002         Autoexec block
block  003 -  004  Reserved
blocks 005 -  020  ANS Forth error messages
blocks 021 -  029  StrongForth error messages
blocks 030 -  079  StrongForth source library
blocks 080 -  099  Programming-Tools word set
blocks 100 -  129  Assembler
blocks 130 -  166  Disassembler
blocks 167 -  174  Line editor
blocks 175 -  179  Exception word set
blocks 180 -  186  Memory-Allocation word set
block  187 -  189  Reserved
blocks 190 -  199  Search-Order word set
blocks 200 -  363  StrongForth model
blocks 364 -  397  OOP library
blocks 398 -  399  Reserved
blocks 400 -  799  Unused
blocks 800 -  814  Floating-Point assembler
blocks 815 -  823  Floating-Point disassembler
blocks 824 -  899  Floating-Point word set
blocks 900 -  924  File-Access word set
blocks 925 -  935  Additional DOS interface words
blocks 936 -  939  Facility word set
blocks 940 -  993  Samples and utilities
blocks 994 - 1000  Reserved

The name of a specific block file may be supplied as a 
command-line parameter. To generate a new block file, copy 
forth.blk and rename it. To start StrongForth with the new block 
file, simply type

forth myblocks.blk

at the command line, where myblocks.blk is the name of the new 
block file. Without a command-line parameter, StrongForth starts 
with the default block file forth.blk.

Block 2 has special semantics. This block is automatically LOADed 
immediately after StrongForth has been started. It does normally 
contain instructions to compile the source library and then LOAD 
other blocks that contain the source code of additional word sets 
and utilities.



3. ANS compliance

StrongForth is not compliant to ANS Forth. Nevertheless, it 
requires a closer look to see the differences in the source code. 
For example, the simple FIG block editor that is included in the 
package looks mostly like standard ANS. The main differences 
between ANS Forth and StrongForth are described in intro.htm. 
crossref.htm is an ANS Forth to StrongForth cross reference.

StrongForth 1.4 includes the following word sets, which have been 
only slightly modified with respect to the ANS Forth standard:

Core
Block
Double-Number
Exception
Facility
File-Access
Floating-Point
Locals
Memory-Allocation
Programming-Tools
Search-Order
String

Note that some of these word sets are partly or fully provided as 
libraries in the forth.blk block file.



4. Known issues

- ACCEPT does not work correctly if more than n-2 characters are 
  entered.
- BL is ambiguous if the assembler is loaded, because BL is 
  overloaded by the addressing mode BL. Since BL does not have 
  any input parameters, FIND cannot distinguish the two 
  different versions.
- CODE is ambiguous, because the ANS Forth word CODE is 
  overloaded by the data type CODE.
- EVALUATE cannot be applied to parsing words, because they would 
  parse in the evaluated string.
- I and J should not be used as local names, if the definition 
  contains a DO loop.
- When using , between CREATE and DOES>, make sure the constant 
  data space is the current memory space. Otherwise, data will 
  not be compiled into the definition's data field.
- . for floating point numbers should not be used if the 
  representation requires more than 34 characters.
- Since REPRESENT internally uses 3 of the 8 slots of the 
  hardware floating-point stack, only 4 additional floating-point 
  numbers may be on the stack when displaying a floating-point 
  number.
- CATCH cannot be applied to words whose stack diagrams contain one 
  or more tuples.
- The Automatic THIS.feature does not work for RECURSE.



5. Version history

2000-07-30 Version 0.00
- Initial release including introduction to StrongForth .
- Block file with 100 blocks containing a simple line editor and 
  Programming-Tools word set as source.
- Including the following word sets: Core, Core extension, Block, 
  Block extension, Double, Double extension, Locals, Locals extension 
  and String.

2000-08-31 Version 0.01
- Several small bugs removed .
- Changed stack diagram of (FIND).
- Renamed FIND-CFA in FIND-TOKEN.
- New word: IMMEDIATE?.
- More sophisticated version of SEE.
- Included complete StrongForth glossary.

2000-09-30 Version 0.02
- Deveral small bugs removed.
- Added BYE.
- Selectable block file as command line parameter (see README.TXT).
- Autoexec block (see README.TXT).
- Added documentation: cross reference, programming-tools word set and 
  line editor.
- Removed EXECUTE in favour of dynamically compiled versions of 
  EXECUTE.
- Added >R, R>, (R>) and the new data type R-SIZE.
- Included .S to the core word set and added stack dump to ERROR.
- Changed the parameters of ABS and NEGATE to all integers.
- Implemented additional sample source code in blocks 70 to 79.
- Added new data type COLON-DIAGRAM to be used by : :NONAME DOES> ; ) 
  This change will allow ( to specify stack diagrams more generally, 
  which may become necessary in connection with future applications.

2000-12-03 Version 0.03
- Several small bugs removed.
- Extended maximum block file length to 200 blocks.
- Implemented assembler and disassembler inclusive extensive 
  documentation.
- Added samples documentation.
- Implemented Programming-Tools extension word set.
- Implemented )DEFER; IS )ADDRESS; )INTERPRET and )EVALUATE as 
  utilities.
- Made stack diagram handling more versatile by introducing 
  <DIAGRAM ... DIAGRAM> and doing several changes to ( and ).
- Added ! and @ for code addresses.
- Added editor specific version of LIST that includes TOP.
- Added CODE-HERE and CODE to the Core word set.
- Added new version of ?CONGRUENT.
- Replaced PROCREATES with )PROCREATES.
- Renamed (;CODE) in END-DEF.
- Renamed (EXECUTE) in EXECUTE and introduced (--) as new data type.
- Changed input parameters of (FIND) and added exact match feature.
- Changed input parameters of WITHIN.
- Removed H>S (can be replaced by SPLIT).
- Removed data types WDATA WCONST WCODE WPORT.
- Reorganized data type structure by introducing CADDRESS and using it 
  in + - +! 1+ 1- (LOOP) and (+LOOP).

2005-12-30 Version 1.0
- Wrote a comprehensive reference manual.
- Added Exception and Exception extension word sets.
- Fixed numerous bugs.
- Restructured the block file and introduced a standard core library.
- Increased number of blocks from 300 to 1000.
- Added StrongForth model to the block file.
- Added more samples and utilities.
- Added data types FAR-ADDRESS and CFAR-ADDRESS.
- Made NUMBER-DOUBLE a subtype of UNSIGNED-DOUBLE.
- Increased the size of all memory spaces to 65520.
- Restored (EXECUTE).
- Changed the order of input parameters of PARAMS>DT.
- Changed the parameters of ABS from INTEGER(-DOUBLE) to 
  SIGNED(-DOUBLE).
- Changed the parameters of < > MIN and MAX from UNSIGNED(-DOUBLE) to 
  INTEGER(-DOUBLE).
- Changed second parameter of .R from UNSIGNED to SIGNED.
- Changed the second input parameter of (PARAM) from 1ST to DATA-TYPE.
- Removed second input parameter of REFREEZE.
- Extended the semantics of WORDS.
- Changed the semantics of >TOKEN and extended FIND with code 22 for 
  >TOKEN.
- Added one input parameter to SP! and RP!.
- All address subtractions return SIGNED instead of INTEGER.
- Changed the input parameter of [IF] from FLAG to SINGLE.
- Renamed overloaded versions of ?CONGRUENT to THAW and ?IDENTICAL.
- Renamed double-cell version of (R@) to (DR@).
- Renamed BEGIN-DOLOOP to NEST-DO and END-DOLOOP to NEST-LOOP.
- Renamed SET? to ATTRIBUTE? and removed CLEAR?.
- Renamed EVAL-ADDR to SOURCE-ADDR and EVAL-COUNT to SOURCE-COUNT.
- Removed FIND and renamed (FIND) in FIND.
- Removed CFA and [CFA].
- Removed ?UNTOUCHED =INITIAL? and ?NUMBER.
- Added ALIAS INDEX NOOP )CAST and DEPTH-SP.
- Added R/W BLK-BUFF BLK-STAT #BLOCKS.
- Added FAR-HERE.
- Added TRANS-TOP TRANS-BOTTOM and >TRANS.
- Added signed version of SPACES.
- Added PARENT and DT-OFFSET.
- Added [LITERAL] 'TOKEN 'CODE ['CODE] ['TOKEN] and >CODE.
- Added LINK (CREATE) and CREATE-NONAME.
- Added overloaded version of /STRING with default parameter 1.
- Added <VALUE and VALUE>.
- Added ?LOOP DOES, ALL-PARAMS>DT and >SIGN.
- Added ENCLOSE-PARAMS and ?PARAMS.
- Added ENCLOSE-DIAGRAM and END-DIAGRAM.
- Added ?SUBTOKEN ?NAME-EXECUTE ?DEFINITION ?SAME-DATA-TYPE and NEXT.
- Added SP0 and RP0.
- Added END-DEFINITION CODE[ and ]END-CODE.
- Added NONAME? SMUDGE? ?NONAME and ?SMUDGE.

2006-11-09 Version 1.1
- Added Facility and Floating-Point word sets.
- Extended the assembler with floating-point instructions.
- Added (CAST) and PARAMS.
- Fixed serious defects in ?CONGRUENT DT>DT LOCALS| FM/MOD ;
- Replaced END-CODE and END-DEFINITION with UNSMUDGE and made defining
  words return DEFINITION and COLON-DEFINITION instead of 
  STACK-DIAGRAM and COLON-DIAGRAM. END-CODE is no longer required to 
  finish CODE and ALIAS definitions.
- Replaced CREATE-NONAME with (CREATE-NONAME).
- Extended the semantics of CREATE to allow defining words that return 
  their data field address, and removed )ADDRESS;.
- Replaced )DEFER; with DEFER.
- Removed CODE[ and ]ENDCODE.
- Added support for strongly typed data structures as a utility.
- Added a size parameter to ancestor data types SINGLE DOUBLE FLOAT 
  and replaced DOUBLE? with SIZE and ANCESTOR.
- Made ABORT INTERPRET THROW deferred definitions.
- Changed NUMBER to return a null data type instead of throwing an 
  exception.
- Removed CONST-CELL-ALLOT.
- Added * and */ for signed double-precision numbers.
- Removed @ and ! for PORT and CPORT, because these words don't work 
  anyway in a protects environment.
- Added exception handlers for user abort (^C) and division by zero.
- RESIZE-FILE can only make a file longer than it already is.

2007-04-24 Version 1.2
- Added File-Access and Memory-Allocation word sets.
- Changed data type of SOURCE-ID from SIGNED to FILE.
- Extracted the Exception word set into a separate library.
- Implemented an enhanced version of SEE.
- Added 24 blocks of new samples and utilities.
- Factored ?BLOCK out of LOAD.
- Replaced R/W with (BLOCK).
- Improved floating-point stack usage of LN and LOG.
- Replaced (R!) with (R).
- Factored ?VALUE and ADDR out of TO and added +TO.
- Factored RESOLVE and -RESOLVE out of THEN AGAIN UNTIL.
- Changed the implementation of DO ... LEAVE ... LOOP to avoid 
  double indirection, and changed the sematic of (LEAVE).
- Changed the implementation of CASE ... OF ... ENDOF ... ENDCASE 
  to avoid double indirection, and removed (ENDOF).
- Added SYNONYM for defining aliases with separate code field, 
  and redefined some words using SYNONYM instead of ALIAS.
- Factored deferred word PROMPT out of QUIT.
- Added additional assertions to (DOES).
- Added ?SIZE, to be used instead of SIZE in DEPTH-SP SP-LOCATE 
  PICK ROLL )FIELD )CFIELD TIMES.
- Factored DTDROP out of CAST.
- Added new ancestor data type TUPLE.
- Reimplemnted SAVE-INPUT and RESTORE-INPUT to use tuples.

2008-01-10 Version 1.3
- Integrated word lists into the kernel, adding words WID 
  FORTH-WORDLIST LOCAL-WORDLIST ENVIRONMENT-WORDLIST GET-CURRENT 
  SET-CURRENT and modifying words LINK WORDS MARKER.
- Added Search-Order word set
- Replaced FIND with the deferred word SEARCH-ALL, including callback 
  routines as matching criteria.
- Replaced FIND-TOKEN with SEARCH-TOKEN.
- Replaced FIND-LOCAL with SEARCH-LOCAL.
- Reimplemented ENVIRONMENT? based on a separate wordlist.
- Moved EDITOR and ASSEMBLER from the Programming-Tools word set to 
  the Search-Order word set.
- Replaced the smudge bit with a mechanism that postpones adding a 
  word to the current word list.
- Enforced usage of END-CODE at the end of all code definitions.
- Added Memory-Allocation word set.
- Renamed ALLOCATE for data type FAR-ADDRESS to FAR-ALLOCATE.
- Extended FREE and RESIZE to accept null addresses.
- Added aliases for SIZE FREE and RESIZE that accept addresses of data 
  types CFAR-ADDRESS.
- Added CALLOCATE and CFAR-ALLOCATE as aliases of ALLOCATE and 
  FAR-ALLOCATE that create addresses of data types CDATA and 
  CFAR-ADDRESS.
- Changed parameter UNSIGNED to INTEGER in + - +! for items of data 
  type INTEGER-DOUBLE FLOAT DFADDRESS SFADDRESS.
- Changed parameter UNSIGNED to INTEGER in all versions of .R.
- Replaced the two versions of SPACES for data types SIGNED and 
  UNSIGNED with one version for data type INTEGER.
- Added MOVE and TRANSIENT for data type FAR-ADDRESS.
- Added LAST and FIRST to Programming-Tools Word set.
- Added three versions of ERASE for floating-point numbers.
- Added [DEFINED] and [UNDEFINED] to the utilities.
- Added .ADDR to the Programming-Tools word set.
- Added versions of DUMP for CODE and FAR-ADDRESS.
- Added quicksort algorithm to the utilities.
- Renamed number prefixes from B' O' D' A' X' to B# O# D# A# H#.
- Removed data type IOR and replaced all usages with SIGNED.
- Fixed defects in RESTORE-INPUT SEE )PROCREATES ?CONGRUENT
- Removed LINK,
- Stripped ?COLON to take an argument of data type CONST -> CODE.
- Simplified NEXT by removing the check for LATEST.
- Added a size parameter and added compilation of attribute field to 
  CREATE-LOCAL.
- Renamed line editor word DELETE to DEL.
- Implemented a more intelligent end-of-disassembly criterion.
- Added ?DECIMAL to be used for floating-point output.
- Removed ?IDENTICAL and reimplemented IS.
- Extended LOCALS| to allow multiple usages within a definition.
- Extended . for word lists to display ??? if no corresponding 
  vocabulary exists.

2008-04-10 Version 1.4
- Added Full-featured OOP and structures library.
- Removed previous implementation of structures from the utilities.
- Added RESIZE for files.
- Added DATA-HERE.
- Added HELP to the utilities.
- Added template feature to the utilities.
- Added [CTRL] and <DEL> to the utilities.
- Increased the size of the file input buffer to 1024 characters.



6. Next steps

The following features will be added in the next versions of 
StrongForth:

1. StrongForth library to be loaded on top of ANS Forth systems.
2. Native code compilation.



7. Contact

Questions, comments and new ideas are welcome. Send an email to 
stephan.becher@vr-web.de.

The latest version and up-to-date information are available at 
http://home.vrweb.de/stephan.becher/forth

April 10th, 2008