articles/forth.md: update

This commit is contained in:
tocariimaa 2025-02-15 13:07:33 -03:00
parent 44ef71c658
commit 765b8db461

View file

@ -24,13 +24,12 @@ is applied:
## User defined words
The programmer can of course define his own words, in Forth this is called "compiling":
```forth
: \ the `:` word starts compilation
sq \ name of our word
dup \ DUPplicate the value at the top of the stack
* \ multiply
; \ `;` ends compilation mode
: sq \ `:` starts compilation, followed immediately by the name of our word
dup \ DUPplicate the value at the top of the stack
* \ multiply
; \ `;` ends compilation mode
8 sq . \ ==> 64
8 sq . \ ==> 64
```
When compilation mode is entered (with `:`), the Forth environment reads the next word, which becomes
the name of our defined word (in this case `sq`) and after that it appends the addresses of all words