Last updated 21 November 2009
The Forth Language
What is Forth?
Forth is a Modular Language
Forth's modularity enables programs to be written and tested in terms of many small procedures and modules with the minimum loss in efficiency. Forth actively encourages code re-use, which in turn leads to low application size.
Forth is an Interactive Language
Forth's text interpreter executes a procedure as its name is entered. The text interpreter allows parameters to be passed to any procedure so that each and every procedure can be extensively tested, both in isolation and as part of a larger module. Systems tested in such a 'bottom up' process are found to be more reliable (data from a NASA presentation), which leads to Forth being preferred for high reliability applications by some NASA teams.
Forth is Compiled
Forth systems compile extremely quickly. Fast compilation speed and ease of testing provide a rapid, interactive, and productive compile-debug-fix cycle. Incremental compilation means that only new code needs to be compiled, leading to even shorter compilation times. This rapid compilation includes full code optimisation, with our VFX compiler techology producing code as fast as that from C compilers - and there are benchmarks.
Forth is a Multitasking Language
Multitasking is provided as standard with most Forth systems, even those for embedded use.
Forth is a Hardware Testing Tool
The production of an embedded system involves more than just the development of the software; hardware also has to be developed and tested. Forth is ideal for debugging hardware because of the easy way many small test procedures can be written. These procedures are used to inspect hardware and rapidly 'home-in' on a problem.
Forth is Easy to Use
Forth involves simple concepts applied uniformly. It does not require a user to be a computer scientist. Hence Forth is often used by electronic engineers, physicists and mechanical engineers, as well as by software engineers.
What is Forth used for?
Forth systems are used for applications ranging from Windows applications which plan the construction of major civil engineering projects to door controllers in access control systems. A few current Forth applications follow.
Forth makes good tea and coffee!
It is now possible for vending machines to brew tea and coffee with fresh milk, and to produce a cup of tea acceptable to professional tea tasters. The first trick is to prevent milk seeping into pipes and then going off overnight after the machine has been switched off. The next trick is prevent sedimentation in the boiler/heater mechanisms - it ruins the taste of tea! The final trick is to control the flow of water/steam through the coffee grounds or tea leaves, as these need a "wetting period" during which they swell before releasing flavour to the liquid.
Forth disarms bombs!
According to figures from Bosnia and Kosovo, between 10% and 20% of modern air-dropped munitions (bombs) fail to explode. Disarming these is a high priority. A Forth vendor was involved in a new technology portable machine for making munitions safe. The system electronics consist of two embedded ARM systems and a control PC running Windows. The three units are linked by a custom network implementation. The whole system was developed in four months by the clients and a consultancy team.
Forth plans airports!
Construction Computer Software (CCS) in Cape Town produce the MARS and CANDY applications which are a standard all over the world. The CCS software is an example of a large-scale Windows application written in ProForth for Windows, and the VFX Forth version already consists of over 850,000 lines of code.
CCS software was used to plan the Chai Tak airport in Hong Kong. The CCS web site is at http://www.ccssa.com
Forth runs commercial laundries!
Micross Electronics (tel: +44 (0)1989 768080) http://www.microssautomation.com/index.php use a Forth for Windows at the heart of their commercial laundry control systems, and Forth cross compilers for custom PLCs performing real time control. These systems are installed in many countries, and you may have slept in sheets washed by the Micross Tracknet control systems.
Forth runs games!
A mobile phone manufacturer introduced a new games engine derived from the SENDIT project. This uses a Forth-based virtual machine to reduce the size of games in the phone, and to permit more functionality to be provided in the phone without increasing memory size. The previous 400 kb of ROM used for games was reduced to less than 40 kb.
The ISO/ANS Forth standard is used by all MPE products developed since 1995. ISO/ANS Forth (sometimes informally known as Forth 94) has had a productive impact on Forth since its release in 1994. Both programmer and application portability have been good, and the Forth community has produced much good software that we have been able to port with few problems.
In order to avoid the costs and delays of the ANS standards process, the next Forth standard is being devloped under the Forth200x process, and formal standardisation will be achieved by fast-tracking the Forth200x standard through a standards body. See www.forth200x.org for more details.
Current details are available from Peter Knaggs' web site.