Why has this blog so many articles about Forth?

According to the keyword cloud on the right navbar, many articles were published here in the trollheaven blog about the lovely programming language Forth. It’s more than about Python but equal to the number of C++ blogposts. What is so interesting about the Forth language, that so many content was published? I don’t know, according to the raw numbers, Forth is a boring language. It is on the last place in the TIOBE ranking and only the APL language (Dyalog) is more esoteric than Forth. According to github only a small amount of software is available in Forth. The main reason why this language is so fascinating has to do with minimalism. The idea is, that the programmer has to invent everything from scratch. If he needs something known from other languages like a variable, an array, a class or a graphics library he can be 100% sure, that Forth doesn’t provide it. Until he gets the needed feature working, the developer will read endless online tutorials and has to deal with many parsing errors from his Forth engine. Forth isn’t an easy going language like Python or C++, Forth is an experience.

The best mindset to get familiar with Forth is a situation in which a virtual machine was realized from scratch. That means, the language contains only these elements the programmer has implemented first. That means, this new language hasn’t a handbook because the language doesn’t exists right now. This is the main attitude behind Forth. Let us explain the concept of a virtual machine interpreter in detail.

The idea is that the programmer creates in Python a class called VM. This class is as default empty. Then the programmer creates some high-level commands for the VM, for example “add”, “sub”, “load value”. Answering how to program this VM is very easy. If somebody is asking how to start a for loop in the newly created VM the answer will be: it’s not possible, because the VM doesn’t provide a subfunction called do-loop.

A current Forth implemention like the ANS-Forth standard can be called luxury. In contrast to a newly developed VM it has some basic functions like do-loops, variables, if-then-statements and the ability to define words. This makes programming much easier. Not in comparision with C++, which provides much more features, but in contrast to a VM from scratch.

The basic memory model of Forth contains of a dualstack (datastack, returnstack) and a memory. If we would realize this concept in a Python class we would create for the stacks a list and for the memory an array. On these elements all the operations take place. If we want to reset everything, we simply delete the stacks and the memory and the situation is cleared. In the computing theory, this simple setup is called a pushdown automaton. It’s a bit more complicated than a state-machine but it’s major advantage is, that it’s programmable. For this kind of minimalism, Forth can be called a bullet proof programming language. It doesn’t provide anything and programing in Forth means to start from scratch everytime.

Forth has a major limitation which is the pushdown automaton itself. That means, any Forth VM contains of a tape and two stacks. On the tape, information are stored, while the stacks are used for calculating a command. This precondition is called a deterministic turing machine, it’s a computer, but nothing else.

Advertisements

How fast is Forth?

Benchmarking is an interesting game to compare different systems. It’s possible to benchmark Windows vs. Linux, the G++ compiler against the LLVM compiler or somebody can benchmark C vs. Python. In any case a numerical value is the result which makes it easy to determine the winner. In classical computer language, the C/C++ language is the fastest one. Programs written in that language are running faster and needs less memory than programs written in Turbo Pascal or in Perl. That’s the reason why C/C++ is declared as the queen under all programming languages. It’s an industry standard for compiled language.

The interesting fact is, that up to day no other language was able to beat C/C++. Java is often cited, but Java isn’t a compile language and the resulting programs need more memory. Also Rust or go can’t compete with C/C++. They have tried it, and some proof of concepts in writing an operating system in Java or Rust were undertaken, but it’s not a valuable choice over C/C++.

This makes it easier to get an overview over all languages. We can focus on C/C++ and ignore all the other. That means, Python, PHP, or Lisp are all nice to have languages, but compared to C/C++ they are in a weaker position. And now we can ask the really important question: how to beat C/C++.

A possible answer is, that Forth is superior to C/C++. Such a comparison is not taken very often, but at least the Forth community would agree. Are they are right? Let us take the well known principle of benchmarking to prove the point. We are realizing the same algorithm first in C/C++ and then in Forth. Now we can compare the speed. The result is, that the Forth program will take longer. Most Forth enviornments are providing only an interpreter, comparable to the Python VM. Such a Forth interpreter runs 10x slower than compiled C++ code. Some more advanced Forth systems provide a compiler. Even compiled Forth code is not able to beat C/C++ in measurements like speed or memory consumption. The best Forth compiler available is a bit slower than the C/C++ counterpart.

On the first look the conclusion seems obvious. C/C++ is the queen of all language, and Forth can’t beat it. But, let’s take Forth a bit more seriously. What the Forth community is doing isn’t compare Forth against C/C++, no, they are using Forth for measuring the performance of hardware. They are doing so, because from a much higher point of view, Forth is superior to C++ and the benchmarking game is played in a different way. What does it mean?

A C/C++ compiler and a Forth compiler are translating sourcecode in binary code which can run on the machine. The best compiler will produce optimal assembly instructions. C/C++ are nearly perfect. The latest iteration of the GCC compiler in the version 9 is able to produce nearly optimal code. That means, even if somebody is trying to program in Assembly language he won’t be able to run the program faster. A good Forth compiler will only produce the same assembly instructions. That means, it’s technical not possible to beat C/C++. The bottleneck isn’t the programming language but the underlying hardware. And here comes Forth into the game. Forth is some kind of reference programming language which runs on all computer systems. It’s possible to write a prime number test and let the program run on a Z80 cpu, a 6502 cpu, an x86 CPU and on a FPGA softcore Forth CPU.

The reason why such benchmarks are made is not to determine if Forth is reasonable fast, but the question is, if the x86 cpu is fast enough. And the answer is no. Forth will answer the question why x86 CPUs are slow. The main reason is, that the CPU and the RAM have a large distance on the motherboard, and all the transistors in the microchip are using a lot of energy. The open question is not how to improve the compiler speed by 10%, the question is which kind of hardware is the optimal choice for running Forth sourcecode.

And here is the reason why Forth is superior to C/C++. C/C++ programs can only be tested on machine which are the target of the compiler. C++ code won’t run on the Z80 or on self created FPGA softcore cpus. And especially C++ code won’t run on stackbased CPU. In contrast, Forth will do without any problems. That means, Forth is some kind of universal benchmark which can speed-testing everything what looks like a computer. On classical computer designs like the x86 CPU, Forth will reach the same speed like C/C++ compilers, in most cases Forth is 10% slower. But on new systems, Forth will be the only available language which can answer the question if a new processor is working fast or not.

Learning Forth the easy way

The main question is not, what Forth is or if Forth is a great language, the more interesting problem is how to learn Forth. There are some people who are Forth experts and other’s how not and the question is how to find a way in mastering the language. The starting condition isn’t very great. Forth is different from other languages like C++ and Python and the amount of tutorials about Forth is low. Another problem is, that in each tutorial a different kind of Forth style is explained so it’s hard for a beginner to grasp the general idea.

I have recognized two helping techniques which are right in every condition. The first hint in tlearning Forth faster is to use verbose commands which are: .s f.s and dump. The first two are used to print out the stack and the float stack while the last one prints out the content of the RAM. The reason why the verbose mode is useful has to do with that the Forth syntax isn’t very readable. That means, a program contains of statements but what these statements are doing is unclear and in case of doubt the beginner will create a bug in the statements so that the program is doing something wrong. It helps a lot to go line by line though the code and this can be done very easily if the content of the stack and the memory is pjrinted out to the screen. The good news is, that apart from the stack and the memory no hidden values are there. That means, if the program has a bug, it has always to do with one of these.

The second hint in learning Forth fast is to ask questions at Stackoverflow. Especially dump questions are helpful. The interesting result is, that even if nobody answers the question because Forth is an esoteric language it help a lot to get the birds eye view. If the question is online, it is very likely that the questioner finds the answer by himself. The reason is, that before somebody can post a stackoverflow question he has to write down what exactly the problem is. And this helps a lot to understand the it in depth.

Learning Forth is some kind of social game. The asker has no idea what Forth is. That means, his question is wrong and shows a lack of expert knowledge about concetative languages in general and Forth in detail. While the other side who is able to answer these question has a deep knowledge of Forth. Stackoverflow helps to bring both sides together. They can learn from each other.

Dumpting the memory

Programming languages like Python are sourcecode oriented. The algorithm is given the python statements. For example, at first the user creates a new array, then he fills values into the list and then he prints out the list. Bugfixing a Python program is done in the sourcecode. That means, the developer has to scroll through the code and he will recognize the error.

Forth works a bit different. Most Forth sourceode looks not readable. Only the forth interpreter understands the meaning. This makes it hard for bugfixing code, especially if the programmer is new in the language. On the other hand, all Forth programs have something in equal. They are written against the stack and against the RAM. That means, if a Forth array was created by a statement, the array is available in the RAM and the memory can be dumped to the screen. The same is true for complicated stack-related statements. A command sequence like “2 3 swap dup + “ can be traced in the single step mode by printing the content of the stack to the screen with the “.s” command.

The interesting feature of the .s and the dump statement is, that it’s useless for the Forth VM itself, but very important for the programmer. It allows to identify what the own written code or the code by other is doing. And perhaps this is an advantage over C++ and Python. What non-Forth languages are doing in the background is unclear. The programmer sees only the sourcecode (which is in case of Python easy to read), but the memory and the stack is hidden from the user. Instead the user can put a print command into the Python program to show the contents of variables, but this is not the lowest possible layer. In contrast, the verbose commands in Forth are showing very precise what is going on in the memory.

Let us try if we can use the verbose commands for storing something into the RAM:

\ prints out the content of a string
create textmessage 10 allot
textmessage 10 dump

\ puts the pointer to the textmessage and a string to the stack
\ and shows the stack
create textmessage 10 allot
textmessage
s" hello world" 
.s

\ creates a pointer and stores the string at this address
\ the dump command verifies if everything works fine
create textmessage 10 allot
textmessage
s" hello world" 
textmessage !
20 dump

\ something went wrong with storing the string
\ the string is not at the right place
\ a simpler example with storing integer numbers works better
create numbermessage 10 allot
numbermessage 10 dump
8 textmessage ! 
numbermessage 10 dump

The Forth statements are put together in a step by step workflow. The first task was only about printout out the content of textmessage pointer. We’ve recognized that no text is there. Then, I added additional statements which are able to store a message in the newly reserved space. The dump statement was used again to verify if the program is working correct.

How to speed up Forth programs

Forth has the perception, that it’s a slow language. It is based an subjective assumption but can be measured with hard data. If we are running a for-loop algorithm first in C++ and then with the gforth interpreter, the result will be that the C++ binary code ruhs at least 3 times faster. Even a so called native Forth crosscompiler which produces similar to C++ an executable file will always be slower than the same algorithm realized in C++. The reason is, that the stack access has to be mapped to the CPU which doesn’t work very good. In contrast, C++ uses the register based CPU with more efficiency, that means C++ is the faster language.

Forth has lost the performance race against C++, right? Not exactly. Let us declare Forth as the champion, and later try to deliver a faster performance. How can the speed of a Forth program be increased? A typical Forth program contains of RAM access. That means, if an array is put on the stack and a word is iterating through that array it is an endless number of RAM access. This slows down the program. The same is true, if a word is called. The definition of the word is stored in the RAM of a computer, and it takes a bit until the next statement is fetched from the memory. The upper limit of speed is determined by RAM access speed. Before the CPU hasn’t retrieved the value from a memory cell it can’t figure out what to do with it.

The best way to improve the speed of Forth is to increase the memory bandwith. The reason why the RAM is so slow has to do that the RAM and the CPU are separated in different locations on the motherboard. The CPU is at least 20 centimetrer away from the cpu, the better idea is to put into the same location. In case of the Propforth homecomputer which is based on the Forth language the situation is much worse. No RAM is available in the system but only a sd card. Every RAM access is equal to a read-access to the slow flash memory. The better is called “Systolic Computational-Memory Architecture” or short https://en.wikipedia.org/wiki/Computational_RAM The idea is to combine the CPU with the memory. This will increase the system speed.

The importance of the RAM is not very often discussed in the Forth literature. The focus is on the stack. But the stack itself is useless. In most Forth systems it is only 16 cells deep. It can’t hold an array, it can’t hold a program. In contrast, useful applications like a computer game contains of large amount of sourcecode and endless numbers of textures which are stored in the RAM. The same is true for database applications and video editing. It is all data, and the Forth stack is too small to hold the information. That means, real life applications are using very much the RAM. They will need 2 gigabyte at minimum and larger applications will need 2 terabyte of RAM.

The question is not, how to compile a Forth word into a binary code, the question is how fast the CPU and the RAM are communicating. This defines the overall speed.

SIMD

Some Forth VM have support for SIMD instructions. This will result into a speedup of around 4x. That means, using SIMD is 4x faster than not using it. The problem is, that Forth is slow because the underlying assembly instructions are slow. Forth is a virtual machine which is using the mnemomics of the CPU and if the CPU takes endless until the data are transfered into the cpu Forth will take endless.

What i want to tell is, that the maximum speed of conventional hardware is determined by the hardware. What software programmers can do is to program on an assembly maximum. That means, the best assembly programmer can reach a certain performance, the best C++ compiler won’t be faster and the best Forth compiler won’t be faster too. The potential benefit of Forth is that it can be used on non-conventional CPUs as well. That means for testing out new sort of hardware. Suppose somebody has constructed computational RAM in which the RAM is very close connected with the CPU and the hardware speed is better. The first programming language which is available on that system is Forth, because Forth is easy to parse. That means, a Forth which runs on modern hardware is faster than a Forth which runs on x86 cpus.

Why a Forth operating system make sense

I’ve researched a bit existing Forth operating systems. In the Internet the following projects were done in the past: Diesel, Cy/VOS, iTV 4os, Graphical Forth Operating System. The similarity is, that in most cases the old websites or offline and the sourcecode is no longer available. According to the description of the Diesel project, it was realized with 1200 lines of code in Assembly language and implemented a minimalistic featureset. The difference between a Forth VM and a Forth OS is, that the later own boots natively in the qemu emulator and a Forth OS usually contains of tools like an assembler, a GUI, filesystem access and a multitasking environment.

So what is wrong with Forth based operating systems? Nothing, it is a great idea in doing so. The only problem is, that in the in the past too little energy was invensted into the direction. The idea is perhaps, that Linux is a great operating system and there is no need for a Linux clone in Forth. But this assumption is wrong. Suppose a Mini project gets started, not by a single person but by a small team. If they are familiar with Forth, they can create in a reasonable time a QNX like operating system written in Forth which comes with a browser, a shell, a Forth VM, a filesystem and a network stack. I would guess it takes more then 1000 lines of code. The only known example is the iTV 4os which fits in 128 kb ROM.

Let us compare a fictional Forth OS with a normal C based operating system, what is the difference? At first, a Forth based operating system is not faster. In most cases the speed will be the same or a bit slower because less optimization was done. It is not possible to let the CPU ran faster with the Forth language. Because internally a Forth VM is programmed in assembly language. But, an operating system written in Forth can be ported to non x86 cpus, for example the J1 cpu. This is not possible with a c based operating system. And a Forth CPUs is more efficient. That means, writing a Forth OS for the x86 CPU is the prestep to a more advanced project.

The second difference to a normal C based operating system is, that in a Forth OS no C software can be started. There is no C compiler available, that means, existing software written in C/C++ can’t be compiled for this architecture. All additional software has to be written from scratch in the Forth language. This allows the community to create better software from the beginning. It means, that no existing standard-c library will be available and no standard graphics library is there.

This will increase the entry barrier. It is no longer possible that everybody can contribute to the project, but the precondition is, that the programmer is familiar with Forth. Forth makes it more hard to write non-working code. Forth software has the tendency to become very efficient. A stackbased language is easier to control. That means, a single word is using the stack only and nothing else. It can be analyzed for correctness. And because the total amount of codelines is lower, it is possible to investigate the complete operating system by hand. That means, a single person can print out the complete sourcecode and go through every line for search for a bug and fix it. This is not possible with Linux or Windows based operating systems.

Perhaps a small calculation. 100 lines of code fits onto a single sheet of paper in the twocolumn layout. A program which contains of 10000 lines of code will need 100 sheet of paper. It is possible to optimize this amount of code for maximum speed and for error-free behavior.

The bottleneck for a Forth operating system is the integration into existing C codebase. A Forth os would be some kind of hard migration because the software from the past won’t work anymore. That means, software applications like databases, wordprocessors and so on have to be rewritten from scratch. A soft transition strategy would be to write first the applications (for example office software, database and a webbrowser) in Forth and compile them to run it under Linux/Windows. And only if a large software repository in Forth is already there, it make sense to write a dedicated operating system to let them run without Linux/Windows.

Writing an operating system not in Forth, why?

Apart from mainstream operating systems like Linux and Windows, many small projects were developed in the past with the aim to create an operating system from scratch. Github has surprisingly much entries in the list. Most of the examples are written in C, but some of them are using C++ and Rust. What all these projects have in common is, that they are providing OS features like a filesystem and multitasking and they can get booted in the qemu environment. Some of the more advanced examples even provide a GUI and a dedicated package manager.

It seems, that developing an OS with the C programming language is not very complicated and many developers have done in the past. But why haven they are choosen C and not Forth as the programming language? On the first look, the difference isn’t very much. On the other hand, github doesn’t have an extensive list of operating systems written in Forth, so it’s seems that a Forth OS is more complicated to write and is not the preferred choice. On the other hand, Forth would be the right programming language. Because Forth teaches a lot about computer science.

It seems, that the mainstream loves the C programming language. And the mainstream loves also to write a lot of new and unconventional operating systems from scratch. Sometimes, this is done even in Assembly. On the other hand, the mainstream hates Forth. Operating systems written in that language are rare. So it seems, that non-stackbased computers are better suited for the needs of developers?

OS development in Forth

On the first look, the idea sounds uncommon to write an operating system in the Forth programming language. Technically it seems possible, but the amount of projects which have done so in the past is very small. Most Forth VM like Gforth or win32forth are running on top of an existing operating system. But in theory, it is possible to write even the OS in Forth.

Like in the hen egg problem the problem of bootstrapping the development process can be overcome with adapting a partial solution from a similar domain. It is right, that no tutorials are available with the title “Create your own Forth OS from scratch”, on the other hand there are many (i would guess more than 100s) tutorials available with the title “create your own operating system with Netwide Assembler and with C”. The pleasant thing is, that in these tutorials lot of background knowledge is given about bootsectors, assembly coding and the BIOS of an IBM PC. What the Forth beginner can do is to take a mainstream “OS from scratch tutorial” and adapt the content to their needs. Instead of writing the OS in assembly language, he has to use a Forth VM.

For doing so, the user has to combine two different topics: First, his knowledge about Forth programming which is given in some books. This knowledge contains of stackbased language, Forth based virtual machines and threaded code execution. On the other hand, the user will need detail knowledge about operating system writing. This knowledge is given in tutorials too and was created by non-Forth programmers in the past. An example tutorial is https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf but many similar examples are available. The common property in all of these tutorials is, that the Forth language wasn’t mentioned. The assumption is, that the Assembly language for the first steps, and for programming the higher layers of the OS a C compiler is in charge. The funny thing is, that operating systems are working in Forth the same way. That means, it is also bootsector programming and has to do with BIOS interaction.

Forth is a virtual machine for executing a program

Jonesforth is a well known Forth implementation. A more recent Forth implementation is called lbforth and is given here https://gist.githubusercontent.com/lbruder/10007431/raw/4b87f81da0adddbf38c7531d6325f6b513cb5e47/lbForth.c What is special with this Forth VM is, that the system is not very fast, but is programmed in C sourcecode. It explains very well what Forth is. According to lbforth, Forth is C file which is 27 kb in size. For testing purposes it is possible to remove all the comments, then the filesize will shrink to 24 kb and around 1000 lines of code. What can we do with the code? The first step is to compile the c file into an executable binary file. This is done with “gcc lbforth.c”

And now comes the magic: after executing the binary file, we get our own Forth virtual machine. In the VM we can enter Forth commands and define new words. That means, lbforth is similar to a Java virtual machine except that the amount of sourcecode is very little. The reason why Forth is fascinating is not because of the language itself, but because the implementation of the language as a virtual machine is an easy task.

lbforth isn’t the only Forth VM available. In the past many Forth VM were created. Some of them are programmed in C, some in Assembly language while other are realized in Forth itself. That means, before somebody can run such a Forth VM he needs first another Forth VM. From a technical perspective lbforth isn’t very advanced. The performance is low and important words like the LEAVE command for leaving a do loop are not realized. But the project shows in around 1000 lines of code, what the idea of Forth is. Perhaps Forth is the only language, which can be realized in 1000 lines of code and is useful at the same time. So called esoteric languages like brainfuck can be programmed as a Virtual machine in less codelines, but writing programs in Brainfuck is not possible. While mainstream languages like C and Java are very comfortable, but to realize an interpreter or a compiler for the syntax is a demanding task.

Stackbased language have the advantage of a minimalistic design. This is important in analyzing algorithms from a theoretical perspective. Suppose the idea is to construct a prime number generator which is using parallel computation. Sure, it is possible to write the sourcecode in the c programming language, but the better understanding is given in the Forth language. For example, the number 113 can be tested if it is prime or not. We are starting two programs at the same time. program one is testing all the numbers from 2 until 30 while program two is testing from 31 to 60. Both programs doesn’t need access to the memory, it can be realized with stack manipulation only. Programming and realizing such algorithm in hardware is more easier than the same task in the C programming language.

The similarity between most Forth VM interpreter is their small program size. The above mentioned lbforth compiles into a 30 kb executable. Other Forth VM are using not more than 5 kb. Most programmer find it hard, to program on top of Forth high-level application. The reason has to do, that Forth doesn’t provide advanced arrays or object-oriented programming. But from the perspective of implementing a compiler, Forth has the top ranking. No other programming language can compete with Forth on this point.

The only bottleneck Forth has, is the amount of sourcecode written in Forth. In contrast to C++ no large codebase is available at github. This makes it hard for using Forth in real projects. For example, if somebody needs a texteditor in Forth and has only access to github, he will discover that no out-of-the-box software is available. That means, he has to write the texteditor from scratch, and this holds most people back in using the language.

Learning Forth fast and efficient

The good news is, that the Forth language itself is well suited for programming software. Forth can be compared with C but only with less luxury. Like in C, there are not built-in types for object-oriented programming, if the programmer needs that feature he has to build his own object-oriented extension. C makes the usage of arrays very easy, Forth doesn’t even have arrays. But it’s possible to emulate that feature with Forth too. That means, the programmer has to calculate the memory address in which the values are stored by subfunction.

Even the Forth internal stack is not very complicated. Sure, the IF construct works in Forth different than in C, but with a bit manual debugging, it is possible to create in Forth all the same if-then-statements like in any programming language. What makes Forth hard for most developers is the lack of standard libraries, and a situation in which Forth is used at a barebone metal PC, because in such a situation, Forth has to provide the filesystem, the networking connection and the display driver too.

The best way in learning Forth is trying the language out. What Forth has in common with other languages is, that only the language itself is provided but not the algorithm to solve certain problems. If somebody doesn’t know, what Bubblesort is, he will get problems in implementing it in Forth and C. That means, a programming language only provides basic building blocks like functions, for-loops, if-then-statements and variables, but combining these features into useful software is something which is done on top of the features.

The obscurity of Forth is in reality smaller than it looks from the outside. The main reason why Forth is perceived as a complicated language is a mixture of:

– well working existing languages like C++ and Python which provides everything what the programmer need

– missing documentation of Forth plus missing example sourcecode

Forth is often introduced as a stackbased language which is working different to other programming languages. Yes, Forth has a stack, but Forth remains a normal procedural oriented programming language. That means, there are functions, variables and for loops, and the programmer is combining them together into useful code. Forth is harder to learn than other languages, that is right. But writing code in Forth after a while is not very hard. The main bottleneck is not the language itself, but the algorithms.

What makes Forth unique in contrast to Golang, C# or Java is that using existing libraries is either technically not possible or is a sign of bad coding style. The typical C# programmer is asking which libraries he can use, because he want’s to increase his productivity. C# has libraries for string manipulation, graphics, sound and networks. Forth has not a single library. Everything has to be invented from scratch. And the joke is, that even if somebody has written a string library, nobody else will use it.

The number one question for Forth beginners is how they can manage complexity without existing libraries. The answer is, that in mainstream programming languages, libraries are overestimated. For example, Graphics libraries are providing a huge feature-set for drawing all kind of shapes to the screen. The Forth way in doing the same task is to identify the graphics memory and store the pixelvalue direct to the screen. This is done with a newly created word. On top of this word, extra words for drawing lines, drawing rectangles and drawing circles are created. That means, a Forth programmer has to invent his own graphics subsystem. The main reason why Forth is fascinating is because the language motivates the programmers in doing so. That means, during the development, the developer has to read a lot about a subject. And if the Forth code is written he is an expert for drawing primitives.

The main reason, why developers are using Forth is not because they want to solve problems with that language, but they want to learn something about programming, hardware and computer in general. Such projects are motivated by knowledge acquisition. That means, if somebody is interested in compilers, he can write a Forth program and after 6 months he will know very much about compiler writing. His Forth program won’t be working very good, but nobody cares because Forth is some kind of sandbox in which new ideas can be tested out. The same is true for hardware designs, new operating systems, databases and so on. Forth encourages the people to trying out new things and build their own software system from scratch without using out-of-the-box tools written by somebody else.

Let us compare Forth with normal Linux development. The typical Linux developer is using an Intel CPU invented by Intel, he will utilize the C++ compiler from the GNU project, the Linux kernel from Red Hat and the graphics library from SFML. On top of this equipment he creates a game. At the end, around 0.1% of all the codelines are written by the developer itself, but 99.9% were created by somebody else. He has created nothing, instead he takes the work by other and followed the manuals by others. In Forth the relation is the other way around. A Forth program is written with 99.9% by the programmer itself and he has taken nearly nothing from existing repositories.