Rick Carlino

Lead software developer and a co-founding member at FarmBot

Co-founder and Maker of Things at Fox.Build Makerspace in St. Charles, IL.

[ 📨 Newsletter ] [ 💬 Contact ] [ 👤 About ]


FORTH Programming as a Learning Experience

FORTH has been a hobby of mine for years now and I really wish more folks would give it a look. This holds particularly true for people who wish to learn low level computer concepts. It has expanded my knowledge of programming immensely and I hope more people give it a look, even if just for the sake of learning.

A common approach to learning new languages is to use knowledge of previous languages to build understanding of a new one. I find FORTH to be one of the few languages to take a complete departure from the traditions of more conventional languages. While many languages act as a refinement to previous ones (and indeed, FORTH is said to be influence by Lisp and APL), FORTH holds a disregard for conventionality that truly make it a rewarding experience to those willing to embark on the challenge.

FORTH offers the minimalism of a “systems language” with the interactivity of a scripting language. FORTH programming requires the use of low level concepts like pointers and manual memory management, but in an interactive environment that feels more like a scripting language. It lets you try things out, tinker and debug problems interactively. The language is described as having a “low floor and a high ceiling” in this regard. Even on constrained microcontrollers like the Arduino it manages to provide a full command prompt and compiler on the target system with just a few kilobytes. Development is faster and more enjoyable than the write-compile-load cycles seen in other languages.

What makes it stand out most, and what I really feel makes it suitable for education is that FORTH can be entirely understood by a single person after a short period of study. It is so simple in fact that there are FORTH interpreters written in a few hundred lines of x86 assembly and even processors that natively understand the language at the machine level. It allows the user to see into a system’s inner workings without the need for complex build tools. Even on embedded systems the FORTH compiler runs interactively on the target device. Very little developer setup is required, aside from having a serial terminal application like screen running.

FORTH’s strange syntax causes many to look past it, But I hope more people give it a look. The language offers a great opportunity for learning. It also can help to solidify concepts seen in other languages, such as pointers in C but in a more approachable way.

If you have an Arduino laying around, why not give it a try? There are many other FORTHS for the desktop as well.

Further Reading: