Forth (programming language): Difference between revisions

Content deleted Content added
m Facilities: formatting fix
Line 169:
The interpreter state can be changed manually with the words <code><nowiki>[</nowiki></code> (left-bracket) and <code><nowiki>]</nowiki></code> (right-bracket) which enter interpretation state or compilation state, respectively. These words can be used with the word <code>LITERAL</code> to calculate a value during a compilation and to insert the calculated value into the current colon definition. <code>LITERAL</code> has the compilation semantics to take an object from the data stack and to append semantics to the current colon definition to place that object on the data stack.
 
In {{Not a typo|ANS}} <!-- not a misspelling --> Forth, the current state of the interpreter can be read from the [[flag (computingprogramming)|flag]] <code>STATE</code> which contains the value true when in compilation state and false otherwise. This allows the implementation of so-called ''state-smart words'' with behavior that changes according to the current state of the interpreter.
 
==== Immediate words ====