longforth:start

This is an old revision of the document!


A Persistent Version of Forth

For me, personally, the best way to start learning about the design of persistent virtual machines is to create a working persistent implementation of the Forth Programming Language.

Forth is a wonderfully minimal programming language that hosts it's own interactive development environment.

Within a simple Forth implementation essential topics are explored, including:

  • Stack based execution
    • The stack sits at the heart of common virtual machines, like the [wp>Java_Virtual_Machine|JVM] or [wp>Common_Language_Runtime|CLR]. Forth is a stack based programming language where the programmer is able to directly interact with the stack, instead of having it abstracted away beneath friendlier syntax.
  • Execution environment
    • Forth provides a minimalist development environment that is incredibly power and, once you get used to it, enjoyable to use. The experience challenges you to reconsider the necessity of all the features that we now have in our bloated IDEs.
  • Instruction set design
    • Forth's minimalism extends to it's instruction set. Forth provides a complete, powerful language using a set of words that is much smaller than the opcodes supported by the typical virtual machine.
  • Portability
    • Forth is easily ported to new hardware because most of the instruction set is implemented using just a handful of core words that use native machine code. To port to a new environment only those core words need to be ported.
  • Interactive and Active development
    • Before we had Agile and Refactoring we had Thinking Forth by Leo Brodie. The subtitle says it all: “A Language and Philosophy for Solving Problems.”

NibbleForth

Rather than working from a specification, I will be using NibbleForth as my model of Forth. I've choosen NibbleForth because it implements a fully functioning, minimalistic, version of Forth using Python code that is easy to read and understand.

I have chosen NibbleForth over more compact implementations such as [https://hackaday.com/2023/11/06/tiny-forth-could-be-the-smallest/|Tiny Forth] because of this simplicity and clarity of implementation.

NibbleForth was written by Ben Hoyt as an experiment on compact code. The source can be found in his GitHub account: https://github.com/benhoyt/nibbleforth.

  • longforth/start.1722163196.txt.gz
  • Last modified: 2024/07/28 06:39
  • by gedbadmin