super secret hq

A Tale of Two Forth Modes

Traditionally, the Forth system has two modes: interpreted and compiled. In interpreted mode, the system runs a loop:

while true
  read a line of input
  while more words in the line
      read a word
      look up the word in the dictionary
      if not found
          raise an error
      execute the word

When compiling, the system does a bit more work. Words are not executed as they are pulled from the input. Instead, they’re saved off to a block of memory. A word that points to the new block is added to the dictionary so that it can executed later.

When we start writing the False Forth system, we will start with the interpreter. You might be surprised at how easy that is to build.

[A] difficult problem is more fun to solve than an easy one. So the problem is enhanced to be more worthy of attention.

Chuck Moore Lost Art of K.I.S.S.

I will try to avoid making this more interesting by increasing the complexity of the interpreter and compiler. Let me know if you notice that I’m failing.