Next: , Previous: Advanced macros Tutorial, Up: Tutorial

3.36 Compilation Tokens

This section is Gforth-specific. You can skip it.

' word compile, compiles the interpretation semantics. For words with default compilation semantics this is the same as performing the compilation semantics. To represent the compilation semantics of other words (e.g., words like if that have no interpretation semantics), Gforth has the concept of a compilation token (CT, consisting of two cells), and words comp' and [comp']. You can perform the compilation semantics represented by a CT with execute:

     : foo2 ( n1 n2 -- n )
        [ comp' + execute ] ;
     see foo

You can compile the compilation semantics represented by a CT with postpone,:

     : foo3 ( -- )
       [ comp' + postpone, ] ;
     see foo3

[ comp' word postpone, ] is equivalent to POSTPONE word. comp' is particularly useful for words that have no interpretation semantics:

     ' if
     comp' if .s 2drop

Reference: Tokens for Words.