Rick Grehan
First, let me confess that I have a soft spot in my heart for Forth. It's a language that has largely been misunderstood. I've seen it best described as an amplifier: Good programmers can do wonders with Forth, bad programmers produce hideous results.
Now from Creative Solutions (Rockville, MD, (301) 984-0262; fax (301) 770-1675) comes
Power MacForth
, descendant of the first Forth development system for the Mac. Power MacForth's ancestor was a 680x0-based, high-quality Forth programming system with lots of accompanying source code tools and libraries. As its name implies, Power MacForth runs on the PowerPC line of Macs.
As development packages go, Power MacForth is surprisingly complete. It implements the core and extended core words of the relatively new ANSI Forth specification. The sys
tem provides its own form of cooperative multitasking. If you don't mind the postfix notation (and you can't, if you're going to work with Forth), it has a PowerPC 601-compatible assembler and disassembler. There's even a built-in source-level debugger; though, granted, it's really a BASIC-style ``trace'' capability.
Power MacForth is ``direct-threaded,'' as opposed to the earlier 680x0 version, which was ``token-threaded.'' With token-threaded code, execution of a single routine requires that the Forth inner-interpreter fetch a 16-bit token, resolve that token to the address of the code, and then transfer execution to that code. Token threading is memory thrifty, which makes it workable even on 512-KB Macs, but relatively slow. Meanwhile, direct-threaded code discards an inner interpreter. Tokens are replaced by CALL (or, in the case of the PowerPC, branch and link) instructions that call the routine directly. This change represents more a maturing of the Mac than a maturing of MacForth.
A bene
ficial byproduct of Power MacForth's direct-threaded structure is that it allows the compiler to use ``in-lining'' optimizations. A short Forth word of two or three instructions is copied wholesale into your code rather than being compiled as a branch.
The piles of source code tools and examples provide complete access to the Mac toolbox. In fact, there are two interfaces to the toolbox. The one that I found most interesting was a collection of files known as ``MacIncludes,'' which are Forth-like counterparts to the universal C header files for the Mac.
The package is inexpensive: You get a complete PowerMac development system for $199. Of course, what a Forth programmer considers complete might seem skeletal to a C++ programmer. Still, you get the compiler, hordes of source code examples, an assembler and disassembler, and a debugger. Owners of 680x0 versions of MacForth can upgrade for $129. And the whole thing fits on one floppy disk.
screen_link (31 Kbytes)
With Power MacForth and four words, you can create a basic drawing package.