Forth

Forth is a stack-oriented language and interactive environment. It is versatile, light weight, and highly adaptable.

Table of Contents

Forth is a stack-oriented language and interactive environment. It is versatile, light weight, and highly adaptable.

Forth was originally created by Charles Moore in the late sixties. The name is an allusion to Forth being a "fourth" generation language. In some ways it is, in others not. Forth is probably a transition between 3rd and 4th generation languages in that it allows you to CREATE a language which is suited for your task.

For many years (late 1980s, early 1990s), it seemed that Forth was dying out. The number of Forth programmers had declined. The number of hardware limited platforms which forth excels at utilizing efficiently also declined. Managers would say

it isn't mainstream

In 1994 a new standard for Forth was published by ANSI. This new standard, though it does cause problems for many people who use Forth to its true potential, does open up the market for a standard which all vendors can provide compatability to. In addition, I believe the standards body made some fine analyses of things which widely differed between forth systems -- and managed to Factor them into more basic parts which actually eliminate many existing difficulties.

In addition Forth has found its way, courtesy lots of hard work by Mitch Bradley into a new niche -- firmware for computer systems. Mitch worked at Sun for many years and was a Forth enthusiast. He would often burn a prom with a forth system on it to test new suns before the real firmware was available -- or because the real firmware couldn't run due to the hardware problem that was being debugged. I'm not certainly exactly what happened, but obviously Mitch's work and the adaptability of Forth pushed Sun to adapt it as their new firmare. The firware in all Suns, Open Boot is really Forth, as is the new Open Firmware standard for portable firmware. This is used in many platforms -- not just workstations but consumer class boxes as well; Forth firmware is used in every Apple PowerPC product these days.

Things are looking up for Forth.

I've made the decision in this document to use Forth instead of FORTH as the "form" of the language name in the text I write. While the full-uppercase goes with the language's origins, it is also a big upper-case distraction when you read it, and implies an acronym. The single-capital version seems to flow more readily.

A section of programming using Forth, rather than discussing Forth itself. There are duplications of some sites above in here, since I really haven't started organizing this.

You can also check out the section on individual's Forth web pages which can have programming info as well.

Meta Compilation is using an existing Forth system to construct a new forth systems. This can be something as simple as constructing a new image of an existing system / platform combination with a new feature. It can be as complex as generating a completely different forth system to run on another platform.

There are supposedly a large number of applications and devices in the real world which use Forth. I say supposedly not from a critical point of view of Forth, but rather because so few of them tell anyone about their successes. One estimate is that people treat Forth use as a trade secret so that no one knows why they are successful. Another is that managers etc at these companies are too embarrased of a non-mainstream tool to admit using it.

Forth's first big bang was in the hands of the astronomers -- literally. Kitt Peak observatory needed a system to run their telescope and data collection and calculation facilities on a PDP-11. Forth was chosen as a system which could run the telescope in real-time and provide multi-terminal and multi-user data collection and analysis tools. For many years they distributed their Forth system -- initially for PDP-11, and later for VAX-11. The distributions included both hosted and native versions of Forth on the various platforms. Hosted environments included the DEC PDP-11 Semi-Realtime Operating systems, RT-11, RSX-11, VMS on the VAX, as well as Unix on both architectures. The native version of their Forth system was PDP-11 only, and limited to various PDP-11 models and hardware.

One of the most pervasive unknown Forth successes has been FedEx's handheld package tracking devices. They were all Forth powered, under-time and budget, and worked remarkably well. The new generation of FedEx package trackers (the ones that look like scan guns) use Forth as well.

Athena Programming for many years maintained (and may still do) a huge multi-user Forth systems for some dedicated applications. That performs networking and other functions, and was moved to PC hardware when that became pervasive.

HP's later-day calculators, the HP48 series are basically forth internals on the inside, with a forth-ish lisp-ish interface on the outside. This Forth-like variant is called RPL. There is a Paper by Bill Wickes on RPL which I am trying to find to add to the list below.

The engines for a number of the various MUCKs and MUDs out there are Forth inspired. Instead of untyped stack objects the have "typed" stack objects and support items suchs as ... objects, strings, players, etc. It is a great example of what forth can do, even if it isn't a traditional forth implementation. The programming language is refered to as MUF, or Multi-User Forth. The base system and primitives are written in C. In addition to having enough MUF code to literally build a virtual world, they have good tools, interaction facilities, and good recommended practices.

Forth is quite popular for space related projects. A number of satellites and experiments aboard space vehicles are run by Forth systems. Small size, low power consumption, adaptability, real-time are all factors which promote Forth to be used in space applications. The Forth environment also leads itself to verification of systems, something highly desired for spacecraft which are either autonomous, and/or un-retrievable once launched. Many CPUs which are Space Rated are low powered and the economic Forth system allows these facilities to be more than adequate. The forth CPU Harris RTX 2000 family of processors was designed to be used in space -- and is quite popular for that very use .... running Forth!

Of course Forth excels for embedded systems. Many of the things written about earlier are specific examples of an embedded system. The range of these more generic systems can vary. Anywhere from a single-chip micro collecting sensor information to a custom networked stage lighting system. The interactiviy, and compactness combined with high-functionality are again a winner.

Forth has also been popular in easy-to-use desktop systems. Canon had their Canon Cat, designed by Jeff Raskin, which is a Forth based desktop computing appliance. This had a lightening-fast startup, literally you powered it on and it was ready to start where you left off. This box is an excellent example of good human engineering, usability, and power all in the same box. I recommend reading Jeff's paper collection, the history of the Canon Cat, and also his work on user interfaces. The UI work culminates in THE The Humane Interface which is his current book and his distilled experience in years of UI development.

Another popular system based on Forth is Epson's QX-10 computer running VALDOCS. From what I recall, the QX-10 was powered by a Z80-clone running a choice of OS's. The QX-10 would either boot Valdocs directly, or a CP/M work-alike called TP/M. There are some people which called VALDOCS a failure, and perhaps it was. From summarizing info on the net, the problem appears to be performance related; most likely the problem was an under-powered CPU for the workload, that not Forth being the failure. On the other hand many people describe it as a computing appliance that is easy to use, robust, and reliable. Valdocs may not have been that great of a failure ... since it went on to be supported on the Atari-ST family of 68000 systems.

Forth has been in the firmware of Sun Microsystem's workstations and computers for a number of years. It is a great success since it allows a boot monitor which is a fully functional programming language to work with. This work proved to be so popular that the Open Firmware standard emerged across vendors so that other people and institutions could use this powerful tool. Apple Macintoshes, IBM Power Systems, and Sun Workstations are some prime examples of the use of Open Firmware. Some people make Open Firmware available as an real PC-clone boot monitor tool, so those platforms can have access to such good tools. Unfortunately no BIOS vendors have switched their propriety screen based firmware to Open Firmware yet. Hopefully this will change -- and prompt more progress in the field -- when the abiliity to use complex cards as boot devices on PCs and other systems increases in demand. No one wants to write PC-specific boot roms for their hardware which can be used on many different platforms when they can just use Open Firmware instead.

CVS, Colour Vision Systems uses a Forth based system to sort fruit. When the existing CPU for their hardware, the Motorola 68K, was end-of-lifed they took a long hard look at what their next generation box would be. Box is perhaps a poor term, since their fruit sorters are complex network based systems! CVS had a lot of platform specific assembler code in their OS, and their application used Forth. Their decision waqs to have a portable platform which they could run on any hardware. This portable platform is an complete OS written in Forth. It is called COLDFORTH, named after the ColdFire Motorola CPU that they use. The Forth system has preemptive multi-tasking, its own TCP/IP stack (remember, this runs on native hardare, no other OS), and has an object-oriented I/O and networking platform. Recenctly CVS has switched to Linux, but since all the code is Forth they continue to use it and a version of their system ported to Linux. This is run on embedded uClinux, and the name of their Forth system in this environment is uCforth. CVS uses Gforth as a bootstrap environment for their Linux version of Forth. Just in case you get an idea that this is some trivial project ... these people maintain their own research effort into fruit sorting and evaluation. Pretty cool stuff!

Not so Random, but rather this page is a mess and I don't know where to put this yet!

There are literally more Forth systems than you can shake a stick at. This is good -- there is a lot if innovation going on in the Forth world. Some people mention a downside to the variety of systems ... something may be wrong with Forth if everyone needs to make their own system.

Here are some programming techniques, algorithms, and related issues which are of interest to people using forth systems. For example, alternative algorithms and implementation techniques which would not be considered for a mainstream system, but are important for limited resource or time critical systems.

Here are some purveyors of hardware. Some have dedicated Forth cpus. Others provide Forth versions of conventional CPUSs. And yet others provide Forth in ROM on their systems. And then I tossed in hardware documentation and FAQs as well as vendors and designs. A smorgasbord if you will.

Something I'm starting work on -- books about FORTH. Most of these are just placeholders until I look about the actual titles, and perhaps some links.

Books

Starting Forth; Brody

Thinking Forth; Brody

TIL -- Thread Intepretive Languages; Loeliger

Forth Programmers Handbook; FORTH Inc.

Stack Based Computers

Julian Noble's Forth numeric book.

Papers

Manuals