TITLE: Go Forth and M* AUTHOR: Eugene Wallingford DATE: October 08, 2007 8:05 PM DESC: ----- BODY: It is easy to forget how diverse the ecosphere of programming languages is. Even most of the new languages we see these days look and feel like the same old thing. But not all languages look and feel the same. If you haven't read about the Forth programming language, you should. It will remind you just how different a language can be. Forth is a stack-based language that uses postfix notation and the most unusual operator set this side of APL. I've been fond of stack-based languages since spending a few months playing with the functional language Joy and writing an interpreter for it while on sabbatical many years ago. Forth is a more of a systems language than Joy, but the programming style is the same. I recently ran across a link to creator Chuck Moore's Forth -- The Early Years, and it offered a great opportunity to reacquaint myself with the language. This paper is an early version of the paper that became the HOPL-2 paper on Forth, but it reads more like the notes of a talk -- an informal voice, plenty of sentence fragments, and short paragraphs that give the impression of stream of consciousness. This "autobiography of Forth" is a great example of how a program evolves into a language. Forth started as a program to compute a least-squares fitting of satellite tracking data to determine orbits, and it grew into an interpreter as Moore bumped up against the limitations of the programming environment on the IBM mainframes of the day. Over time, it grew into a full-fledged language as Moore took it with him from job to job, porting it to new environments and extending it to meet the demands of new projects. He did not settle for the limitations of the tools available to him; instead, he thought "There must be a better way" -- and made it so. As someone teaching a compilers course right now, I smiled at the many ways that Forth exemplified the kind of thinking we try to encourage in students learning to write a compiler. Moore ported Forth to Fortran and back. He implemented cross-assemblers and code generators. When speed mattered, he wrote native implementations. All the while, he kept the core of the language small, adding new features primarily as definitions of new "words" to be processed within the core language architecture. My favorite quotes from the paper appear at the beginning and the end. To open, Moore reports that he experienced what is in many ways the Holy Grail for a programmer. As an undergraduate, he took a part-time job with the Smithsonian Astrophysical Observatory at MIT, and...
My first program, Ephemeris 4, eliminated my job.
To close, Moore summarizes the birth and growth of Forth as having "the making of a morality play":
Persistent young programmer struggles against indifference to discover Truth and save his suffering comrades.
This is a fine goal for any computer programmer, who should be open to the opportunity to become a language designer when the moment comes. Not everyone will create a language that lasts for 50 years, like Forth, but that's not the point. -----