# Wikipedia Page **Source:** https://en.wikipedia.org/wiki/Forth_(programming_language) Forth (programming language) - Wikipedia [Jump to content](#bodyContent) Main menu Main menu move to sidebar hide Navigation * [Main page](/wiki/Main_Page "Visit the main page [z]") * [Contents](/wiki/Wikipedia:Contents "Guides to browsing Wikipedia") * [Current events](/wiki/Portal:Current_events "Articles related to current events") * [Random article](/wiki/Special:Random "Visit a randomly selected article [x]") * [About Wikipedia](/wiki/Wikipedia:About "Learn about Wikipedia and how it works") * [Contact us](//en.wikipedia.org/wiki/Wikipedia:Contact_us "How to contact Wikipedia") Contribute * [Help](/wiki/Help:Contents "Guidance on how to use and edit Wikipedia") * [Learn to edit](/wiki/Help:Introduction "Learn how to edit Wikipedia") * [Community portal](/wiki/Wikipedia:Community_portal "The hub for editors") * [Recent changes](/wiki/Special:RecentChanges "A list of recent changes to Wikipedia [r]") * [Upload file](/wiki/Wikipedia:File_upload_wizard "Add images or other media for use on Wikipedia") * [Special pages](/wiki/Special:SpecialPages "A list of all special pages [q]") [![](/static/images/icons/enwiki-25.svg) ![Wikipedia](/static/images/mobile/copyright/wikipedia-wordmark-en-25.svg) ![The Free Encyclopedia](/static/images/mobile/copyright/wikipedia-tagline-en-25.svg)](/wiki/Main_Page) [Search](/wiki/Special:Search "Search Wikipedia [f]") Search Appearance * [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en) * [Create account](/w/index.php?title=Special:CreateAccount&returnto=Forth+%28programming+language%29 "You are encouraged to create an account and log in; however, it is not mandatory") * [Log in](/w/index.php?title=Special:UserLogin&returnto=Forth+%28programming+language%29 "You're encouraged to log in; however, it's not mandatory. [o]") Personal tools * [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en) * [Create account](/w/index.php?title=Special:CreateAccount&returnto=Forth+%28programming+language%29 "You are encouraged to create an account and log in; however, it is not mandatory") * [Log in](/w/index.php?title=Special:UserLogin&returnto=Forth+%28programming+language%29 "You're encouraged to log in; however, it's not mandatory. [o]") ## Contents move to sidebar hide * [(Top)](#) * [1 Uses](#Uses) * [2 History](#History) * [3 Overview](#Overview) * [4 Facilities](#Facilities) Toggle Facilities subsection + [4.1 Operating system, files, and multitasking](#Operating_system,_files,_and_multitasking) + [4.2 Self-compilation and cross compilation](#Self-compilation_and_cross_compilation) * [5 Structure of the language](#Structure_of_the_language) Toggle Structure of the language subsection + [5.1 Structure of the compiler](#Structure_of_the_compiler) - [5.1.1 Compilation state and interpretation state](#Compilation_state_and_interpretation_state) - [5.1.2 Immediate words](#Immediate_words) - [5.1.3 Unnamed words and execution tokens](#Unnamed_words_and_execution_tokens) - [5.1.4 Parsing words and comments](#Parsing_words_and_comments) + [5.2 Structure of code](#Structure_of_code) + [5.3 Data objects](#Data_objects) * [6 Examples](#Examples) Toggle Examples subsection + [6.1 “Hello, World!”](#“Hello,_World!”) + [6.2 Mixing states of compiling and interpreting](#Mixing_states_of_compiling_and_interpreting) + [6.3 RC4 cipher program](#RC4_cipher_program) * [7 Forth engines](#Forth_engines) * [8 Implementations](#Implementations) * [9 See also](#See_also) * [10 Notes](#Notes) * [11 References](#References) * [12 External links](#External_links) Toggle the table of contents # Forth (programming language) 34 languages * [中文](https://zh.wikipedia.org/wiki/Forth "Forth – Chinese") * [Кыргызча](https://ky.wikipedia.org/wiki/%D0%A4%D0%BE%D1%80%D1%82_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B0%D0%BB%D0%BE%D0%BE_%D1%82%D0%B8%D0%BB%D0%B8) "Форт (программалоо тили) – Kyrgyz") * [한국어](https://ko.wikipedia.org/wiki/%ED%8F%AC%EC%8A%A4_(%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D_%EC%96%B8%EC%96%B4) "포스 (프로그래밍 언어) – Korean") * [Français](https://fr.wikipedia.org/wiki/Forth_(langage) "Forth (langage) – French") * [Español](https://es.wikipedia.org/wiki/Forth "Forth – Spanish") * [Magyar](https://hu.wikipedia.org/wiki/Forth_(programoz%C3%A1si_nyelv) "Forth (programozási nyelv) – Hungarian") * [Italiano](https://it.wikipedia.org/wiki/Forth_(linguaggio) "Forth (linguaggio) – Italian") * [Galego](https://gl.wikipedia.org/wiki/Forth "Forth – Galician") * [Deutsch](https://de.wikipedia.org/wiki/Forth_(Programmiersprache) "Forth (Programmiersprache) – German") * [日本語](https://ja.wikipedia.org/wiki/Forth "Forth – Japanese") * [Ελληνικά](https://el.wikipedia.org/wiki/Forth "Forth – Greek") * [Simple English](https://simple.wikipedia.org/wiki/Forth "Forth – Simple English") * [العربية](https://ar.wikipedia.org/wiki/%D9%81%D9%88%D8%B1%D8%AB_(%D9%84%D8%BA%D8%A9_%D8%A8%D8%B1%D9%85%D8%AC%D8%A9) "فورث (لغة برمجة) – Arabic") * [Nederlands](https://nl.wikipedia.org/wiki/Forth_(programmeertaal) "Forth (programmeertaal) – Dutch") * [Svenska](https://sv.wikipedia.org/wiki/Forth_(programspr%C3%A5k) "Forth (programspråk) – Swedish") * [Português](https://pt.wikipedia.org/wiki/Forth "Forth – Portuguese") * [Esperanto](https://eo.wikipedia.org/wiki/Forth_(programlingvo) "Forth (programlingvo) – Esperanto") * [Тоҷикӣ](https://tg.wikipedia.org/wiki/Forth "Forth – Tajik") * [Русский](https://ru.wikipedia.org/wiki/%D0%A4%D0%BE%D1%80%D1%82_(%D1%8F%D0%B7%D1%8B%D0%BA_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F) "Форт (язык программирования) – Russian") * [Norsk bokmål](https://no.wikipedia.org/wiki/Forth_(programmeringsspr%C3%A5k) "Forth (programmeringsspråk) – Norwegian Bokmål") * [Català](https://ca.wikipedia.org/wiki/Forth "Forth – Catalan") * [Suomi](https://fi.wikipedia.org/wiki/Forth_(ohjelmointikieli) "Forth (ohjelmointikieli) – Finnish") * [Українська](https://uk.wikipedia.org/wiki/Forth "Forth – Ukrainian") * [Čeština](https://cs.wikipedia.org/wiki/Forth_(programovac%C3%AD_jazyk) "Forth (programovací jazyk) – Czech") * [Български](https://bg.wikipedia.org/wiki/Forth "Forth – Bulgarian") * [Interlingua](https://ia.wikipedia.org/wiki/Forth_(linguage_de_programmation) "Forth (linguage de programmation) – Interlingua") * [Беларуская](https://be.wikipedia.org/wiki/%D0%A4%D0%BE%D1%80%D1%82_(%D0%BC%D0%BE%D0%B2%D0%B0_%D0%BF%D1%80%D0%B0%D0%B3%D1%80%D0%B0%D0%BC%D0%B0%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F) "Форт (мова праграмавання) – Belarusian") * [Latviešu](https://lv.wikipedia.org/wiki/Forth_(programm%C4%93%C5%A1anas_valoda) "Forth (programmēšanas valoda) – Latvian") * [Српски / srpski](https://sr.wikipedia.org/wiki/Forth_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D1%81%D0%BA%D0%B8_%D1%98%D0%B5%D0%B7%D0%B8%D0%BA) "Forth (програмски језик) – Serbian") * [فارسی](https://fa.wikipedia.org/wiki/%D8%B2%D8%A8%D8%A7%D9%86_%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87%E2%80%8C%D9%86%D9%88%DB%8C%D8%B3%DB%8C_%D9%81%D9%88%D8%B1%D8%AB "زبان برنامه‌نویسی فورث – Persian") * [Polski](https://pl.wikipedia.org/wiki/Forth_(j%C4%99zyk_programowania) "Forth (język programowania) – Polish") * [粵語](https://zh-yue.wikipedia.org/wiki/Forth "Forth – Cantonese") * [Slovenščina](https://sl.wikipedia.org/wiki/Forth_(programski_jezik) "Forth (programski jezik) – Slovenian") * [ꠍꠤꠟꠐꠤ](https://syl.wikipedia.org/wiki/%EA%A0%9A%EA%A0%9E%EA%A0%86%EA%A0%95 "ꠚꠞ꠆ꠕ – Sylheti") [Edit links](https://www.wikidata.org/wiki/Special:EntityPage/Q275472#sitelinks-wikipedia "Edit interlanguage links") * [Article](/wiki/Forth_(programming_language) "View the content page [c]") * [Talk](/wiki/Talk:Forth_(programming_language) "Discuss improvements to the content page [t]") English * [Read](/wiki/Forth_(programming_language)) * [Edit](/w/index.php?title=Forth_(programming_language)&action=edit "Edit this page [e]") * [View history](/w/index.php?title=Forth_(programming_language)&action=history "Past revisions of this page [h]") Tools Tools move to sidebar hide Actions * [Read](/wiki/Forth_(programming_language)) * [Edit](/w/index.php?title=Forth_(programming_language)&action=edit "Edit this page [e]") * [View history](/w/index.php?title=Forth_(programming_language)&action=history) General * [What links here](/wiki/Special:WhatLinksHere/Forth_(programming_language) "List of all English Wikipedia pages containing links to this page [j]") * [Related changes](/wiki/Special:RecentChangesLinked/Forth_(programming_language) "Recent changes in pages linked from this page [k]") * [Upload file](//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard "Upload files [u]") * [Permanent link](/w/index.php?title=Forth_(programming_language)&oldid=1330667744 "Permanent link to this revision of this page") * [Page information](/w/index.php?title=Forth_(programming_language)&action=info "More information about this page") * [Cite this page](/w/index.php?title=Special:CiteThisPage&page=Forth_%28programming_language%29&id=1330667744&wpFormIdentifier=titleform "Information on how to cite this page") * [Get shortened URL](/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FForth_%28programming_language%29) * [Download QR code](/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FForth_%28programming_language%29) Print/export * [Download as PDF](/w/index.php?title=Special:DownloadAsPdf&page=Forth_%28programming_language%29&action=show-download-screen "Download this page as a PDF file") * [Printable version](/w/index.php?title=Forth_(programming_language)&printable=yes "Printable version of this page [p]") In other projects * [Wikimedia Commons](https://commons.wikimedia.org/wiki/Category:Forth_(programming_language)) * [Wikibooks](https://en.wikibooks.org/wiki/Forth) * [Wikidata item](https://www.wikidata.org/wiki/Special:EntityPage/Q275472 "Structured data on this page hosted by Wikidata [g]") Appearance move to sidebar hide From Wikipedia, the free encyclopedia Stack-based programming language "FORTH" redirects here. For other uses, see [Forth (disambiguation)](/wiki/Forth_(disambiguation) "Forth (disambiguation)"). | Forth | | | --- | --- | | [Paradigm](/wiki/Programming_paradigm "Programming paradigm") | [concatenative](/wiki/Concatenative_programming_language "Concatenative programming language") ([stack-based](/wiki/Stack-oriented_programming "Stack-oriented programming")), [procedural](/wiki/Procedural_programming "Procedural programming"), [reflective](/wiki/Reflective_programming "Reflective programming") | | [Designed by](/wiki/Software_design "Software design") | [Charles H. Moore](/wiki/Charles_H._Moore "Charles H. Moore") | | First appeared | 1970; 56 years ago (1970) | | [Typing discipline](/wiki/Type_system "Type system") | Typeless | | [Filename extensions](/wiki/Filename_extension "Filename extension") | .fs, .fth, .4th, .f, .forth[*[citation needed](/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*] | | Website | [forth-standard.org](https://forth-standard.org) | | Major [implementations](/wiki/Programming_language_implementation "Programming language implementation") | | | SwiftForth (Forth, Inc.) [Gforth](/wiki/Gforth "Gforth") (GNU Project) VFX Forth (MicroProcessor Engineering) | | | Influenced | | | [Bitcoin Script](/wiki/Bitcoin#Transactions "Bitcoin"), [Factor](/wiki/Factor_(programming_language) "Factor (programming language)"), [Joy](/wiki/Joy_(programming_language) "Joy (programming language)"), [RPL](/wiki/RPL_(programming_language) "RPL (programming language)"), [Rebol](/wiki/Rebol "Rebol"), [STOIC](/wiki/STOIC "STOIC"), [8th](/w/index.php?title=8th_(programming_language)&action=edit&redlink=1 "8th (programming language) (page does not exist)") | | **Forth** is a [stack-oriented](/wiki/Stack-oriented_programming "Stack-oriented programming") [programming language](/wiki/Programming_language "Programming language") and interactive [integrated development environment](/wiki/Integrated_development_environment "Integrated development environment") designed by [Charles H. "Chuck" Moore](/wiki/Charles_H._Moore "Charles H. Moore") and first used by other programmers in 1970. Although not an [acronym](/wiki/Acronym "Acronym"), the language's name in its early years was often spelled in [all capital letters](/wiki/All_caps "All caps") as *FORTH*. The FORTH-79 and FORTH-83 implementations, which were not written by Moore, became *[de facto](/wiki/De_facto "De facto")* standards, and an official [technical standard](/wiki/Technical_standard "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](/wiki/Free_and_open-source_software "Free and open-source software") [Gforth](/wiki/Gforth "Gforth") implementation is actively maintained, as are several [commercially](/wiki/Commercial_software "Commercial software") supported systems. Forth typically combines a compiler with an integrated command shell, where the user interacts via [subroutines](/wiki/Subroutine "Subroutine") called *words*.[[a]](#cite_note-3) 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](/wiki/Stack_(abstract_data_type) "Stack (abstract data type)") is used to pass parameters between words, leading to a [Reverse Polish notation](/wiki/Reverse_Polish_notation "Reverse Polish notation") style. For much of Forth's existence, the standard technique was to compile to [threaded code](/wiki/Threaded_code "Threaded code"), which can be interpreted faster than [bytecode](/wiki/Bytecode "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](/wiki/Optimizing_compiler "Optimizing compiler") [machine code](/wiki/Machine_code "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](/wiki/Starflight "Starflight")* from [Electronic Arts](/wiki/Electronic_Arts "Electronic Arts").[[3]](#cite_note-maher-4) Forth is used in the [Open Firmware](/wiki/Open_Firmware "Open Firmware") [boot loader](/wiki/Boot_loader "Boot loader"), in [spaceflight](/wiki/Spaceflight "Spaceflight") applications[[4]](#cite_note-oSWRm-5) such as the [*Philae* spacecraft](/wiki/Philae_(spacecraft) "Philae (spacecraft)"),[[5]](#cite_note-zYmBe-6)[[6]](#cite_note-sgEMh-7) and in other embedded systems which involve interaction with hardware. Beginning in the early 1980s, 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](/wiki/ColorForth "ColorForth"). Most of these languages were created to support Moore's own projects, such as chip design. ## Uses [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=1 "Edit section: Uses")] Forth has a niche in astronomical and space applications[[7]](#cite_note-C4Oss-8) as well as a history in [embedded systems](/wiki/Embedded_system "Embedded system"). The [Open Firmware](/wiki/Open_Firmware "Open Firmware") [boot ROMs](/wiki/Boot_ROM "Boot ROM") used by [Apple](/wiki/Apple_Inc. "Apple Inc."), [IBM](/wiki/IBM "IBM"), [Sun](/wiki/Sun_Microsystems "Sun Microsystems"), and [OLPC XO-1](/wiki/OLPC_XO "OLPC XO") contain a Forth environment. Forth has often been used to bring up new hardware. Forth was the first [resident software](/wiki/Resident_monitor "Resident monitor") on the new [Intel 8086](/wiki/Intel_8086 "Intel 8086") chip in 1978, and MacFORTH was the first resident development system for the [Macintosh 128K](/wiki/Macintosh_128K "Macintosh 128K") in 1984.[[8]](#cite_note-evolution-9) Circa 1982, [Atari, Inc.](/wiki/Atari,_Inc. "Atari, Inc.") used an elaborate animated demo written in Forth to showcase capabilities of the [Atari 8-bit computers](/wiki/Atari_8-bit_computers "Atari 8-bit computers") in department stores.[[9]](#cite_note-10) [Electronic Arts](/wiki/Electronic_Arts "Electronic Arts") published multiple video games in the 1980s that were written in Forth, including *[Worms?](/wiki/Worms%3F "Worms?")* (1983),[[10]](#cite_note-11) *[Adventure Construction Set](/wiki/Adventure_Construction_Set "Adventure Construction Set")* (1984),[[11]](#cite_note-12) *[Amnesia](/wiki/Amnesia_(1986_video_game) "Amnesia (1986 video game)")* (1986),[[12]](#cite_note-13) *[Starflight](/wiki/Starflight "Starflight")* (1986),[[3]](#cite_note-maher-4) and *[Lords of Conquest](/wiki/Lords_of_Conquest "Lords of Conquest")* (1986). Robot coding game *[ChipWits](/wiki/ChipWits "ChipWits")* (1984) was developed in MacFORTH for the [Macintosh 128K](/wiki/Macintosh_128K "Macintosh 128K"),[[13]](#cite_note-14) while the [Commodore 64](/wiki/Commodore_64 "Commodore 64") port was written with SuperForth 64.[[14]](#cite_note-15) [Ashton-Tate's RapidFile](/wiki/Ashton-Tate#RapidFile "Ashton-Tate") (1986), a flat-file database program, and VP-Planner[[15]](#cite_note-16) from [Paperback Software International](/wiki/Paperback_Software_International "Paperback Software International") (1983), a spreadsheet program competing with [Lotus 1-2-3](/wiki/Lotus_1-2-3 "Lotus 1-2-3"), were written in Forth. The [Canon Cat](/wiki/Canon_Cat "Canon Cat") (1987) uses Forth for its system programming. [Rockwell](/wiki/Rockwell_International "Rockwell International") produced single-chip microcomputers with resident Forth kernels: the R65F11 and R65F12. ASYST was a Forth expansion for measuring and controlling on PCs.[[16]](#cite_note-Rwirj-17) ## History [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=2 "Edit section: History")] Forth evolved from [Charles H. Moore](/wiki/Charles_H._Moore "Charles H. Moore")'s personal programming system, which had been in continuous development since 1968.[[8]](#cite_note-evolution-9)[[17]](#cite_note-WYK4Z-18) Forth was first exposed to other programmers in the early 1970s, starting with [Elizabeth Rather](/wiki/Elizabeth_Rather "Elizabeth Rather") at the United States [National Radio Astronomy Observatory](/wiki/National_Radio_Astronomy_Observatory "National Radio Astronomy Observatory") (NRAO).[[8]](#cite_note-evolution-9) 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. Moore saw Forth as a successor to compile-link-go [third-generation programming languages](/wiki/Third-generation_programming_language "Third-generation programming language"), or software for "fourth generation" hardware. He recalls how the name was coined:[[18]](#cite_note-19) > At [Mohasco](/wiki/Mohawk_Industries "Mohawk Industries") ["in the late 1960s"] I also worked directly on an [IBM 1130](/wiki/IBM_1130 "IBM 1130") interfaced with an [IBM 2250](/wiki/IBM_2250 "IBM 2250") graphics display. The 1130 was a very important computer: it had the first cartridge disk, as well as a card reader, a card punch (as backup for the disk), and a console typewriter. The 1130 let the programmer, for the first time, totally control the computer interactively. > FORTH first appeared as an entity on that 1130. It was called F-O-R-T-H, a five-letter abbreviation of FOURTH, standing for fourth-generation computer language. That was the day, you may remember, of third-generation computers and I was going to leapfrog. But because FORTH ran on the 1130 (which permitted only five-character identifiers), the name was shortened. FORTH, Inc.'s microFORTH was developed for the [Intel 8080](/wiki/Intel_8080 "Intel 8080"), [Motorola 6800](/wiki/Motorola_6800 "Motorola 6800"), [Zilog Z80](/wiki/Zilog_Z80 "Zilog Z80"), and [RCA 1802](/wiki/RCA_1802 "RCA 1802") microprocessors, starting in 1976. MicroFORTH was later used by hobbyists to generate Forth systems for other architectures, such as the [6502](/wiki/MOS_Technology_6502 "MOS Technology 6502") in 1978. The Forth Interest Group was formed in 1978.[[19]](#cite_note-20) 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,[[20]](#cite_note-1AvuY-21) because it was well suited to the limited memory of [microcomputers](/wiki/Microcomputer "Microcomputer"). The ease of implementing the language led to many implementations.[[21]](#cite_note-family-tree-22) The [Jupiter ACE](/wiki/Jupiter_Ace "Jupiter Ace") home computer has Forth in its [ROM](/wiki/Read-only_memory "Read-only memory")-resident operating system. Insoft GraFORTH is a version of Forth with graphics extensions for the Apple II.[[22]](#cite_note-gWyzb-23) Common practice was codified in the de facto standards FORTH-79[[23]](#cite_note-qyrcN-24) and FORTH-83[[24]](#cite_note-BQ2oi-25) in the years 1979 and 1983, respectively. These standards were unified by [ANSI](/wiki/American_National_Standards_Institute "American National Standards Institute") in 1994, commonly referred to as ANS Forth.[[25]](#cite_note-IGDIN-26)[[26]](#cite_note-KojQK-27) 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.[[27]](#cite_note-BtuRy-28) ## Overview [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=3 "Edit section: Overview")] Further information: [Reverse Polish notation](/wiki/Reverse_Polish_notation "Reverse Polish notation") Forth emphasizes the use of small, simple functions called *words*. Words for bigger tasks call upon many smaller words that each accomplish a distinct sub-task. A large Forth program is a hierarchy of words. These words, being distinct modules that communicate implicitly via a stack mechanism, can be prototyped, built and tested independently. The highest level of Forth code may resemble an English-language description of the application. Forth has been called a *meta-application language*: a language that can be used to create [problem-oriented languages](/wiki/Domain-specific_language "Domain-specific language").[[28]](#cite_note-29) Forth relies on implicit use of a [data stack](/wiki/Stack_(abstract_data_type) "Stack (abstract data type)") and [reverse Polish notation](/wiki/Reverse_Polish_notation "Reverse Polish notation") which is commonly used in calculators from [Hewlett-Packard](/wiki/Hewlett-Packard "Hewlett-Packard"). In RPN, the operator is placed after its operands, as opposed to the more common [infix notation](/wiki/Infix_notation "Infix notation") where the operator is placed between its operands. Postfix notation makes the language easier to parse and extend; Forth's flexibility makes a static [BNF](/wiki/Backus-Naur_form "Backus-Naur form") grammar inappropriate, and it does not have a monolithic compiler. Extending the compiler only requires writing a new word, instead of modifying a grammar and changing the underlying implementation. Using RPN, one can compute the value of the arithmetic expression (25 × 10) + 50 in the following way: ``` 25 10 * 50 + CR . 300 ok ``` [![](//upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Stack1.svg/250px-Stack1.svg.png)](/wiki/File:Stack1.svg) First the numbers 25 and 10 are put on the stack. [![](//upload.wikimedia.org/wikipedia/commons/thumb/f/fd/Forthstack1_5.svg/250px-Forthstack1_5.svg.png)](/wiki/File:Forthstack1_5.svg) The word `*` takes the top two numbers from the stack, multiplies them, and puts the product back on the stack. [![](//upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Forthstack2.svg/250px-Forthstack2.svg.png)](/wiki/File:Forthstack2.svg) Then the number 50 is placed on the stack. [![](//upload.wikimedia.org/wikipedia/commons/thumb/6/64/Forthstack3.svg/250px-Forthstack3.svg.png)](/wiki/File:Forthstack3.svg) The word `+` takes the top two numbers from the stack, adds them, and puts the sum back on the stack. `CR` ([carriage return](/wiki/Carriage_return "Carriage return")) starts the output on a new line. Finally, `.` prints the result. As everything has completed successfully, the Forth system prints `OK`.[[29]](#cite_note-3yqc9-30) Even Forth's structural features are stack-based. For example: ``` : FLOOR5 ( n -- n' ) DUP 6 < IF DROP 5 ELSE 1 - THEN ; ``` The colon indicates the beginning of a new definition, in this case a new word (again, *word* is the term used for a subroutine) called `FLOOR5`. The text in parentheses is a comment, advising that this word expects a number on the stack and will return a possibly changed number (on the stack). The subroutine uses the following commands: `DUP` duplicates the number on the stack; `6` pushes a 6 on top of the stack; `<` compares the top two numbers on the stack (6 and the `DUP`ed input), and replaces them with a true-or-false value; `IF` takes a true-or-false value and chooses to execute commands immediately after it or to skip to the `ELSE`; `DROP` discards the value on the stack; `5` pushes a 5 on top of the stack; and `THEN` ends the conditional. The `FLOOR5` word is equivalent to this function written in the [C programming language](/wiki/C_(programming_language) "C (programming language)") using the [conditional operator](/wiki/Ternary_conditional_operator "Ternary conditional operator") '?:' ``` int floor5(int v) { return (v < 6) ? 5 : (v - 1); } ``` This function is written more succinctly as: ``` : FLOOR5 ( n -- n' ) 1- 5 MAX ; ``` This can be run as follows: ``` 1 FLOOR5 CR . 5 ok 8 FLOOR5 CR . 7 ok ``` First a number (1 or 8) is pushed onto the stack, `FLOOR5` is called, which pops the number again and pushes the result. `CR` moves the output to a new line (again, this is only here for readability). Finally, a call to `.` pops the result and prints. ## Facilities [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=4 "Edit section: Facilities")] Forth's [grammar](/wiki/Formal_grammar "Formal grammar") has no official specification. Instead, it is defined by a simple algorithm. The interpreter reads a line of input from the user input device, which is then parsed for a word using spaces as a [delimiter](/wiki/Delimiter "Delimiter"); some systems recognise additional [whitespace](/wiki/Whitespace_character "Whitespace character") characters. When the interpreter finds a word, it looks the word up in the *dictionary*. If the word is found, the interpreter executes the code associated with the word, and then returns to parse the rest of the input stream. If the word isn't found, the word is assumed to be a number and an attempt is made to convert it into a number and push it on the stack; if successful, the interpreter continues parsing the input stream. Otherwise, if both the lookup and the number conversion fail, the interpreter prints the word followed by an error message indicating that the word is not recognised, flushes the input stream, and waits for new user input.[[30]](#cite_note-6dQ7P-31) The definition of a new word is started with the word `:` (colon) and ends with the word `;` (semi-colon). For example, ``` : X DUP 1+ . . ; ``` will compile the word `X`, and makes the name findable in the dictionary. When executed by typing `10 X` at the console this will print `11 10`.[[31]](#cite_note-compiler-32) Most Forth systems include an [assembler](/wiki/Assembly_language#Assembler "Assembly language") to write words using the processor's facilities. Forth assemblers often use a reverse Polish syntax in which the parameters of an instruction precede the instruction. A typical reverse Polish assembler prepares the operands on the stack and the mnemonic copies the whole instruction into memory as the last step. A Forth assembler is by nature a macro assembler, so that it is easy to define an alias for registers according to their role in the Forth system: e.g. "dsp" for the register used as the data stack pointer.[[32]](#cite_note-NAFQu-33) ### Operating system, files, and multitasking [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=5 "Edit section: Operating system, files, and multitasking")] Most Forth systems run under a host operating system such as [Microsoft Windows](/wiki/Microsoft_Windows "Microsoft Windows"), [Linux](/wiki/Linux "Linux") or a version of [Unix](/wiki/Unix "Unix") and use the host operating system's file system for source and data files; the ANSI Forth Standard describes the words used for I/O. All modern Forth systems use normal text files for source, even if they are embedded. An embedded system with a resident compiler gets its source via a serial line. Classic Forth systems traditionally use neither [operating system](/wiki/Operating_system "Operating system") nor [file system](/wiki/File_system "File system"). Instead of storing code in files, source code is stored in disk blocks written to physical disk addresses. The word `BLOCK` is employed to translate the number of a 1K-sized block of disk space into the address of a buffer containing the data, which is managed automatically by the Forth system. Block use has become rare since the mid-1990s. In a hosted system those blocks too are allocated in a normal file in any case. [Multitasking](/wiki/Computer_multitasking "Computer multitasking"), most commonly [cooperative](/wiki/Computer_multitasking#Cooperative_multitasking/time-sharing "Computer multitasking") [round-robin scheduling](/wiki/Round-robin_scheduling "Round-robin scheduling"), is normally available (although multitasking words and support are not covered by the ANSI Forth Standard). The word `PAUSE` is used to save the current task's execution context, to locate the next task, and restore its execution context. Each task has its own stacks, private copies of some control variables and a scratch area. Swapping tasks is simple and efficient; as a result, Forth multitaskers are available even on very simple [microcontrollers](/wiki/Microcontroller "Microcontroller"), such as the [Intel 8051](/wiki/Intel_MCS-51 "Intel MCS-51"), [Atmel AVR](/wiki/Atmel_AVR "Atmel AVR"), and [TI MSP430](/wiki/TI_MSP430 "TI MSP430").[[33]](#cite_note-nxtDb-34) Other non-standard facilities include a mechanism for issuing [calls](/wiki/System_call "System call") to the host OS or [windowing systems](/wiki/Windowing_system "Windowing system"), and many provide extensions that employ the scheduling provided by the operating system. Typically they have a larger and different set of words from the stand-alone Forth's `PAUSE` word for task creation, suspension, destruction and modification of priority. ### Self-compilation and cross compilation [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=6 "Edit section: Self-compilation and cross compilation")] A full-featured Forth system with all source code will compile itself, a technique commonly called meta-compilation or [self-hosting](/wiki/Self-hosting_(compilers) "Self-hosting (compilers)"), by Forth programmers (although the term doesn't exactly match [meta-compilation](/wiki/Meta-Compilation "Meta-Compilation") as it is normally defined). The usual method is to redefine the handful of words that place compiled bits into memory. The compiler's words use specially named versions of fetch and store that can be redirected to a buffer area in memory. The buffer area simulates or accesses a memory area beginning at a different address than the code buffer. Such compilers define words to access both the target computer's memory, and the host (compiling) computer's memory.[[34]](#cite_note-Swdke-35) After the fetch and store operations are redefined for the code space, the compiler, assembler, etc. are recompiled using the new definitions of fetch and store. This effectively reuses all the code of the compiler and interpreter. Then, the Forth system's code is compiled, but this version is stored in the buffer. The buffer in memory is written to disk, and ways are provided to load it temporarily into memory for testing. When the new version appears to work, it is written over the previous version. Numerous variations of such compilers exist for different environments. For [embedded systems](/wiki/Embedded_system "Embedded system"), the code may instead be written to another computer, a technique known as [cross compilation](/wiki/Cross-compilation "Cross-compilation"), over a serial port or even a single [TTL](/wiki/Transistor%E2%80%93transistor_logic "Transistor–transistor logic") bit, while keeping the word names and other non-executing parts of the dictionary in the original compiling computer. The minimum definitions for such a Forth compiler are the words that fetch and store a byte, and the word that commands a Forth word to be executed. Often the most time-consuming part of writing a remote port is constructing the initial program to implement fetch, store and execute, but many modern microprocessors have integrated debugging features (such as the [Motorola CPU32](/wiki/Motorola_CPU32 "Motorola CPU32")) that eliminate this task.[[35]](#cite_note-E5iFy-36) ## Structure of the language [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=7 "Edit section: Structure of the language")] The basic data structure of Forth is the "dictionary" which maps "words" to executable code or named data structures. The dictionary is laid out in memory as a tree of [linked lists](/wiki/Linked_list "Linked list") with the links proceeding from the latest (most recently) defined word to the oldest, until a [sentinel value](/wiki/Sentinel_value "Sentinel value"), usually a NULL pointer, is found. A context switch causes a list search to start at a different leaf. A linked list search continues as the branch merges into the main trunk leading eventually back to the sentinel, the root. There can be several dictionaries. In rare cases such as meta-compilation a dictionary might be isolated and stand-alone. The effect resembles that of nesting namespaces and can overload keywords depending on the context. A defined word generally consists of *head* and *body* with the head consisting of the *name field* (NF) and the *link field* (LF), and body consisting of the *code field* (CF) and the *parameter field* (PF). Head and body of a dictionary entry are treated separately because they may not be contiguous. For example, when a Forth program is recompiled for a new platform, the head may remain on the compiling computer, while the body goes to the new platform. In some environments (such as [embedded systems](/wiki/Embedded_system "Embedded system")) the heads occupy memory unnecessarily. However, some cross-compilers may put heads in the target if the target itself is expected to support an interactive Forth.[[36]](#cite_note-lx5fY-37) The exact format of a dictionary entry is not prescribed, and implementations vary. ### Structure of the compiler [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=8 "Edit section: Structure of the compiler")] The compiler itself is not a monolithic program. It consists of Forth words visible to the system, and usable by a programmer. This allows a programmer to change the compiler's words for special purposes. Compilation in traditional Forth systems is straightforward and does not involve building and optimizing an abstract representation of the code. (Some newer Forth compilers use more elaborate compilation methods, as common in other languages.) The "compile time" flag in the name field is set for words with "compile time" behavior. Most simple words execute the same code whether they are typed on a command line, or embedded in code. When compiling these, the compiler simply places code or a threaded pointer to the word.[[31]](#cite_note-compiler-32) The classic examples of compile-time words are the [control structures](/wiki/Control_structure "Control structure") such as `IF` and `WHILE`. Almost all of Forth's control structures and almost all of its compiler are implemented as compile-time words. Apart from some rarely used [control flow](/wiki/Control_flow "Control flow") words only found in a few implementations, such as the conditional return word `?EXIT` used in Ulrich Hoffmann's preForth, all of Forth's [control flow](/wiki/Control_flow "Control flow") words are executed during compilation to compile various combinations of primitive words along with their branch addresses.[[1]](#cite_note-preForth_slides-1)[[2]](#cite_note-preForth-2) For instance, `IF` and `WHILE`, and the words that match with those, set up `BRANCH` (unconditional branch) and `?BRANCH` (pop a value off the stack, and branch if it is false). Counted loop [control flow](/wiki/Control_flow "Control flow") words work similarly but set up combinations of primitive words that work with a counter, and so on. During compilation, the data stack is used to support control structure balancing, nesting, and back-patching of branch addresses. The snippet: ``` ... DUP 6 < IF DROP 5 ELSE 1 - THEN ... ``` would often be compiled to the following sequence inside a definition: ``` ... DUP LIT 6 < ?BRANCH 5 DROP LIT 5 BRANCH 3 LIT 1 - ... ``` The numbers after `BRANCH` represent relative jump addresses. `LIT` is the primitive word for pushing a "literal" number onto the data stack. (Faster, shorter code would be compiled using pointers to constants instead of `LIT` and embedded data, if any of the numbers involved have been separately defined as constants. There would be similar changes if yet other words were used instead of constants, and so on.) #### Compilation state and interpretation state [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=9 "Edit section: Compilation state and interpretation state")] The word `:` (colon) parses a name as a parameter, creates a dictionary entry (a *colon definition*) and enters compilation state. The interpreter continues to read space-delimited words from the user input device. If a word is found, the interpreter executes the *compilation semantics* associated with the word, instead of the *interpretation semantics*. The default compilation semantics of a word are to append its interpretation semantics to the current definition.[[31]](#cite_note-compiler-32) The word `;` (semi-colon) finishes the current definition and returns to interpretation state. It is an example of a word whose compilation semantics differ from the default. The interpretation semantics of `;` (semi-colon), most control flow words, and several other words are undefined in ANS Forth, meaning that they must only be used inside of definitions and not on the interactive command line.[[31]](#cite_note-compiler-32) The interpreter state can be changed manually with the words `[` (left-bracket) and `]` (right-bracket) which enter interpretation state or compilation state, respectively. These words can be used with the word `LITERAL` to calculate a value during a compilation and to insert the calculated value into the current colon definition. `LITERAL` has the compilation semantics to take an object from the data stack and to append semantics to the current colon definition to place that object on the data stack. In ANS Forth, the current state of the interpreter can be read from the [flag](/wiki/Flag_(programming) "Flag (programming)") `STATE` which contains the value true when in compilation state and false otherwise. This allows the implementation of so-called *state-smart words* with behavior that changes according to the current state of the interpreter. #### Immediate words [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=10 "Edit section: Immediate words")] The word `IMMEDIATE` marks the most recent colon definition as an *immediate word*, effectively replacing its compilation semantics with its interpretation semantics.[[37]](#cite_note-odMGJ-38) Immediate words are normally executed during compilation, not compiled, but this can be overridden by the programmer in either state. `;` is an example of an immediate word. In ANS Forth, the word `POSTPONE` takes a name as a parameter and appends the compilation semantics of the named word to the current definition even if the word was marked immediate. Forth-83 defined separate words `COMPILE` and `[COMPILE]` to force the compilation of non-immediate and immediate words, respectively. Instead of reserving space for an Immediate flag in every definition, some implementations of Forth use an Immediates Dictionary which is checked first when in compile mode. #### Unnamed words and execution tokens [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=11 "Edit section: Unnamed words and execution tokens")] In ANS Forth, unnamed words can be defined with the word `:NONAME` which compiles the following words up to the next `;` (semi-colon) and leaves an *execution token* on the data stack. The execution token provides an opaque handle for the compiled semantics, similar to the [function pointers](/wiki/Function_pointer "Function pointer") of the [C programming language](/wiki/C_(programming_language) "C (programming language)"). Execution tokens can be stored in variables. The word `EXECUTE` takes an execution token from the data stack and performs the associated semantics. The word `COMPILE,` (compile-comma) takes an execution token from the data stack and appends the associated semantics to the current definition. The word `'` (tick) takes the name of a word as a parameter and returns the execution token associated with that word on the data stack. In interpretation state, `' RANDOM-WORD EXECUTE` is equivalent to `RANDOM-WORD`.[[38]](#cite_note-iUYBX-39) #### Parsing words and comments [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=12 "Edit section: Parsing words and comments")] The words `:` (colon), `POSTPONE`, `'` (tick) are examples of *parsing words* that take their arguments from the user input device instead of the data stack. Another example is the word `(` (paren) which reads and ignores the following words up to and including the next right parenthesis and is used to place comments in a colon definition. Similarly, the word `\` (backslash) is used for comments that continue to the end of the current line. To be parsed correctly, `(` (paren) and `\` (backslash) must be separated by whitespace from the following comment text. ### Structure of code [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=13 "Edit section: Structure of code")] In most Forth systems, the body of a code definition consists of either [machine language](/wiki/Machine_language "Machine language"), or some form of [threaded code](/wiki/Threaded_code "Threaded code"). The original Forth which follows the informal FIG standard (Forth Interest Group), is a TIL (Threaded Interpretive Language). This is also called indirect-threaded code, but direct-threaded and subroutine threaded Forths have also become popular in modern times. The fastest modern Forths, such as SwiftForth, VFX Forth, and iForth, compile Forth to native machine code. ### Data objects [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=14 "Edit section: Data objects")] When a word is a variable or other data object, the CF points to the runtime code associated with the defining word that created it. A defining word has a characteristic "defining behavior" (creating a dictionary entry plus possibly allocating and initializing data space) and also specifies the behavior of an instance of the class of words constructed by this defining word. Examples include: `VARIABLE` : Names an uninitialized, one-cell memory location. Instance behavior of a `VARIABLE` returns its address on the stack. `CONSTANT` : Names a value (specified as an argument to `CONSTANT`). Instance behavior returns the value. `CREATE` : Names a location; space may be allocated at this location, or it can be set to contain a string or other initialized value. Instance behavior returns the address of the beginning of this space. Forth also provides a facility by which a programmer can define new application-specific defining words, specifying both a custom defining behavior and instance behavior. Some examples include circular buffers, named bits on an I/O port, and automatically indexed arrays. Data objects defined by these and similar words are global in scope. The function provided by local variables in other languages is provided by the data stack in Forth (although Forth also has real local variables). Forth programming style uses very few named data objects compared with other languages; typically such data objects are used to contain data which is used by a number of words or tasks (in a multitasked implementation).[[39]](#cite_note-ceEJ3-40) Forth does not enforce consistency of [data type](/wiki/Data_type "Data type") usage; it is the programmer's responsibility to use appropriate operators to fetch and store values or perform other operations on data. ## Examples [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=15 "Edit section: Examples")] ### “Hello, World!” [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=16 "Edit section: “Hello, World!”")] ``` : HELLO ( -- ) CR ." Hello, World!" ; ``` ``` HELLO Hello, World! ``` The word `CR` (Carriage Return) causes the output following `CR` to be displayed on a new line. The parsing word `."` (dot-quote) reads a double-quote delimited string and appends code to the current definition so that the parsed string will be displayed upon execution. The space character separating the word `."` from the string `Hello, World!` is not included as part of the string. It is needed so that the parser recognizes `."` as a Forth word. A standard Forth system is also an interpreter, and the same output can be obtained by typing the following code fragment into the Forth console: ``` CR .( Hello, World!) ``` `.(` (dot-paren) is an immediate word that parses a parenthesis-delimited string and displays it. As with the word `."` the space character separating `.(` from `Hello, World!` is not part of the string. The word `CR` comes before the text to print. By convention, the Forth interpreter does not start output on a new line. Also by convention, the interpreter waits for input at the end of the previous line, after an `ok` prompt. There is no implied "flush-buffer" action in Forth's `CR`, as sometimes is in other programming languages. ### Mixing states of compiling and interpreting [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=17 "Edit section: Mixing states of compiling and interpreting")] Here is the definition of a word `EMIT-Q` which when executed emits the single character `Q`: ``` : EMIT-Q 81 ( the ASCII value for the character 'Q' ) EMIT ; ``` This definition was written to use the [ASCII](/wiki/ASCII "ASCII") value of the `Q` character (81) directly. The text between the parentheses is a comment and is ignored by the compiler. The word `EMIT` takes a value from the data stack and displays the corresponding character. The following redefinition of `EMIT-Q` uses the words `[` (left-bracket), `]` (right-bracket), `CHAR` and `LITERAL` to temporarily switch to interpreter state, calculate the ASCII value of the `Q` character, return to compilation state and append the calculated value to the current colon definition: ``` : EMIT-Q [ CHAR Q ] LITERAL EMIT ; ``` The parsing word `CHAR` takes a space-delimited word as parameter and places the value of its first character on the data stack. The word `[CHAR]` is an immediate version of `CHAR`. Using `[CHAR]`, the example definition for `EMIT-Q` could be rewritten like this: ``` : EMIT-Q [CHAR] Q EMIT ; \ Emit the single character 'Q' ``` This definition used `\` (backslash) for the describing comment. Both `CHAR` and `[CHAR]` are predefined in ANS Forth. Using `IMMEDIATE` and `POSTPONE`, `[CHAR]` could have been defined like this: ``` : [CHAR] CHAR POSTPONE LITERAL ; IMMEDIATE ``` ### RC4 cipher program [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=18 "Edit section: RC4 cipher program")] In 1987, [Ron Rivest](/wiki/Ron_Rivest "Ron Rivest") developed the [RC4](/wiki/RC4 "RC4") cipher-system for RSA Data Security, Inc. Its description follows: > We have an array of 256 bytes, all different. Every time the array is used it changes by swapping two bytes. The swaps are controlled by counters *i* and *j*, each initially 0. To get a new *i*, add 1. To get a new *j*, add the array byte at the new *i*. Exchange the array bytes at *i* and *j*. The code is the array byte at the sum of the array bytes at *i* and *j*. This is XORed with a byte of the plaintext to encrypt, or the ciphertext to decrypt. The array is initialized by first setting it to 0 through 255. Then step through it using *i* and *j*, getting the new *j* by adding to it the array byte at *i* and a key byte, and swapping the array bytes at *i* and *j*. Finally, *i* and *j* are set to 0. All additions are modulo 256. The following Standard Forth version uses Core and Core Extension words only. ``` 0 value ii 0 value jj 0 value KeyAddr 0 value KeyLen create SArray 256 allot \ state array of 256 bytes : KeyArray KeyLen mod KeyAddr ; : get_byte + c@ ; : set_byte + c! ; : as_byte 255 and ; : reset_ij 0 TO ii 0 TO jj ; : i_update 1 + as_byte TO ii ; : j_update ii SArray get_byte + as_byte TO jj ; : swap_s_ij jj SArray get_byte ii SArray get_byte jj SArray set_byte ii SArray set_byte ; : rc4_init ( KeyAddr KeyLen -- ) 256 min TO KeyLen TO KeyAddr 256 0 DO i i SArray set_byte LOOP reset_ij BEGIN ii KeyArray get_byte jj + j_update swap_s_ij ii 255 < WHILE ii i_update REPEAT reset_ij ; : rc4_byte ii i_update jj j_update swap_s_ij ii SArray get_byte jj SArray get_byte + as_byte SArray get_byte xor ; ``` This is one way to test the code: ``` hex create AKey 61 c, 8A c, 63 c, D2 c, FB c, : test cr 0 DO rc4_byte . LOOP cr ; AKey 5 rc4_init 2C F9 4C EE DC 5 test \ output should be: F1 38 29 C9 DE ``` ## Forth engines [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=19 "Edit section: Forth engines")] A processor designed to support a specific programming language is called a language "engine".[[40]](#cite_note-dumse-41) Forth engines are hardware platforms specifically designed to support developing and running programs written in Forth. (Likewise, [Lisp machines](/wiki/Lisp_machine "Lisp machine") were specifically designed to support developing and running programs written in Lisp, the [Pascal MicroEngine](/wiki/Pascal_MicroEngine "Pascal MicroEngine") was specifically designed to support developing and running programs written in Pascal, etc.). The first commercially available single-chip Forth engine was the Rockwell R65F11,[[40]](#cite_note-dumse-41) a chip that includes a Forth kernel in ROM, an [enhanced 6502](/wiki/MOS_Technology_6502#Variations_and_derivatives "MOS Technology 6502"), SRAM, and various interface circuits that previously required peripheral chips.[[40]](#cite_note-dumse-41)[[41]](#cite_note-42)[[42]](#cite_note-43)[[43]](#cite_note-44)[[44]](#cite_note-45) Many other commercial CPUs (Harris RTX-2000, Novix NC4016, F21, MARC4, KimKlone, etc.) and many [homebrew CPUs](/wiki/Homebrew_CPU "Homebrew CPU") (My4TH, J1, H2, Mark 1 FORTH Computer, etc.) are specifically designed to run Forth. Typically they implement common Forth primitives such as the "Forth NEXT" as single instructions. ## Implementations [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=20 "Edit section: Implementations")] 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](/wiki/POSIX "POSIX"), [Microsoft Windows](/wiki/Microsoft_Windows "Microsoft Windows"), [macOS](/wiki/MacOS "MacOS")), many of these Forth systems also target a variety of [embedded systems](/wiki/Embedded_system "Embedded system"). Listed here are some of the systems which conform to the 1994 ANS Forth standard. * ASYST, a Forth-like system for data collection and analysis [[45]](#cite_note-46)[[16]](#cite_note-Rwirj-17) * [Gforth](/wiki/Gforth "Gforth"), a portable ANS Forth implementation from the [GNU Project](/wiki/GNU_Project "GNU Project") * [noForth](https://home.hccnet.nl/anij/nof/noforth.html), an ANS Forth implementation (as far as possible) for Flash microcontrollers (MSP430, RISC-V & RP2040) * [Open Firmware](/wiki/Open_Firmware "Open Firmware"), a [bootloader](/wiki/Bootloader "Bootloader") and [firmware](/wiki/Firmware "Firmware") standard based on ANS Forth * [pForth](/wiki/PForth "PForth"), portable Forth written in C * SP-Forth, ANS Forth implementation from the Russian Forth Interest Group (RuFIG) * Swift Forth, machine code generating implementation from Forth, Inc. * VFX Forth, optimizing native code Forth * [Firth](https://littlemanstackmachine.org/firth.html), an adaptation of Forth for the Little Man Stack Machine computer. * [Shi](https://gitlab.com/higaski/Shi), a fast and tiny embeddable Forth implementation written for the Thumb-2 ISA (ARMv7-M and newer). ## See also [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=21 "Edit section: See also")] * [Video games written in Forth](/wiki/Category:Video_games_written_in_Forth "Category:Video games written in Forth") * [RTX2010](/wiki/RTX2010 "RTX2010"), a CPU that runs Forth natively ## Notes [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=22 "Edit section: Notes")] 1. **[^](#cite_ref-3)** There are exceptions, such as Ulrich Hoffmann's preForth[[1]](#cite_note-preForth_slides-1)[[2]](#cite_note-preForth-2) and Tom Zimmer's TCOM ## References [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=23 "Edit section: References")] 1. ^ [***a***](#cite_ref-preForth_slides_1-0) [***b***](#cite_ref-preForth_slides_1-1) ["Ulrich Hoffmann's preForth slides"](http://www.euroforth.org/ef18/papers/hoffmann-slides.pdf) (PDF). 2. ^ [***a***](#cite_ref-preForth_2-0) [***b***](#cite_ref-preForth_2-1) ["Ulrich Hoffmann's preForth"](http://www.euroforth.org/ef18/papers/hoffmann.pdf) (PDF). 3. ^ [***a***](#cite_ref-maher_4-0) [***b***](#cite_ref-maher_4-1) Maher, Jimmy (October 28, 2014). ["Starflight"](https://www.filfre.net/2014/10/starflight/). *The Digital Antiquarian*. Retrieved April 29, 2023. 4. **[^](#cite_ref-oSWRm_5-0)** [NASA applications of Forth](https://web.archive.org/web/20101024223709/http://forth.gsfc.nasa.gov/) (original NASA server no longer running, copy from archive.org) 5. **[^](#cite_ref-zYmBe_6-0)** ["Intersil's RTX processors and Forth software controlled the successful Philae landing"](https://web.archive.org/web/20230429195754/https://mpeforth.com/press/MPE_PR_From_Telescope_to_Comet_2014_11_13.pdf) (PDF). *MicroProcessor Engineering Limited*. October 13, 2014. Archived from [the original](https://mpeforth.com/press/MPE_PR_From_Telescope_to_Comet_2014_11_13.pdf) (PDF) on April 29, 2023. Retrieved April 29, 2023. 6. **[^](#cite_ref-sgEMh_7-0)** ["Here comes Philae! Powered by an RTX2010"](https://www.cpushack.com/2014/11/12/here-comes-philae-powered-by-an-rtx2010/). *The CPU Shack Museum*. October 12, 2014. Retrieved April 29, 2023. 7. **[^](#cite_ref-C4Oss_8-0)** ["Space Related Applications of Forth"](https://web.archive.org/web/20101024223709/http://forth.gsfc.nasa.gov/). Archived from [the original](https://forth.gsfc.nasa.gov) on 2010-10-24. Retrieved 2007-09-04. 8. ^ [***a***](#cite_ref-evolution_9-0) [***b***](#cite_ref-evolution_9-1) [***c***](#cite_ref-evolution_9-2) Rather, Elizabeth D.; Colburn, Donald R.; Moore, Charles H. (1996) [1993]. ["The evolution of Forth"](http://www.forth.com/resources/evolution/index.html). In Bergin, Thomas J.; Gibson, Richard G. (eds.). *History of programming languages---II*. Association for Computing Machinery. pp. 625–670. [doi](/wiki/Doi_(identifier) "Doi (identifier)"):[10.1145/234286.1057832](https://doi.org/10.1145%2F234286.1057832). [ISBN](/wiki/ISBN_(identifier) "ISBN (identifier)") [0201895021](/wiki/Special:BookSources/0201895021 "Special:BookSources/0201895021"). 9. **[^](#cite_ref-10)** ["Atari In-Store Demonstration Program"](http://www.atarimania.com/demo-atari-400-800-xl-xe-in-store-demonstration-program_19329.html). *Atari Mania*. 10. **[^](#cite_ref-11)** Maynard, David S. ["David Maynard: Software Artist"](https://www.software-artist.com). 11. **[^](#cite_ref-12)** John Romero (2020-09-23). ["Time Warp: Episode 9 - Stuart Smith"](https://appletimewarp.libsyn.com/episode-9-stuart-smith) (Podcast). Event occurs at 29:02. 12. **[^](#cite_ref-13)** Aycock, John (2023). [*Amnesia Remembered: Reverse Engineering a Digital Artifact*](https://www.berghahnbooks.com/title/AycockAmnesia). Berghahn Books. p. 79. [ISBN](/wiki/ISBN_(identifier) "ISBN (identifier)") [978-1800738676](/wiki/Special:BookSources/978-1800738676 "Special:BookSources/978-1800738676"). 13. **[^](#cite_ref-14)** Sharp, Doug (8 April 2023). ["FORTH Programming Language (Going FORTH)"](https://chipwits.com/2023/04/08/forth-programming-language-going-forth/). 14. **[^](#cite_ref-15)** Rochat, Jan (February 6, 2025). ["Back to 1985: How We Remade ChipWits for the C64"](https://chipwits.com/2025/02/06/back-to-1985-how-we-remade-chipwits-for-the-c64/). 15. **[^](#cite_ref-16)** ["FORTH GETS ITS OWN SPECIAL INTEREST GROUP"](https://techmonitor.ai/technology/forth_gets_its_own_special_interest_group). *Tech Monitor*. 6 February 1989. 16. ^ [***a***](#cite_ref-Rwirj_17-0) [***b***](#cite_ref-Rwirj_17-1) Campbell et al, "Up and Running with Asyst 2.0", MacMillan Software Co., 1987 17. **[^](#cite_ref-WYK4Z_18-0)** Moore, Charles H. (1991). ["Forth - The Early Years"](https://web.archive.org/web/20060615025259/http://www.colorforth.com/HOPL.html). Archived from [the original](http://www.colorforth.com/HOPL.html) on 2006-06-15. Retrieved 2006-06-03. 18. **[^](#cite_ref-19)** Moore, Charles H. (August 1980). ["The Evolution of FORTH, an Unusual Language"](https://archive.org/details/byte-magazine-1980-08/page/n77/mode/2up). *BYTE Magazine*. **5** (8): 82. 19. **[^](#cite_ref-20)** ["ANS 1994 Specification, Annex C ("Perspective")"](https://www.taygeta.com/forth/dpansc.htm). *taygeta.com*. 20. **[^](#cite_ref-1AvuY_21-0)** ["The Forth Language"](https://archive.org/details/byte-magazine-1980-08/), *BYTE Magazine*, **5** (8), 1980 21. **[^](#cite_ref-family-tree_22-0)** M. Anton Ertl. ["Forth family tree and timeline"](https://www.complang.tuwien.ac.at/forth/family-tree/). 22. **[^](#cite_ref-gWyzb_23-0)** Lutus, Paul (1982). ["GraFORTH Language Manual"](https://archive.org/details/graforth1). *archive.org*. Insoft. 23. **[^](#cite_ref-qyrcN_24-0)** ["The Forth-79 Standard"](https://www.physics.wisc.edu/~lmaurer/forth/Forth-79.pdf) (PDF). Retrieved 2023-04-29. 24. **[^](#cite_ref-BQ2oi_25-0)** ["The Forth-83 Standard"](https://web.archive.org/web/20230405001333/https://forth.sourceforge.net/standard/fst83/). Archived from [the original](https://forth.sourceforge.net/standard/fst83/) on 2023-04-05. Retrieved 2023-04-29. 25. **[^](#cite_ref-IGDIN_26-0)** ["Programming Languages: Forth"](https://www.taygeta.com/forth/dpans.html). ANSI technical committee X3J14. 24 March 1994. Retrieved 2006-06-03. 26. **[^](#cite_ref-KojQK_27-0)** ["Standard Forth (ANSI INCITS 215-1994) Reference"](http://quartus.net/files/PalmOS/Forth/Docs/stdref.pdf) (PDF). Quartus Handheld Software. 13 September 2005. Retrieved 2023-04-29. 27. **[^](#cite_ref-BtuRy_28-0)** Claunch, Carl (2018-03-02). ["Restoring the original source code for FORTH on the IBM 1130"](https://rescue1130.blogspot.com/2018/03/restoring-original-source-code-for.html). *rescue1130*. Retrieved July 30, 2018. 28. **[^](#cite_ref-29)** Brodie, Leo (1987). [*Starting Forth*](https://www.forth.com/starting-forth/index.html) (2nd ed.). Prentice-Hall. [ISBN](/wiki/ISBN_(identifier) "ISBN (identifier)") [978-0-13-843079-5](/wiki/Special:BookSources/978-0-13-843079-5 "Special:BookSources/978-0-13-843079-5"). 29. **[^](#cite_ref-3yqc9_30-0)** [Brodie 1987](#CITEREFBrodie1987), p. 20 30. **[^](#cite_ref-6dQ7P_31-0)** [Brodie 1987](#CITEREFBrodie1987), p. 14 31. ^ [***a***](#cite_ref-compiler_32-0) [***b***](#cite_ref-compiler_32-1) [***c***](#cite_ref-compiler_32-2) [***d***](#cite_ref-compiler_32-3) [Brodie 1987](#CITEREFBrodie1987), p. 16 32. **[^](#cite_ref-NAFQu_33-0)** Rodriguez, Brad. ["Build Your Own Assembler, Part 2: a 6809 Forth Assembler"](https://www.bradrodriguez.com/papers/6809asm.txt). Retrieved 2023-04-29. 33. **[^](#cite_ref-nxtDb_34-0)** Rodriguez, Brad. ["Multitasking 8051 CamelForth"](https://www.bradrodriguez.com/papers/8051task.pdf) (PDF). Retrieved 2023-04-29. 34. **[^](#cite_ref-Swdke_35-0)** Rodriguez, Brad (July–August 1995). ["MOVING FORTH, Part 8: CamelForth for the 6809"](https://www.bradrodriguez.com/papers/moving8.htm). Retrieved 2023-04-29. 35. **[^](#cite_ref-E5iFy_36-0)** Shoebridge, Peter (1998-12-21). ["Motorola Background Debugging Mode Driver for Windows NT"](https://web.archive.org/web/20070606083244/http://www.zeecube.com/archive/bdm/index.htm). Archived from [the original](http://www.zeecube.com/archive/bdm/index.htm) on 2007-06-06. Retrieved 2006-06-19. 36. **[^](#cite_ref-lx5fY_37-0)** Martin, Harold M. (March 1991). ["Developing a tethered Forth model"](https://doi.org/10.1145%2F122089.122091). *ACM SIGFORTH Newsletter*. **2** (3). ACM Press: 17–19. [doi](/wiki/Doi_(identifier) "Doi (identifier)"):[10.1145/122089.122091](https://doi.org/10.1145%2F122089.122091). [S2CID](/wiki/S2CID_(identifier) "S2CID (identifier)") [26362015](https://api.semanticscholar.org/CorpusID:26362015). 37. **[^](#cite_ref-odMGJ_38-0)** [Brodie 1987](#CITEREFBrodie1987), p. 273 38. **[^](#cite_ref-iUYBX_39-0)** [Brodie 1987](#CITEREFBrodie1987), p. 199 39. **[^](#cite_ref-ceEJ3_40-0)** "Under The Hood". *[Brodie 1987](#CITEREFBrodie1987)*. p. 241. "To summarize, there are three kinds of variables: System variables contain values used by the entire Forth system. User variables contain values that are unique for each task, even though the definitions can be used by all tasks in the system. Regular variables can be accessible either system-wide or within a single task only, depending upon whether they are defined within `OPERATOR` or within a private task." 40. ^ [***a***](#cite_ref-dumse_41-0) [***b***](#cite_ref-dumse_41-1) [***c***](#cite_ref-dumse_41-2) Randy M. Dumse. "The R65F11 and F68K Single-Chip Forth Computers". [[1]](http://www.forth.org/bournemouth/jfar/vol2/no1/article1.pdf)[*[permanent dead link](/wiki/Wikipedia:Link_rot "Wikipedia:Link rot")*] [[2]](http://soton.mpeforth.com/flag/jfar/vol2/no1/article1.pdf) [Archived](https://web.archive.org/web/20141202144044/http://soton.mpeforth.com/flag/jfar/vol2/no1/article1.pdf) 2014-12-02 at the [Wayback Machine](/wiki/Wayback_Machine "Wayback Machine") 1984. 41. **[^](#cite_ref-42)** Ed Schmauch. ["A Computerized Corrosion Monitoring System"](http://www.forth.org/bournemouth/jfar/vol4/no2/article48.pdf)[*[permanent dead link](/wiki/Wikipedia:Link_rot "Wikipedia:Link rot")*]. 1986. 42. **[^](#cite_ref-43)** Lawrence P. Forsley. ["Embedded systems: 1990 Rochester Forth Conference: June 12 – 16th, 1990 University of Rochester"](https://books.google.com/books?id=Yx8YAQAAMAAJ) [Archived](https://web.archive.org/web/20150325214054/http://books.google.com/books?id=Yx8YAQAAMAAJ) 2015-03-25 at the [Wayback Machine](/wiki/Wayback_Machine "Wayback Machine"). p. 51. 43. **[^](#cite_ref-44)** Rockwell. ["RSC-Forth User's Manual"](http://www.smallestplcoftheworld.org/RSC-FORTH_User's_Manual.pdf) [Archived](https://web.archive.org/web/20131207015149/http://smallestplcoftheworld.org/RSC-FORTH_User%27s_Manual.pdf) 2013-12-07 at the [Wayback Machine](/wiki/Wayback_Machine "Wayback Machine"). 1983. 44. **[^](#cite_ref-45)** ["Rockwell R65F11 R65F12 Forth Based Microcomputers"](http://archive.6502.org/datasheets/rockwell_r65f11_r65f12_forth_microcomputers.pdf) (PDF). June 1987. [Archived](https://web.archive.org/web/20200804035007/http://archive.6502.org/datasheets/rockwell_r65f11_r65f12_forth_microcomputers.pdf) (PDF) from the original on 4 August 2020. Retrieved 28 Apr 2020. 45. **[^](#cite_ref-46)** Hary, David; Oshio, Koichi; Flanagan, Steven D. (1987). "The ASYST Software for Scientific Computing". *Science*. **236** (4805): 1128–32. [Bibcode](/wiki/Bibcode_(identifier) "Bibcode (identifier)"):[1987Sci...236.1128H](https://ui.adsabs.harvard.edu/abs/1987Sci...236.1128H). [doi](/wiki/Doi_(identifier) "Doi (identifier)"):[10.1126/science.236.4805.1128](https://doi.org/10.1126%2Fscience.236.4805.1128). [JSTOR](/wiki/JSTOR_(identifier) "JSTOR (identifier)") [1699106](https://www.jstor.org/stable/1699106). [PMID](/wiki/PMID_(identifier) "PMID (identifier)") [17799670](https://pubmed.ncbi.nlm.nih.gov/17799670). [S2CID](/wiki/S2CID_(identifier) "S2CID (identifier)") [30463062](https://api.semanticscholar.org/CorpusID:30463062). ## External links [[edit](/w/index.php?title=Forth_(programming_language)&action=edit§ion=24 "Edit section: External links")] * [Forth 2012 Standard](https://forth-standard.org) official site * [*Programming a problem-oriented language*](https://forth.org/POL.pdf) unpublished book by Charles H. Moore (1970) * [Annual European Forth Conference](https://www.euroforth.org/) 1985–present * [Forth Research](https://www.complang.tuwien.ac.at/projects/forth.html) at Institut für Computersprachen [![](//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/40px-Commons-logo.svg.png)](/wiki/File:Commons-logo.svg) Wikimedia Commons has media related to [Forth (programming language)](https://commons.wikimedia.org/wiki/Category:Forth_(programming_language) "commons:Category:Forth (programming language)"). [![](//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png)](/wiki/File:Wikibooks-logo-en-noslogan.svg) Wikibooks has a book on the topic of: ***[Forth](https://en.wikibooks.org/wiki/Forth "wikibooks:Forth")*** | * [v](/wiki/Template:Programming_languages "Template:Programming languages") * [t](/wiki/Template_talk:Programming_languages "Template talk:Programming languages") * [e](/wiki/Special:EditPage/Template:Programming_languages "Special:EditPage/Template:Programming languages") [Programming languages](/wiki/Programming_language "Programming language") | | | --- | --- | | * [Comparison](/wiki/Comparison_of_programming_languages "Comparison of programming languages") * [Timeline](/wiki/Timeline_of_programming_languages "Timeline of programming languages") * [History](/wiki/History_of_programming_languages "History of programming languages") | | | * [Ada](/wiki/Ada_(programming_language) "Ada (programming language)") * [ALGOL](/wiki/ALGOL "ALGOL") + [Simula](/wiki/Simula "Simula") * [APL](/wiki/APL_(programming_language) "APL (programming language)") * [Assembly](/wiki/Assembly_language "Assembly language") * [BASIC](/wiki/BASIC "BASIC") + [Visual Basic](/wiki/Visual_Basic "Visual Basic") - [classic](/wiki/Visual_Basic_(classic) "Visual Basic (classic)") - [.NET](/wiki/Visual_Basic_(.NET) "Visual Basic (.NET)") * [C](/wiki/C_(programming_language) "C (programming language)") * [C++](/wiki/C%2B%2B "C++") * [C#](/wiki/C_Sharp_(programming_language) "C Sharp (programming language)") * [COBOL](/wiki/COBOL "COBOL") * [Erlang](/wiki/Erlang_(programming_language) "Erlang (programming language)") + [Elixir](/wiki/Elixir_(programming_language) "Elixir (programming language)") * Forth * [Fortran](/wiki/Fortran "Fortran") * [Go](/wiki/Go_(programming_language) "Go (programming language)") * [Haskell](/wiki/Haskell "Haskell") * [Java](/wiki/Java_(programming_language) "Java (programming language)") * [JavaScript](/wiki/JavaScript "JavaScript") * [Julia](/wiki/Julia_(programming_language) "Julia (programming language)") * [Kotlin](/wiki/Kotlin "Kotlin") * [Lisp](/wiki/Lisp_(programming_language) "Lisp (programming language)") * [Lua](/wiki/Lua "Lua") * [MATLAB](/wiki/MATLAB "MATLAB") * [ML](/wiki/ML_(programming_language) "ML (programming language)") + [Caml](/wiki/Caml "Caml") - [OCaml](/wiki/OCaml "OCaml") + [Standard ML](/wiki/Standard_ML "Standard ML") * [Pascal](/wiki/Pascal_(programming_language) "Pascal (programming language)") + [Object Pascal](/wiki/Object_Pascal "Object Pascal") * [Perl](/wiki/Perl "Perl") + [Raku](/wiki/Raku_(programming_language) "Raku (programming language)") * [PHP](/wiki/PHP "PHP") * [Prolog](/wiki/Prolog "Prolog") * [Python](/wiki/Python_(programming_language) "Python (programming language)") * [R](/wiki/R_(programming_language) "R (programming language)") * [Ruby](/wiki/Ruby_(programming_language) "Ruby (programming language)") * [Rust](/wiki/Rust_(programming_language) "Rust (programming language)") * [SAS](/wiki/SAS_language "SAS language") * [SQL](/wiki/SQL "SQL") * [Scratch](/wiki/Scratch_(programming_language) "Scratch (programming language)") * [Shell](/wiki/Shell_script "Shell script") * [Smalltalk](/wiki/Smalltalk "Smalltalk") * [Swift](/wiki/Swift_(programming_language) "Swift (programming language)") * *[more...](/wiki/List_of_programming_languages "List of programming languages")* | | | * **Lists:** [Alphabetical](/wiki/List_of_programming_languages "List of programming languages") * [Categorical](/wiki/List_of_programming_languages_by_type "List of programming languages by type") * [Generational](/wiki/Generational_list_of_programming_languages "Generational list of programming languages") * [Non-English-based](/wiki/Non-English-based_programming_languages "Non-English-based programming languages") * [Category](/wiki/Category:Programming_languages "Category:Programming languages") | | | [Authority control databases](/wiki/Help:Authority_control "Help:Authority control") [Edit this at Wikidata](https://www.wikidata.org/wiki/Q275472#identifiers "Edit this at Wikidata") | | | --- | --- | | International | * [GND](https://d-nb.info/gnd/4017981-3) | | National | * [United States](https://id.loc.gov/authorities/sh85050918) * [Israel](https://www.nli.org.il/en/authorities/987007545715805171) | | Other | * [Yale LUX](https://lux.collections.yale.edu/view/concept/931111ef-f1ef-4ba1-8d0d-0108e93a3b91) | ![](https://en.wikipedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&type=1x1&usesul3=1) Retrieved from "" [Categories](/wiki/Help:Category "Help:Category"): * [Forth programming language family](/wiki/Category:Forth_programming_language_family "Category:Forth programming language family") * [Concatenative programming languages](/wiki/Category:Concatenative_programming_languages "Category:Concatenative programming languages") * [Stack-based virtual machines](/wiki/Category:Stack-based_virtual_machines "Category:Stack-based virtual machines") * [Systems programming languages](/wiki/Category:Systems_programming_languages "Category:Systems programming languages") * [Programming languages created in 1970](/wiki/Category:Programming_languages_created_in_1970 "Category:Programming languages created in 1970") * [Extensible syntax programming languages](/wiki/Category:Extensible_syntax_programming_languages "Category:Extensible syntax programming languages") * [Programming languages with an ISO standard](/wiki/Category:Programming_languages_with_an_ISO_standard "Category:Programming languages with an ISO standard") * [Programming languages](/wiki/Category:Programming_languages "Category:Programming languages") * [1970 software](/wiki/Category:1970_software "Category:1970 software") Hidden categories: * [All articles with dead external links](/wiki/Category:All_articles_with_dead_external_links "Category:All articles with dead external links") * [Articles with dead external links from May 2017](/wiki/Category:Articles_with_dead_external_links_from_May_2017 "Category:Articles with dead external links from May 2017") * [Articles with permanently dead external links](/wiki/Category:Articles_with_permanently_dead_external_links "Category:Articles with permanently dead external links") * [Webarchive template wayback links](/wiki/Category:Webarchive_template_wayback_links "Category:Webarchive template wayback links") * [Articles with short description](/wiki/Category:Articles_with_short_description "Category:Articles with short description") * [Short description is different from Wikidata](/wiki/Category:Short_description_is_different_from_Wikidata "Category:Short description is different from Wikidata") * [All articles with unsourced statements](/wiki/Category:All_articles_with_unsourced_statements "Category:All articles with unsourced statements") * [Articles with unsourced statements from April 2022](/wiki/Category:Articles_with_unsourced_statements_from_April_2022 "Category:Articles with unsourced statements from April 2022") * [Commons category link is on Wikidata](/wiki/Category:Commons_category_link_is_on_Wikidata "Category:Commons category link is on Wikidata") * [Articles with example C code](/wiki/Category:Articles_with_example_C_code "Category:Articles with example C code") * This page was last edited on 1 January 2026, at 20:21 (UTC). * Text is available under the [Creative Commons Attribution-ShareAlike 4.0 License](/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License "Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License"); additional terms may apply. By using this site, you agree to the [Terms of Use](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use "foundation:Special:MyLanguage/Policy:Terms of Use") and [Privacy Policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy "foundation:Special:MyLanguage/Policy:Privacy policy"). Wikipedia® is a registered trademark of the [Wikimedia Foundation, Inc.](https://wikimediafoundation.org/), a non-profit organization. * [Privacy policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy) * [About Wikipedia](/wiki/Wikipedia:About) * [Disclaimers](/wiki/Wikipedia:General_disclaimer) * [Contact Wikipedia](//en.wikipedia.org/wiki/Wikipedia:Contact_us) * [Legal & safety contacts](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Legal:Wikimedia_Foundation_Legal_and_Safety_Contact_Information) * [Code of Conduct](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct) * [Developers](https://developer.wikimedia.org) * [Statistics](https://stats.wikimedia.org/#/en.wikipedia.org) * [Cookie statement](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement) * [Mobile view](//en.wikipedia.org/w/index.php?title=Forth_(programming_language)&mobileaction=toggle_view_mobile) * [![Wikimedia Foundation](/static/images/footer/wikimedia.svg)](https://www.wikimedia.org/) * [![Powered by MediaWiki](/w/resources/assets/mediawiki_compact.svg)](https://www.mediawiki.org/) Search Search Toggle the table of contents Forth (programming language) 34 languages [Add topic](#)