Writing Comments and “Hello, World!”
Many programming languages use a stack (as a matter of fact, any language that supports recursive function calls, such as C or Java, probably uses a stack). The extraordinary feature of Forth is that it uses not one stack but two: one for data (the data stack) and one for control (the return stack). And, unlike the stacks in C or Java, which are invisible to the programmer, the Forth stacks can and should be manipulated explicitly.
Before you see the stacks in action, I must say a word or two about the typing convention, comments, and the "Hello, world!" program in Forth.
Forth supports several commenting styles:
-
\ text (backslash followed by at least one space) comments the remainder of the current ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access