Forth/Introduction

From Wikibooks, open books for an open world
Jump to: navigation, search
Introduction
Forth

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:

  • is a threaded-interpretive language,
  • is written in Forth,
  • is extensible,
  • is a high-level language that has access to primitive operators,
  • 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,
  • uses the stack and Reverse Polish Notation (RPN),
  • 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
  • is compiled each time you press the enter key, unlike BASIC.

How to read this book[edit]

Cheat Sheet[edit]

For Programming/Computer Professionals[edit]