Our sister company:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

What is Forth?

The vast majority of WareWorks’ projects use C or C++ as the programming language. However, we also use Forth in many embedded controller projects.

Charles Moore invented Forth in the 1960s to assist with the interactive control of radio telescopes. The popular FIG (Forth Interest Group) Forth model was created in 1978 and updated in 1983. In 1994 the internationally recognised ANSI Forth standard was released.

Forth is a stack-based language with a built in interpreter and compiler. The interpreter allows new “words” to be created and added to the core vocabulary by manual entry at a computer keyboard or by inclusion of a text file. The use of a core vocabulary and the ability to create new search branches in it means that Forth is very good at describing applications in natural language terms. For example, using the interpreter one can create a whole new vocabulary specific to providing Morse output:

  Input from keyboard Output
  : dot [char] . emit ; Ok
  Dot . Ok
  : dots 0 ?do dot loop ; Ok
  4 dots .... Ok
  : dash [char] – emit ; Ok
  Dash - Ok
  : dashes 0 ?do dash loop ; Ok
  5 dashes ----- Ok
  : rest bl emit ; Ok
  : mf 2 dots dash dot rest ; Ok
  mf ..-. Ok
  : mo 3 dashes rest ; Ok
  : mr dot dash dot rest ; Ok
  : mt dash rest ; Ok
  : mh 4 dots rest ; Ok
  : mforth mf mo mr mt mh ; Ok
  mforth ..-. --- .-. - .... Ok
  : mforth .” F o r t h !” ; mforth is redefined Ok
  mforth F o r t h ! Ok
  forget mforth Ok
  mforth ..-. --- .-. - .... Ok

The full ANSI Forth specification and related Forth literature can be obtained at: http://www.forth.org/literature.html

.WareWorks uses Forth for the following reasons:

  • An emulator is not required. All debugging can be performed using a serial link to communicate with the core Forth interpreter.
  • It is an interactive interpretive language that allows operations to be tried out before final coding.
  • Test suite is built in - the Forth interpreter executes what you type.
  • Executes close to assembly code speeds.
  • Programs can be written in a style closely resembling natural language.
  • Additional words can be added to the compiler and the entire syntax changed as required.

Other links that may be of interest:
http://dec.bournemouth.ac.uk/forth/
http://www.forth.com/resources/evolution/index.html