Forth isn’t a shiny new programming language, but it has a staunch following because it is lightweight and elegant. The brainchild of [Chuck Moore], the language is deceptively simple. Words are character sequences delimited by spaces. In its simplest form, Forth knows a few basic words including–and this is the key–a word to define other words.
[Jean-Claude Wippler] likes to experiment with physical computing and he found a Forth image ready-made for the LPC1114. Why is that interesting? The LPC1114 is one of the few (or maybe the only) modern ARM processor in a breadboard-friendly DIP package. Since [Jean-Claude] had a chip sitting around, he had a Forth system up in no time. All he needed was a breadboard and a 3.3V serial connector. The chip has its own bootloader and the The Mecrisp-Stellaris Forth he used has over 300 words as well as the ability, of course, to add more.
If you ever used HP calculators (or slide rules) you’ll appreciate that Forth uses Reverse Polish Notation (RPN). For example the following words compute and print 2 times 10:
10 2 * .
You could make a word to multiply things by 2 (for example, mydouble) like this:
: mydouble 2 * ;
So you could then say
10 mydouble .
That seems pretty simple, but you can build a lot like this including entire assemblers and even cross-compilers for Forth itself.
By the way, the same Mecrisp-Stellaris Forth will run on the KL25Z mbed boards we covered a few weeks ago. You can even get Forth to run on an Arduino (see video below). If you bought an iCEstick to follow our recent FPGA tutorial series, you can run a Forth CPU on that board, too.