The Colon Compiler in Detail

  Some parts of this page/site are currently incomplete & will be updated asap
  Other parts will change continually so use “Refresh” in your browser !!
  There is extensive use of “Tooltips” text to support learning which do not seem to render on a Smartphone. This site is best viewed via a computer’s HD monitor


The Colon Compiler is the Central Dogma of Forth…

The Colon Compiler

… is used to create a Colon Definition

Represented by the Forth Code under assembler label COLON

Image#1: The Forth Model Assembler Source Code to implement the Forth Word “:”   Image: Husband, 2021

(1) - The Forth Dictionary Header

Which comprises of the Name Field and the Link Field   (a)

- The IMMEDIATE Flag is set which means it will execute during compilation 1

(2) - The Assembler Label "COLON"

  (b) -

https://en.wikipedia.org/wiki/Endianness “endianness is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. A little-endian system, in contrast, stores the least-significant byte at the smallest address”

(3) - The High-Level Forth Words

The Colon Interpreter

Represented by the Machine Code at assembler label DOCOL

(4) - The Assembler Label "DOCOL"

  (c) -

(5) - The Machine Code

  (d) -
  (e) -
  (f) -

(6) - ... Invoked by ;CODE

;CODE     (;CODE)

(7) - The Address in Memory

(8) - ... Where This Code Will Go

(9) - This is Machine Code

And the Real Code Generated

(1) - Where is The Top of the Dictionary?

(2) - The Test Word's Definition

(3) - The Name of the Test Word

(4) - Invoking the Text Compiler

(5) - ... and a new line...

(6) - Now stop compiling

(7) - Test the new word "LIFT"

(8) - Use SPELL to analyse the new word

(9) - The Dictionary Header

(10) - What is the Code Field doing?

(11) - References Compiled

(12) - The End of the Definition

  1. … Why? 


Updated: 28th March 2022 by David Husband
© 2021 David Husband, a.k.a. Baremetal Engineer Extraordinaire
All Rights Reserved – All Trademarks & Copyrights Acknowledged
All personal information is subject to the Data Protection Act 2018 & the UK GDPR
“ad auxilium aliis ad auxilium sibi”