There are the following words for performing the various translator actions:
Perform the interpreting action of translator. For a
system-defined translator, first consume the translator and
translator-specific additional stack items and possibly perform
additional scanning specified for the translator, then perform the
interpreting
run-time specified for the translator. For a
user-defined translator, remove translator from the stack and
execute its int-xt.
Perform the compiling action of translator. For a
system-defined translator, first consume the translator and
translator-specific additional stack items and possibly perform
additional scanning specified for the translator, then perform the
compiling
run-time specified for the translator, or, if none
is specified, compile the interpreting
run-time. For a
user-defined translator, remove translator from the stack and
execute its comp-xt.
Perform the postponing action of translator. For a
system-defined translator, first consume the translator and
translator-specific additional stack items and possibly perform
additional scanning specified for the translator, then compile the
compiling
run-time. For a user-defined translator, remove
translator from the stack and execute its post-xt.
throw
s -13 (undefined word) if token is 0.
Their typical use is in a text interpreter. A simple text interpreter could look like this:
: myinterpret ( -- ) \ refill happens outside begin parse-name dup while forth-recognize ?found state @ if compiling else interpreting then repeat 2drop ;
This text interpreter itself does not deal with postponing; ]]
can be implemented as a text interpreter that performs the postponing: