What is FORTH?


FORTH is a stack-based language which runs on a virtual machine like the modern Java VM. It's often implemented using indirect threaded code (a form of p-code) which makes compiled FORTH extremely compact. I chose it for my homemade computers because it:

It blew my mind when I realised how remarkably small the compiler was. Since FORTH is mostly written in FORTH, you can extend the language. For example, you can add a CASE statement if your system doesn't already have one. This is called Meta-FORTH. The core language has virtually no syntax; but as you extend it, you define your own!

Another interesting feature is that, since most data / parameter passing is done implicitly on the stack, you don't need to define (and name) a lot of variables; however, it is common practice to comment the stack effect of every FORTH word†. In FORTH, you name the actions not the data. †Subs and functions are called 'words' in FORTH.

FORTH was invented in the 1960's by Charles Moore. Leo Brodie wrote two excellent books about the language, which you can now read on-line: Starting FORTH and Thinking FORTH.