Forth - The New Synthesis Growing Forth with preForth and seedForth
Channel: FOSDEM
Date: 09/11/2020

by Ulrich Hoffmann

At: FOSDEM 2020
https://video.fosdem.org/2020/AW1.125/forth_new_synthesis.webm

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:


❮ul❯
❮li❯preForth (&lt; 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.
❮/li❯
❮li❯seedForth (&lt;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
❮/li❯
❮/ul❯


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:


❮ul❯
❮li❯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.
❮/li❯
❮li❯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.
❮/li❯
❮li❯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.
❮/li❯
❮li❯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.
❮/li❯
❮li❯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.
❮/li❯
❮li❯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.
❮/li❯
❮li❯seedForth  a minimal stack based extensible programming system accepting tokenized source code. seedForth can be extended in various ways (EuroForth 2018 [6]).
❮/li❯
❮/ul❯


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 (&lt;1000 LOCs).


References


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

Room: AW1.125
Scheduled start: 2020-02-02 09:30:00