Forth (programming language)
Forth is a stack-oriented programming language and interactive integrated development environment designed by Charles H. "Chuck" Moore and first used by other programmers in 1970. Although not an acronym, the language's name in its early years was often spelled in all capital letters as FORTH. The FORTH-79 and FORTH-83 implementations, which were not written by Moore, became de facto standards, and an official technical standard of the language was published in 1994 as ANS Forth. A wide range of Forth derivatives existed before and after ANS Forth. The free and open-source software Gforth implementation is actively maintained, as are several commercially supported systems.
"FORTH" redirects here. For other uses, see Forth (disambiguation).Paradigm
1970
Typeless
.fs, .fth, .4th, .f, .forth
Forth typically combines a compiler with an integrated command shell,[a] where the user interacts via subroutines called words. Words can be defined, tested, redefined, and debugged without recompiling or restarting the whole program. All syntactic elements, including variables, operators, and control flow, are defined as words. A stack is used to pass parameters between words, leading to a Reverse Polish Notation style.
For much of Forth's existence, the standard technique was to compile to threaded code, which can be interpreted faster than bytecode. One of the early benefits of Forth was size: an entire development environment—including compiler, editor, and user programs—could fit in memory on an 8-bit or similarly limited system. No longer constrained by space, there are modern implementations that generate optimized machine code like other language compilers. The relative simplicity of creating a basic Forth system has led to many personal and proprietary variants, such as the custom Forth used to implement the bestselling 1986 video game Starflight from Electronic Arts.[1]
Forth is used in the Open Firmware boot loader, in spaceflight applications[2] such as the Philae spacecraft,[3][4] and in other embedded systems which involve interaction with hardware.
Moore developed a series of microprocessors for executing compiled Forth-like code directly and experimented with smaller languages based on Forth concepts, including cmForth and colorForth. Most of these languages were designed to support Moore's own projects, such as chip design.
Uses[edit]
Forth has a niche in astronomical and space applications[5] as well as a history in embedded systems. The Open Firmware boot ROMs used by Apple, IBM, Sun, and OLPC XO-1 contain a Forth environment.
Forth has often been used to bring up new hardware. Forth was the first resident software on the new Intel 8086 chip in 1978, and MacFORTH was the first resident development system for the Macintosh 128K in 1984.[6]
Atari, Inc. used an elaborate animated demo written in Forth to showcase capabilities of the Atari 8-bit computers in department stores.[7] Electronic Arts published multiple video games in the 1980s that were written in Forth, including Worms? (1983),[8] Adventure Construction Set (1984),[9] Amnesia (1986),[10] Starflight (1986),[1] and Lords of Conquest (1986). Robot coding game ChipWits (1984) was written in MacFORTH.[11]
Ashton-Tate's RapidFile (1986), a flat-file database program, and VP-Planner[12] from Paperback Software International (1983), a spreadsheet program competing with Lotus 1-2-3, were written in Forth.
The Canon Cat (1987) uses Forth for its system programming.
Rockwell produced single-chip microcomputers with resident Forth kernels: the R65F11 and R65F12. ASYST was a Forth expansion for measuring and controlling on PCs.[13]
History[edit]
Forth evolved from Charles H. Moore's personal programming system, which had been in continuous development since 1968.[6] Forth was first exposed to other programmers in the early 1970s, starting with Elizabeth Rather at the United States National Radio Astronomy Observatory (NRAO).[6] After their work at NRAO, Charles Moore and Elizabeth Rather formed FORTH, Inc. in 1973, refining and porting Forth systems to dozens of other platforms in the next decade.
Forth is so-named, because in 1968 "the file holding the interpreter was labeled FOURTH, for 4th (next) generation software, but the IBM 1130 operating system restricted file names to five characters."[14] Moore saw Forth as a successor to compile-link-go third-generation programming languages, or software for "fourth generation" hardware.
FORTH, Inc.'s microFORTH was developed for the Intel 8080, Motorola 6800, Zilog Z80, and RCA 1802 microprocessors, starting in 1976. MicroFORTH was later used by hobbyists to generate Forth systems for other architectures, such as the 6502 in 1978. The Forth Interest Group was formed in 1978.[15] It promoted and distributed its own version of the language, FIG-Forth, for most makes of home computer.
Forth was popular in the early 1980s,[16] because it was well suited to the limited memory of microcomputers. The ease of implementing the language led to many implementations.[17] The Jupiter ACE home computer has Forth in its ROM-resident operating system. Insoft GraFORTH is a version of Forth with graphics extensions for the Apple II.[18]
Common practice was codified in the de facto standards FORTH-79[19] and FORTH-83[20] in the years 1979 and 1983, respectively. These standards were unified by ANSI in 1994, commonly referred to as ANS Forth.[21][22]
As of 2018, the source for the original 1130 version of FORTH has been recovered, and is now being updated to run on a restored or emulated 1130 system.[23]
Because Forth is simple to implement and has no standard reference implementation, there are numerous versions of the language. In addition to supporting the standard varieties of desktop computer systems (POSIX, Microsoft Windows, macOS), many of these Forth systems also target a variety of embedded systems. Listed here are some of the systems which conform to the 1994 ANS Forth standard.