Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Forth

< >

Forth is a programming language created in 1970 by Charles H. Moore.

#85on PLDB 54Years Old 2kRepos
REPL · Wikipedia · Subreddit · Docs

Forth is an imperative stack-based computer programming language and environment originally designed by Charles "Chuck" Moore. Language features include structured programming, reflection (the ability to modify the program structure during program execution), concatenative programming (functions are composed with juxtaposition) and extensibility (the programmer can create new commands). Although not an acronym, the language's name is sometimes spelled with all capital letters as FORTH, following the customary usage during its earlier years. Read more on Wikipedia...


Example from Riju:
." Hello, world!" CR
Example from hello-world:
.( Hello World)
' Hello world in Forth ." Hello World" CR
Example from Linguist:
: HELLO ( -- ) ." Hello Forth (fth)!" ; HELLO
Example from Wikipedia:
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

Language features

Feature Supported Example Token
Integers ✓ \ (\#|%|&|\-|\+)?[0-9]+
Hexadecimals ✓ \ (\$[0-9A-F]+)
Print() Debugging ✓ .
Line Comments ✓ \ A comment \
Postfix Notation ✓ \ Multiplies 25 and 10 and then adds 50 to result 25 10 * 50 +
Case Insensitive Identifiers ✓
Comments ✓
Semantic Indentation X
Case Sensitivity X
- Build the next great programming language · Add · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements · Part of the World Wide Scroll