Jump to content

Forth

25% developed
From Wikibooks, open books for an open world

The Forth language is a stack-based language designed for rapid interactive programming in limited-resource environments. Forth is interesting because it can be simple and small, yet it allows for remarkably powerful extensions to be written in Forth itself; most fully-fledged Forth systems are implemented partially in Forth. Forth is most often used to write embedded applications.

Forth emphasizes a number of classic computer ideas, such as

  • one pass compilation
  • factoring and subroutines
  • interactivity
  • making an application to get a result greater than the sum of its parts.

Many ritual necessities of other languages and required designer syntax falls away.

Forth is an extensible language, giving the user great flexibility to extend it. This is both a pro and a con. As with modeling clay, in the hands of an architect with a clear philosophy it can work wonders, or it can create a hodgepodge. Much Forth programming consists of "adding words to a dictionary" and learning someone's program, the words they have chosen to create, and their significance is often confused with learning the language itself.

Lessons

  1. Introduction
  2. Core ideas of Forth
  3. Parsing in Forth, or "What happened to the Compiler"
  4. Structuring vs. words that actually do something
  5. Basic Syntax
  6. Manipulating the Stack
  7. Arithmetics
  8. Control Structures
  9. Handling Files

Appendices

Further reading