HolonT Forth

Forth for Tcl

Why Forth?

I like Tcl. HolonForth is written in Tcl. Tcl provides a rich software ecosystem that is available on all popular computer platforms.

Tcl and Forth share a common philosophy. Both are based on words (or "commands") that implement the rules of the language. There is just one fundamental difference: Tcl uses prefix and infix notation, Forth uses postfix notation.

Postfix has remarkable consequences. A Forth program is a sequence of words that exchange their parameters on a stack.

In other words: Forth simplifies programming.

Forth in Tcl

HolonTForth uses Tcl as its native language. Tcl is an excellent companion to Forth.

- All Tcl and Tk features are available as Forth Code words.

- The parameter stack is used to transfer arguments and results between words. Inside words local variables are preferred. Stack parameters are converted to local variables at the start of a word. The local variables are defined in the stack notation.

- Global and local variables are implemented as objecttypes with private messages and methods.

- All standard Forth flow control words are implemented as well as foreach and switch in the form of a case construct.

- HolonTForth is a metacompiler. The Forth system and the Tk extensions are defined and loaded with the application. The system definitions can be changed and extended by the user.