A standard program is not permitted to change state
explicitly. However, it can change state implicitly, using the
words [ and ]. When [ is executed it switches
state to interpret state, and therefore the text interpreter
starts interpreting. When ] is executed it switches state
to compile state and therefore the text interpreter starts
compiling. The most common usage for these words is for switching into
interpret state and back from within a colon definition; this technique
can be used to compile a literal (for an example, see Literals) or
for conditional compilation (for an example, see Interpreter Directives).
Don’t use state! State is the state of the text
interpreter, and ordinary words should work independently of it; in
particular, state does not tell you whether the
interpretation semantics or compilation semantics of a word are
being performed. See State-smartness–Why it is evil
and how to exorcise it. For an alternative to state-smart
words, see How to define combined words.
A-addr is the address of a cell containing the compilation
state flag. 0 => interpreting, -1 => compiling. A standard program
must not store into state, but instead use [ and
].