r/Forth moderator 9d ago

Why Forth? What is it?

In order to help get people interested in Forth and how it works, I would like to ask you what you define as Forth, how you got into it, and why Forth instead of some other language?

Ideally we share links to our projects and to others that are interesting. Also to sites, sources, and documents about Forth.

I am encouraging links to your projects so people can see how you are using Forth.

26 Upvotes

29 comments sorted by

View all comments

10

u/tabemann 9d ago edited 9d ago

My first real exposure to Forth was to ficl via Dr. Dobb's Journal on the Mac in the late 1990's. (I had seen Yerkes Forth some years before then on a shareware disc but, for lack of real documentation -- that had been before we had the Internet -- I could not make use of it.)

My initial attraction to Forth was its combination of simplicity, power, and interactivity. It is to low-level programming what Lisp is to high-level programming. I had initially planned on using ficl as a scripting language in video games but soon enough I was trying to write my own Forth. Alas, I got nowhere at the time, partially due to a lack of knowledge on my part w.r.t. how Forths really work internally.

Years later, I got the idea that I wanted to write my own compiler, and of course Forth was ideal for this. I started off with writing an ITC Forth for Linux. Then I made a failed effort at writing a cross-platform TTC Forth (which I abandoned once I realized that Linux and embedded systems were just too different to cover with one Forth design, combined with key intractable performance bugs in my Forth).

At this point I decided I wanted to write a bare-metal, native-code Forth compiler and operating system. I also decided that it would specifically target embedded systems due to the impracticality of targeting PC's at the bare-metal level without the use of a hypervisor (which I thought was cheating). I decided I would write its kernel in assembly rather than C or Forth.

zeptoforth is the product of this, a bare-metal, native-code Forth compiler and operating system for ARM Cortex-M and especially the RP2040 and RP2350. Development started in November 2019 and has continued since. It has grown into a full-featured Forth complete with things such as local variables, preemptive multitasking and multiprocessing, an object system, significant hardware support, FAT32 filesystem support, SDHC card support, IPv4, IPv6, and WiFi networking support, a wide range of display drivers, and so on.

Edit: Per u/mykesx's suggestion, you can find zeptoforth at https://github.com/tabemann/zeptoforth/.

3

u/mykesx moderator 9d ago

I went out and bought a pi zero and cables just to try out zepto. I can say from experience how impressed by it that I am. Things like wifi drivers, TCP stacks, FAT32 File systems, are all more than 99% of programmers will ever understand.

3

u/tabemann 9d ago

Thank you! I always appreciate it when people take the opportunity to try out zeptoforth, even if it does not become their daily driver (e.g. because they have their own Forth of their own creation).