New Forth Project

I have been working on my own Forth for a while. It is a Token Threaded Forth written in C. That makes it slower but it also creates very compact code, the present system is 16KB in size for a Forth Kernel with 200+ WORDS. I’m ready to go to the next phase which involves creating a Target Compiler that generates 64-bit native code for Linux.

Progress has been slow due to health issues, recently I found the cause on a major issue, headaches 24/7, dizziness, muscle cramps, it turns out that my CPAP machine had some issues and I been suffering from Carbon Dioxide poisoning.

Now that the issue has been temporarily fixed and I feel better I will be getting back to my projects. There are two projects I want to work with;

  1. Create a Forth that generates 64-bit native code with optimizations, and it is easy to modify the generated code and optimizations.
  2. Work with ColorForth and become more familiar with Charles Moore’s latest Forth.

With those two projects in mind, I am investigating several Forth Systems to see if they are useful for the project or to get ideas from them. The Forth Systems that seem on the surface are;

MinForth, a Forth system written in C with some interesting properties, along with 2012 compatible Forth you have a Forth to C translator which might be very useful. It also supports Complex Numbers with a built-in library that can come handy for Ham use as often Complex numbers are needed in designing radios but also in Software Define Radio to represent and process the radio signals. Because of how it’s built it would also make the system easily transported to another CPU that has a C compiler available.

Reda4, a ColorForth System that uses prefixes instead of colors to declare what type is an item, and uses a normal keyboard to create programs. It also has another interesting feature, it has a Forth to Assembler Cross-Compiler which might be handy for experimenting with my own Forth, it is small and with it’s target compiler it might make it easier to migrate it to other CPUs.

Currently, I will be looking at MinForth, which I have installed on several PCs and I compiled it in Linux to be a 64-bit System, so the pieces are working and are ready to experiment with.

Along with these Forth Systems, I will look at the possibility to use C, Clojure. Rust, Pascal, 8th, or Vfx if I have to write the software from scratch, anything goes but I’m hoping one of the above systems is good enough so I won’t have to start from scratch.

Initial testing with MinForth looks good, I compiled a 64-bit Linux version with no problems, I did some initial testing and so far things look good with it;

  1. It is fairly fast, for some text-based tests it’s close to Vfx compiler which is the fastest out there, in other tests Vfx beats it but the speed is more than good enough. Item 6 is very important that Vfx does not support.
  2. Source code is available for the Forth Compiler and the Transpilers, without it it would be useless for this project.
  3. It generates C code with the Transpiler very useful when writing the code optimizer.
  4. Because of using C, it will be a useful tool to migrate to a CPU that has a C Compiler which is pretty much all CPUs.
  5. It has a code stripper in the Transpiler that removes all unused code for minimally sized applications
  6. Compiles to 32-bit or 64-bit code, Linux is moving to 64-bit only.
  7. Compiles to Windows or Linux, I’m moving to Linux.
  8. Supports Complex Numbers, useful for HAM applications and Software Defined Radios.
  9. Supports files and blocks, very handy when dealing with my MC68K projects.
  10. ANS 2012 compatible, neither a plus or a minus, anything from Forth 97 to ANS 2012 , comfort, eForth, ColorForth compatible is OK by me.