Introduction To StrongForth

submited by
Style Pass
2024-11-13 04:00:02

This introduction to StrongForth has been written for those who already have collected some experience with Forth. Although StrongForth is as close to ANS Forth as possible, it is not required that the reader has worked with an ANS compliant Forth system.

The basic idea behind StrongForth is the wish to add strong static type checking to a Forth system. Previous Forth systems and standards (including ANS) were supposed to be typeless or untyped, which means they do not do any type checking at all. The interpreter and the compiler generally accept any word to be applied to the operands on the data and return stack. This behaviour grants total freedom to the programmer, but on the other side it is rather often a reason for type errors, which frequently cause system crashes and other more or less strange behaviour throughout the whole development phase.

StrongForth does not guarantee bug-free programs. It does not even grant the absence of crashes. But type errors will be greatly reduced. Furthermore, since interpreter and compiler know about the data types of the operands on the stack, they are able to chose the appropriate version of a word, if the dictionary contains several words with the same name, but different input parameter types. This is called operator overloading. As will be shown in this introduction, operator overloading allows a much more comfortable way of programming. Additionally, it is no longer necessary for you to invent individual names for words with the same semantics, but different data types.

Leave a Comment