Node:Compilation token, Next:, Previous:Execution token, Up:Tokens for Words



Compilation token

Gforth represents the compilation semantics of a named word by a compilation token consisting of two cells: w xt. The top cell xt is an execution token. The compilation semantics represented by the compilation token can be performed with execute, which consumes the whole compilation token, with an additional stack effect determined by the represented compilation semantics.

At present, the w part of a compilation token is an execution token, and the xt part represents either execute or compile,1. However, don't rely on that knowledge, unless necessary; future versions of Gforth may introduce unusual compilation tokens (e.g., a compilation token that represents the compilation semantics of a literal).

You can perform the compilation semantics represented by the compilation token with execute. You can compile the compilation semantics with postpone,. I.e., COMP' word postpone, is equivalent to postpone word.

[COMP']       compilation "name" -- ; run-time -- w xt         gforth       ``bracket-comp-tick''
Compilation token w xt represents name's compilation semantics.
COMP'       "name" -- w xt         gforth       ``comp-tick''
Compilation token w xt represents name's compilation semantics.
postpone,       w xt --         gforth       ``postpone-comma''
Compile the compilation semantics represented by the compilation token w xt.

Footnotes

  1. Depending upon the compilation semantics of the word. If the word has default compilation semantics, the xt will represent compile,. Otherwise (e.g., for immediate words), the xt will represent execute.