Forth was first developed in the early 1970s for scientific applications by Charles Moore and Elizabeth Rather.
For computers to be useful, they must be programmed. For beginners this usually means programming in BASIC, but for professional programmers this could include:
- BASIC (considered too slow for many applications)
- Assembler (machine code – Not user friendly and limited to one CPU)
Forth is easy to start to learn, is compact and has fast execution.
This book is a complete guide to Forth programming. In this book you will be introduced to the language through examples and comparisons with BASIC. Later we will explore some of the more unusual aspects of Forth, some that have no equivalent in other languages.
- The 1994 ANS Forth standard dialect is adopted for much of this book.
How is Forth Different
There are many statements that at first glance may seem contradictory or confusing when you are talking about Forth. For example, Forth:
- was traditionally a threaded-interpretive language, but now exists as native code systems as well
- is commonly written in Forth, but also has been written in Assembler, C and recently Python
- is extensible,
- is a high-level language with direct access to primitive operators and hardware
- is both an interpreter and a compiler,
- is an easy language for absolute beginners to program in,
- is difficult to master for programmers experienced in other languages,
- is a two stack machine (data stack, return stack)
- programmer must use the data stack directly
- uses Reverse Polish Notation (RPN),
- commonly uses integer arithmetic,
- uses spaces to separate input values,
- does not start to execute any of your typed input until after you press the enter key,
- is an interactive language, like BASIC,
- but can incrementally compile code one line at a time at the console,
- and allows interactive Assembly language,