The A-Z of Programming Languages: Forth

Charles H. Moore talks about the origins of Forth and how it shows that a computer language can be simple and powerful.

Computerworld is undertaking a series of investigations into the most widely-used programming languages. Previously we have spoken to Alfred v. Aho of AWK fame, S. Tucker Taft on the Ada 1995 and 2005 revisions, Microsoft about its server-side script engine ASP, Chet Ramey about his experience maintaining Bash, and Bjarne Stroustrup of C++ fame.

In this article we chat to Charles H. Moore about the design and development of Forth. Moore invented Forth while at the US National Radio Astronomy Observatory to help control radio telescopes and data-collection/reduction systems.

Here he chats about why Forth was invented, as well as why he still works with Forth today.

How did Forth come into existence?

Forth came about when I was faced with a just-released IBM 1130 minicomputer. Compiling a Fortran program was a cumbersome procedure involving multiple card decks. I used Fortran to develop the first Forth, which could use the disk and graphics display that Fortran couldn't. Because it was interactive, my programming was much faster and easier.

Was there a particular problem you were trying to solve?

This computer was at Mohasco Industries. Their main product was carpet and the problem was to determine if the 1130 could help design carpets. Forth was great for programming the 2250 display, but ultimately the lack of color doomed the project.

Did you face any hard decisions in the development of the language?

The hardest decision in developing Forth was whether to do it. Languages were not casually designed. It was reputed to require a brilliant team and man-years of effort. I had my eye on something quick and simple.

I write Forth code every day. It is a joy to write a few simple words and solve a problem. As brain exercise it far surpasses cards, crosswords or Sudoku; and is useful.

How did Forth get its name?

I decided to call it Fourth, as in 4th-generation computer language. But the 1130 file system limited names to 5 characters, so I shortened it to Forth. A fortuitous choice, since Forth has many positive associations.

I have read that Forth was developed from your own personal programming system, which you began to develop in 1958. Can you tell us a little more about this?

My personal programming system was a deck of punch cards, [now] sadly lost. It had a number of Fortran subroutines that did unformatted input/output, arithmetic algorithms and a simple interpreter. It let me customize a program via its input at a time when recompiling was slow and difficult.

Why did you incorporate Reverse Polish notation into the language?

Reverse Polish notation is the simplest way to describe arithmetic expressions. That's how you learn arithmetic in grade school, before advancing to infix notation with Algebra. I've always favored simplicity in the interest of getting the job done.

Join the Computerworld Australia group on Linkedin. The group is open to IT Directors, IT Managers, Infrastructure Managers, Network Managers, Security Managers, Communications Managers.

More about: IBM, ISS, Microsoft, Saturn, Wikipedia
References show all

Comments

Anonymous

1

I think that I can learn Forth at our school.

<a href="http://mikecrabe.wordpress.com/">MikeCrabe</a>

Andy Korsak

2

I have been using Forth since around 1977 just after a Forth Interest Group (FIG) was formed in the San Francisco bay area. Every year at the National Forth Day meeting in November the genius of Chuck Moore has continued to impress us during his "fireside chat" about some great new innovation using the Forth approach to software. Various Forth interest groups scattered around the globe are still active, although nowhere near the peak activity level during the 1980's. Forth Inc http://forth.com is still commercially distributing programming environments for various platforms. There are free downloads for Windows, Mac, Linux, and other platforms, e.g. Win32Forth, MOPS.
http://tech.groups.yahoo.com/group/win32forth/
http://apps.sourceforge.net/mediawiki/powermops/index.php?title=Main_Page
http://www.thefreecountry.com/compilers/forth.shtml

Carl Gundel

3

HP-67 to Forth to Smalltalk

When I was a kid my father taught me to program the HP-67 calculator. This is a stack based, RPN calculator. I can't say that this is a Forth machine, but it prepared me for my serendipitous discovery of Starting Forth at my local library a few years later. I was hooked. Forth is a great language. I didn't really understand what made it great at the time honestly. I was only 15 years old when I first tried it (on a VIC-20 with HES Forth). I still did most of my programming in BASIC then, and a little 6502 assembler.

Later on the book Thinking Forth really gave my brain a shot. Then I was exposed to Smalltalk which I consider to be Forth on steroids. I've been Smalltalking ever since, but I still pay attention to what's going on in the world of Forth. Thanks to HP, Charles Moore, Leo Brodie, and Alan Kay!

Markoff

4

I used Forth for years on embedded systems and for that it's great. Ultimately, I gave it up because it seemed to poorly integrate when run under an OS and given libraries of modular routines, which is where I've spent most of my time since.

Regarding languages that are "fun", Forth is by no means the only one. My favorite is APL, the first I ever learned and the most elegant at least within its original context (even uses real multiply and divide characters, rather than repurposed from a typewriter design that didn't have them)-- it too has become somewhat of an anachronism in the context of the modern OS, though I still use an APL interpreter I wrote as a calculator daily. And, for "the satisfaction of finding a neat representation," APL is light-years ahead of Forth. But I've always felt that Forth, Lisp and APL had that extensibility in common (APL user-defined functions behave exactly like operators even though they're not represented by a single symbol as are the built-ins). Forth took it a few steps further by including extensibility of the compilation phase, but they all have the problem of working like a bit of a square peg-- they work great when on their own, but try to connect them with the rest of the computing world and it's somewhat awkward.

Vince Otten

5

I learned FORTH on a 16K (not 16 megabytes or 16 gig) TRS--80 using MMSFORTH. It was exciting being able to not only write programs that seemed to run as fast as assembler (and waaay faster than interpreted BASIC), but learning to extend the compiler itself!
The biggest plus of FORTH programming revealed itself when I was contracted to write some embedded software in the late 1970s on a 4K KIM-1 system. I had to learn a bit of 6502 assembler in order to interface with the RS-232 port, and build the program up to a (single-line) menu system. In usual FORTH fashion, it was debugged only once, and I never had to return and correct any code after it was burned into PROM.
The biggest minus is a lack FORTH shares with most other programming languages: lack of the success/failure return signals common to SNOBOL and Icon.
But I still love incremental compilers, and FORTH tops the list there.

Comments are now closed.
Related Coverage
Related Whitepapers
Latest Stories
Community Comments
Tags: a-z of programming languages
Whitepapers
All whitepapers

Microsoft extends Windows 8.1 Update migration deadline for business

READ THIS ARTICLE
DO NOT SHOW THIS BOX AGAIN [ x ]
Sign up now to get free exclusive access to reports, research and invitation only events.

Computerworld newsletter

Join the most dedicated community for IT managers, leaders and professionals in Australia