6.15.3 Compilation token

The compilation semantics of a word is represented by a compilation token consisting of two cells: xt1 xt2.

You get the compilation token of, e.g., if in a standard way with name>compile, e.g., s" if" find-name name>compile, but there are also parsing words to get the compilation token of a word:

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

Compilation token xt1 xt2 represents name’s compilation semantics.

COMP' ( "name" – xt1 xt2  ) gforth-0.2 “comp-tick”

Compilation token xt1 xt2 represents name’s compilation semantics.

You can perform the compilation semantics represented by the compilation token with execute. Executeing the compilation token consumes the whole compilation token and there is possibly an additional stack effect determined by the represented compilation semantics (e.g., executeing the compilation token of if pushes an orig).

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

postpone, ( xt1 xt2 –  ) gforth-0.2 “postpone-comma”

Compile the compilation semantics represented by the compilation token xt1 xt2.

Implementation: The top cell xt2 of a compilation token xt1 xt2 is an execution token that represents either execute or compile,25 Xt1 is more specific to the represented word; for most words, it is the xt produced by name>interpret, but there are exceptions, e.g., for words defined with interpret/compile:.


Footnotes

(25)

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