6.12.3 Compilation token

The compilation semantics of a named word is represented 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,22. 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 get the compilation token of, e.g., if in a standard way with name>compile, e.g., `if name>compile, but there are also parsing words to get the compilation token of a word:

[COMP'] ( compilation "name" – ; run-time – w xt  ) gforth-0.2 “bracket-comp-tick”

Compilation token w xt represents name’s compilation semantics.

COMP' ( "name" – w xt  ) gforth-0.2 “comp-tick”

Compilation token w xt represents name’s compilation semantics.

You can perform the compilation semantics represented by the compilation token with execute. You can compile the compilation semantics with postpone,. I.e., ``x name>compile postpone, is equivalent to postpone x.

postpone, ( w xt –  ) gforth-0.2 “postpone-comma”

Compile the compilation semantics represented by the compilation token w xt.


Footnotes

(22)

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.