Three-Quarters of a Forth

Possibly the smallest “real” programming language implementation ever, milliForth is just 380 bytes, making it suitable for tiny platforms.

Nick Bild
6 months agoRetro Tech
Coding "Hello, World!" in milliForth (📷: fuzzballcat)

Forth, a stack-based programming language, was developed in the late 1960s by Charles H. Moore. Initially designed for controlling telescopes, it soon found its place in embedded systems and other applications where efficiency and compactness were crucial. Moore sought to create a simple yet powerful language that could be easily ported across different platforms, making it highly suitable for low-level programming tasks. One of Forth's distinctive features is its reverse Polish notation, wherein operations are expressed in a postfix form, making it highly suitable for stack manipulation.

The language gained traction in the 1970s, finding favor among hobbyists and professionals alike due to its efficiency and portability. Its minimalistic design, with a small set of core words, facilitated the creation of domain-specific languages and the building of custom applications. As a result, Forth was used in a variety of fields, such as embedded systems, real-time control, and scientific computing. Its suitability for low-level hardware interaction and the ability to write concise and efficient code led to its usage in numerous applications, especially in the realm of robotics and telecommunications.

Over the years, Forth has maintained a niche presence, appreciated by a dedicated community of developers who value its simplicity and direct access to hardware. Today, the language is little used, but that does not mean it is without value. The extreme flexibility and low-level access to hardware provided by Forth could make it an ideal platform for hacking away at modern microcontrollers, for example.

And if that is the sort of thing that you are into, then a recent project by GitHub user fuzzballcat called milliForth may be of interest to you. milliForth is an implementation of Forth that consumes only 380 bytes of storage. That makes it small enough to run this powerful, if odd to the modern developer, language on the tiniest of hardware platforms.

Written in about 250 lines of x86 assembly language, milliForth was designed to be very similar to the 512-byte sectorFORTH implementation. The modifications that reduce the size do not necessarily make it more usable — error handling was made very sparse, for example — but they do make milliForth the smallest “real” programming language implementation ever, according to fuzzballcat.

The GitHub repository provides a brief overview of the words that are available for use in this implementation. There is also a guide that describes how one can get milliForth up and running via QEMU, and a "Hello, World!" program is available to test things out quickly for those that are not familiar with Forth yet. All of the source code, and an assembled binary, is available for download under a permissive license.

Whether you want to add a new hacking tool to your repertoire, or just poke around and have some retro-inspired fun, milliForth is worth checking out.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles