Monday, May 18, 2009

forth programming

Forth http://pages.cs.wisc.edu/~bolo/forth/

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

Overview
Forth Resources
Forth Programming
Forth Numerics
Meta Compilation
Forth Software
Organizations, Publishers & Research
Standards -- FIG, F79, F83, ANS
Individual's Forth Web Pages
Commentaries on Forth
Projects and Commercial Software using Forth
Random Stuff
Forth Systems
Vendors
Algorithms & Techniques
Hardware
Bibliography
Overview

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
and not allow the use for Forth -- even it was THE tool for the job. However Forth has become resurgent.

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.
Forth Resources
Rdrx's Forth Links
Anton Ertl's Forth Archive
Athena Programming Inc.
Build your own Forth
comp.lang.forth FAQ
Die Forth Schatzinsel (in German)
eForth Technology
eForth Academy
EG3 Forth Internet Resources
ForthFreak Wiki
Forth research at the Institut for ComputerSprachen
Forth resource list in the UK
Michael Somos: Forth WWW and FTP Links
Forth Toolshed links at BMBCON -- Audio emphasis.
Forth Programming Language Links @ CBEL
Forth WebRing
Free BSD Forth Resources and Archive
Geometry.Net's Forth Programming
Google Directory of Forth Information
Netscape Directory of Forth Information
NodeWorks Directory of Forth Information
Pocket Forth Repository
Ron's Pocket Forth Archive
Russian Forth Interest Group
SIMTEL Forch Archive
Taygeta Scientific
Taygeta Forth Archive
Treasure Isle of Forth Link-Lists
TUNES and Retro-Forth
The Web Book
William's Forth Archive
Forth Programming

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.
The FORTH Programming Webring
FORTH Programming Webring (at yahoo directly)
Julian V. Noble's page
Marcel Hendrix: FORTH Programming
Mike's site - Exploring the lighter side of Forth
Neil Bawd's Ugly Home Page
The Forth Programming site of Leo Wong
P21 Forth Multitasker
Repository at Institut fur Computersprachen
Sleepless Night Wiki
SourceForge comp.lang.forth repository
Using fflib.fs with gforth for C function access
Win32Forth programs by Jos v.d. Ven
Using Win32Forth for Graphics and parallel arithmetic
Win32 Forth Object Oriented Programming
Win32 Programming examples using Win32 Forth
FORTH Blocks -- Macintosh
New Micros FORTH References (good glossary for their forth)
Tixy's Source Code (w/ ARM asm/disasm)
Forth Numerics
FORTH Sane -- Macintosh Numeric Interface(Standard Apple Numeric Environment)
GFORTH Notes on Numeric conversion & Floating Point
TDS2020 Forth wordset docs
Matrix Multiply Benchmark & FP Ops/second
HexFloat.fs .. FP output conversion?
Meta Compilation

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.
Meta Compilation Issues
Building a Remote Target Compiler
WFROTH: a Forth for writing Forth Cross-Compilers
Forth Software
A BNF parser in Forth
ArcFour Encryption in Forth
C-like structures
Floating Point for F83
Forth2HTML
Forth2XML
ForTRAN -- Forth Formula Translator
FoSM -- Forth String Matcher
FSL -- The Forth Scientific Library Project
Gray Parser Generator
HYPE -- a simple OOF implementation in ANS Forth
Berndt's Mini-OOF in 12 lines
A Morse Trainer in Forth
objects.html -- OOF Implementation
Palm and Cell Phone Apps in Quartus Forth
RAFTS Optimizing Code Generator
structs.html -- Yet another Forth structures package
TSCP -- Tom's Simple Chess Program in Forth by Ian Osgood
ffcall -- foreign function call C library (gforth uses)
Organizations, Publishers & Research
Dutch Forth Users Group
Forth Interest Group
Forth Interest Group -- UK
FIG UK (another)
FIG -- UK (??? old)
German FIG
JFAR ... the Journal of Forth Applications Research
Russian Forth Interest Group
FIG of Taiwan (in chinese)
Standards -- FIG, F79, F83, ANS
DPANS --Local Copy of Draft Proposal 6v3 of the Forth Standard
DPANS -- Sourceforge
DPANS -- Taygeta
ANS Forth FAQ
ANS Forth Proposals (Anton & Co.)
SF: Forth-83 Standard
Open Firmware Home page
SF: IS aka TO
SF: TO and DEFER
ENVIRON Extension
Floating Point to add to John Hayes ANS Test Suite
ANS Forth POSTPONE test
Individual's Forth Web Pages
Albert van der Horst's Forth Information
Paul E. Bennet
Bernd Paysan's Homepage
Inventio Software -- Developing Solutions using Forth
Jack Woehr's Forth Info
Len's Forth Page
Leo Wong's Forth Source
M. L. Gassanenko Forth info
Peter Knagg's Forth Stuff (includes Forth ... an Underview)
Reuben Thomas -- Machine Forth Info
Brad J. Rodriguez / T-Recursive Technology
Tom Almy and ForthCMP
Tigre (Phil Koopman)
Wil Baden
Commentaries on Forth
C-Style Structures in ANS Forth
Projects and Commercial Software using Forth

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!

ATHENA Programming
The Canon Cat -- The Mac's Ancestor
Canon's Cat Computer. The Real Macintosh
Canon's Cat Computer. The Real Macintosh (OLD)
Canon Cat -- with interactive Canon Cat Help menus!
CCS -- Construction Computer Software -- a large Forth App.
CVS -- Color Vision Systems
Epson QX-10 Documentation
Forth Inc's List of Forth Applications
Forth still suits embedded applications -- Electronic Design
Forth Success Stories
FuzzBall Muck
HP48 series
Open Firmware Home page
Solid-state Imaging Spectrometer
Space-Related Applications of Forth
Space-Related FORTH Applications (OLD)
Three Forths Make a Hole -- Bomb Disposal with Forth
TinyBOOT ...Tiny Open Firmware
eCAF Motion and Process Control
eCAF Motion and Process Control (OLD)
Random Stuff

Not so Random, but rather this page is a mess and I don't know where to put this yet!
4tH... compiles or interprets .. but no switching
A Forth-like compiler
BacFORTH: Back Tracking FORTH paper
OS performance comparison: Linux versus NT
OS performance comparison: Win95 versus DOS
Lisp as an Alternative to Java
Lisp as an Alternative to Java (followup)
Lisp as an Alternative to Java (followup) (PDF)
Furphy -- A project to testbed concatenative functional language constructs with FORTH
Forth Guide (at The Forth Source)
On Standardizing Object Oriented Forth Implementations
A Survey of Object Oriented Forths
REBOL Internet OS (IOS) Advantages
Paul Graham Articles on non-Mainstream Langauage (LISP)
Rick Hohensee's Color Organ
MonsterBench -- John Bentely's C benchmark in FORTH
Anton Ertl's forth performance collection
colorForth page
c4 color forth
GUI Forth
Circuit Cellar INK
Twee Tiny Text Editor -- 3 Forth Versions!
Forth Systems

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.
Abundance/BBL
ATLAST
B-Forth (USR Pilot)
B-FORTH for BTRON (japan)
B-FORTH for BTRON (alternate)
BacFORTH info
BigFORTH
Camel-FORTH for Z-80/TRS-DOS
Coldfire FORTH
ColdFORTH Version 0.8 (w/ TCP/IP)
ColdFORTH Kernel Paper -- Design and Goals
Color Forth
CoSY .. FORTH + APL
Creole .. Forth with a Database Dictionary
Creole Forth
D Forth for Mac OS X
DOS-FROTH
Dreams, a message passing FORTH Operating System
F-PC
The Last Fig-Forth Ever
FROTH
fvm430 -- Forth for the MSP430
gforth
HARTFORTH (manual)
HARTFORTH (.txt manual)
Hel FORTH
Holon
More Holon
J-Forth
Jax Forth
JKForth: a Forth system for 16-bit Intel machines
kForth Page
Laboratory Microsystems -- LMI Forth
Marcel Hendrix: iForth
Marcel Hendrix: iForth (OLD)
Meme
MinForth: a robust and small Forth system in C
Misty Beach Forth (in Java)
Mops
MVP FORTH / Glen Haydon
pbFORTH (for Lego Mindstorms)
pForth
PL Forth + moforth + apps
The Pocket Forth Page
Pygmy Forth (Frank Sergeant)
Pygmy Forth (Frank Sergeant) OLD
Quartus ... Forth for the Palm Pilot
Quartus ... Forth for the Palm Pilot (OLD)
Retro-Forth
Reva
Robo-Forth
SOL-86 -- Forth-like language and OS for 8086 (also PDP-11)
strongForth (an attempt at type checking in forth)
Timbre
TinyBOOT ...Tiny Open Firmware
Marcel Hendrix Transputer Forth
Marcel Hendrix Transputer Forth for Linux and Windows NT
WFROTH: a Forth for writing Forth Cross-Compilers
Win32 Forth
Win32 Forth @ SourceForge
Win32 Mailing List @ Yahoo Groups
Yerk
Vendors
AM Research (SBCs, other hardware)
Bradley Forthware (Mitch Bradley)
DeloSoft -- dsFORTH
FirmWorks ... Open Firmware
FORTH, Inc
MMS Forth -- Miller Microsystems Forth
MPE Limited
MVP .. Mountain View Press
Offete Enterprises
TpForth Project
Ultra Technology (Jeff Fox)
Algorithms & Techniques

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.
Low-Cost Math Techniques
Using FFT for fast arbitrary precision arithmetic
Real Time Forth (a book!) by Tim Hendtlass
Hardware

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.

AM Research (SBCs, other hardware)
Bernd's b16 Stack/Forth CPU
E16 CPU ... a Forth Simulated Forth Processor
Forth Chips
Great Microprocessors of the Past and Present
Implementing a Forth Engine on a FPGA
Build your own Jupiter Ace
Jupiter Ace
Jupiter Ace Emulator
Micromint
68hc11 FAQ
HC11 Resource Page
MPE Limited
New Micros
Patriot Scientific (ShBoom / Ignite)
P21 Forth Users Manual
RTX 2000 Manual (PDF)
RTX 2010 Manual (PDF)
Silicon Composers
Triangle Digital Services
Vesta Technology
Ultra Technology (Jeff Fox)
FORTH Bibliography

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
Real Time Data Access & Control
Manuals
HARTFORTH TRS80 (manual)
HARTFORTH TRS80 (.txt manual)
Bolo's Home Page
Last Modified: Sun May 10 14:23:02 CDT 2009
Bolo (Josef Burger)

No comments: