Word Types
Proc
HolonTForth needs a couple of native Tcl procedures, for example, stack handling words.
proc <name> {} { <Tcl source> }
Code
A code word is a Tcl proc with integrated stack handling. Arguments are accepted on the stack and results are returned on the stack.
code <name> ( -- ) <Tcl source>
The code words interface Forth with Tcl, handle I/O, events, GUI, etc. They are the low level kernel words of the Forth system.
:
The colon (:) word is the "proc of Forth". It is defined by other Forth words.
: <name> ( -- ) <Forth source>
Again, arguments are accepted and results are returned on the parameter stack.
( -- ) is stack notation.
Compiler
As in Tcl, flow control is in Forth handled by the flow words themselves: IF THEN etc are words that are executed when the source is compiled. They are known as immediate words in Forth, in HolonTForth I call them compilers. A compiler word executes when the source is loaded.
Compiler <name> <host action>
The Compiler words define action in the host and are written in Tcl code.
Objecttype
HolonTForth handles data as Objecttypes.
Objecttype <name> <array of messages and methods>
This replaces the Forth construct create ... does ...
Tcl
Tcl set x 0
The text after Tcl is treated as a Tcl script.