Content deleted Content added
Blush30720 (talk | contribs) Format citations |
Blush30720 (talk | contribs) Remove erroneous newline |
||
Line 190:
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.<ref name="compiler" />
The classic examples of compile-time words are the [[control structure]]s such as <code>IF</code> and <code>WHILE</code>.
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]] words only found in a few implementations, such as the conditional return word {{PreCode|?EXIT}} used in Ulrich Hoffmann's preForth, all of Forth's [[control flow]] words are executed during compilation to compile various combinations of primitive words along with their branch addresses.<ref name = "preForth slides"> {{Cite web
| url = http://www.euroforth.org/ef18/papers/hoffmann-slides.pdf
Line 202 ⟶ 204:
}}
</ref>
<syntaxhighlight lang="forth">
... DUP 6 < IF DROP 5 ELSE 1 - THEN ...
|