Last updated: 21 January 2020
The Forth Language
MPE Provides Forth systems with modern tools for high quality software production. MPE’s Forth systems provide industrial strength environments for real time software and hardware development. Ian Thain has this to say about Forth.
Forth’s USP is speed of development coupled with industrial strength. My code has always had a reputation for two things: A good HMI and rock-like stability, and I have no hesitation in saying that my use of Forth has been the most significant contributory factor to both those qualities. Its extensibility means that I know I can make the code do whatever the customer needs, and if Forth is written and documented cleanly in the classical manner it’s inherently strong anyway. Leaving aside the bugs which we can all write at the end of a long and tiring day, you actually have to write very bad Forth before it falls over.
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
MPE 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 VFX Forth for Windows, Linux and DOS, MPE’s Forth development systems for embedded targets. The multitaskers include message passing, synchronisation, semaphores and event handling for reaction to external events, as well as full timer management services.
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?
MPE’s 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. All controlled by an MPE system.
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. MPE was involved in a new technology portable machine for making munitions safe. The system electronics consist of two MPE ARM Development Kits using the Forth Cross Compiler and a control PC running VFX Forth for Windows. The three units are linked by a custom network implementation. The whole system was developed in four months by the clients and an MPE consultancy team.
MPE 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 VFX Forth for Windows. The current (1Q2017) version consists of over 1,200,000 lines of Forth source code.
CCS software was used to plan the Chai Tak airport in Hong Kong. The CCS web site is at http://www.ccssa.com
MPE Forth runs commercial laundries
Micross Electronics (tel: +44 (0)1989 768080) http://www.microssautomation.com/index.php use an MPE Forth for Windows at the heart of their commercial laundry control systems, and MPE’s 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 virtual machine runs payment terminals
Europay International’s Open Terminal Architecture (OTA) uses a virtual machine (VM) architecture to deliver payment terminal applications directly to payment terminals regardless of their hardware or CPU. The OTA VM has been installed on a range of CPUs and is now being deployed. The OTA project involved up to 30 programmers working in several locations on two continents. OTA is described at http://www.europay.com
The OTA VM is a derivative of the VM designed by MPE for the SENDIT Esprit project. The VM uses a two-stack architecture derived from Forth, and extended to be language neutral so that code can be compiled from languages other than Forth. We have Forth and C compilers for these VMs, and are available to produce tailored derivatives for your applications.
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 Forth standard is being developed 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. See
Snapshots of the rolling draft are formally released from time to time and the Forth 2012 standard has been released.