Brussels / 1 & 2 February 2020


Forth - The New Synthesis

Growing Forth with preForth and seedForth

The "new synthesis" of Forth is an ongoing effort in spirit of the Forth Modification Laboratory workshops. Its aim is to identify the essentials of Forth and to combine them in a new way to build systems that can scale-down as Forth always did and can scale-up to large applications and development projects.

The new synthesis is guided by the two principles biological analogy and disaggregation.

We scrutinize many aspects of traditional and modern Forth implementations trying to separate techniques that are normally deeply intertwined. After isolating the techniques we thrive to combine them in new ways.

The talk describes two mile stones of the ongoing project:

  • preForth (< 500 LOCs) a minimalistic non-interactive Forth kernel that can bootstrap itself and can be used as an easy-to-port basis for a full Forth implementation or implementing other programming languages. It is an open ended language that inherits functionality from the target platform's development tools.

  • seedForth (<550 LOCs) a minimal stack based extensible programming system accepting tokenized source code. seedForth can be extended in various ways: as stand alone applications, as fully interactive systems, as umbilical target system for embedded system's programming

We try to use Forth wherever possible in order to minimize semantic and formalism mismatches. Everything should be readily available - no hidden secrets.

Of course many of the subjects we are looking at have been used by others in the Forth community and outside - we are dwarfs standing on the shoulders of giants - however we believe our new synthesis to be original.

Our findings in the new synthesis so far can be summarized:

  • high level inner interpreter (EuroForth 2016, [1]) We showed that a traditional Forth indirect threaded code virtual machine can implemented in high level Forth bringing threaded code manipulation tricks to any Forth implementations.

  • stacks for structured data (Forth Tagung (convention) 2017, german. [2]) Stores and handles structured items (strings, queues, lists, stacks) on stack and return stack. No memory required. Shows how terminal input and number output can work without random accessible memory.

  • handler based outer interpreter (EuroForth 2017, [3]) This demonstrates a very simple modular architecture for the Forth text interpreter separating interpretation and compilation actions for parsed tokens by handlers that possible consume and process a token text or pass it on unprocessed.

  • preForth, simpleForth, Forth (Forth Tagung (convention) 2018, german, [4]) Presents preForth, a minimalistic non-interactive Forth kernel that can bootstrap itself, simpleForth, still non-interactive, which adds memory and control structures and \textsf{Forth} a simple interactive Forth bootstrapped from preForth/simpleForth. See below for details.

  • String Descriptors (EuroForth 2018, [5]) We revise different Forth string manipulation facilities and present string descriptors, an intermediate string representation balancing utility and ease of implementation.

  • Regex (part of string descriptors paper, EuroForth 2018, [5]) Presents a simple implementation of regular expressions extended for Forth's demand to detect space separated tokens and intended to be used in the token detection part of handler based outer interpreters.

  • seedForth a minimal stack based extensible programming system accepting tokenized source code. seedForth can be extended in various ways (EuroForth 2018 [6]).

This talk will go into the details of preForth and seedForth and will how the source code tokenizing works as well as how to extend seedForth to become a modern interactive yet minimal programming environment (<1000 LOCs).


[1] Implementing the Forth Inner Interpreter in High Level Forth, Ulrich Hoffmann, EuroForth Conference 2016, Reichenau, 2016
[2] Stack of Stacks, Ulrich Hoffmann, Forth Tagung 2017, Kalkar, 2017
[3] A Recognizer Influenced Handler Based Outer Interpreter Structure, EuroForth 2017, Bad Vöslau, 2017
[4] Bootstrapping Forth, Forth Tagung 2018, Linux Hotel, Essen, 2018
[5] A descriptor based approach to Forth strings, Andrew Read and Ulrich Hoffmann, EuroForth conference, Edinburgh, 2018
[6] String descriptors on GitHub
[7] preForth and seedForth on GitHub


Photo of Ulrich Hoffmann Ulrich Hoffmann