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)
  • Pascal
  • Fortran
  • C
  • C++
  • Ada
  • 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 Edit

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 (and most systems have an Assembler)
  • 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 program tokens
  • 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 (even promotes) interactive Assembly language,

How to read this book Edit

Cheat Sheet Edit

You can quickly get a taste of Forth syntax in a LearnXinYminutes tutorial which is written in Forth!

Learn Forth in Five Minutes

This brief tutorial does not teach Forth programming "style" or the mind-set that is used to get the most out of Forth's collection of low level routines.

That is best learned by studying the code of experience Forth programmers and applying the methods to your own programming problem.

For Programming/Computer Professionals Edit