[Cialug] Forth, was Re: Question?

D. Joe Anderson cialug@cialug.org
Tue, 26 Oct 2004 21:39:32 -0500

On Tue, Oct 26, 2004 at 01:40:35PM -0500, Christopher Freeman wrote:

> My ex-cousin-once-removed-in-law used to program in Forth as a 
> free-lance programmer. That's pretty esoteric. He swore by it. I'll 
> never know why.

Not so esoteric for embedded/robotic systems--the controls for
the Space Shuttle's arm were programmed in Forth, if I recall
correctly.  As are the controls for some of the greenhouses at
Iowa State.  And Open Firmware is Forth, or something very
Forth-like from what I hear and from what little I've seen when
I've bothered to pay attention.

Forth is a threaded-interpreted language, which has some of the
speed advantages of compiled languages but some of the
rapid-development advantages of an interpreted language.  It's
very extensible, but can be pretty thrifty with resources,
especially in terms of code size (though of course this
code-size thriftyness comes as a result of its inscrutable,
line-noise-like, almost write-only, reverse Polish, stack-based
syntax:  People who bitch about Perl a lot have probably never
tried to read a block of Forth code).

Not that I've ever programmed much in it, but I did dabble. 
Most of what I know about it I picked up sort of by osmosis
while rooming at the (no joking) The Institute For Applied Forth
Research back in the early '90s, while they were trying to put
together an ANSI standard for the language.  And I devoured R.G.
Loeliger's "Threaded Interpreted Languages" back around then,
too, but I think that may have been before I actually owned a
computer that had a Forth implementation available.

OK, on second thought, now maybe "esoteric" isn't far off the
mark.  Back in the day, it seemed exotic and cool.  Now,
"apt-cache search forth" on Debian woody shows at least 5
implementations of it:

gforth - GNU Forth Language Environment
kforth - Small Forth Interpreter Written in C++
pfe - Portable Forth Environment, ANS standard, all wordsets.
pforth - portable Forth interpreter
yforth - A small freeware Forth environment in ANSI C.

The largest of these installs in all of about 2MB.

I especially liked this clause from Dirk Zoller's README file
for pfe:

   While I leave the writing of an ANSI-C compiler in Forth to
   those who really believe in Forth's superiority and