This approach leads to conceptually correct solutions with a minimum of effort. In Forth, words must be compiled before they can be referenced. Thus, a listing begins with the most primitive definitions and ends with the highest-level words. Figure 6 shows a complete listing of the washing machine example. This is a typical Forth block of source code.
Comments are in parentheses.
Forth allows as many comments as desired, with no penalty in object code size or performance. Even from this simple example, it may be clear that Forth is not so much a language, as a tool for building application-oriented command sets. Because Forth is extensible, Forth programmers write collections of words that apply to the problem at hand. The power of Forth, which is simple and universal to begin with, grows rapidly as words are defined in terms of previously defined words. Each successive, newer word becomes more powerful and more specific.