Measures Concepts
GitHub icon

Forth

Forth - Programming language

< >

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

#122on PLDB 54Years Old 2kRepos

Try now: Riju · Replit

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 Token Example
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

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout