This Week-Long Hacking Project Gives Your Arduino Uno a FORTH Programming Environment
Fitting a full FORTH environment in just 2kB of RAM is impressive — and now Athanasios "Thanassis" Tsiodras understands the Jupiter Ace.
Embedded software engineer Athanasios "Thanassis" Tsiodras, PhD, has launched a project to put a FORTH programming environment on an Arduino Uno — in just one week.
"It was raining hard, a week ago," Tsiodras writes by way of introduction to the project. "And what could you possibly do on a rainy Saturday afternoon? Well... You can make a Forth interpreter/compiler from scratch... then put it inside a 1.5$ Blue Pill microcontroller... and finally, inside an Arduino UNO... within its tiny 2k RAM!"
"I haven't done anything even remotely close to this in decades... I loved building it. The rainy afternoon turned into a week-long hackfest: [I] was looking forward every day to the post-work FORTH-tinkering in the afternoon."
The result of Tsiodras' efforts: an ultra-compact implementation of FORTH, the procedural stack-based typeless language developed by Charles H. "Chuck" Moore and released to the world way back in 1970.
Despite being designed for extremely resource-constrained devices, it's a fully-functional FORTH including: Basic arithmetic; star-slash double-word accurate multidiv; literals; constants; variables; string printing; resetting; comments; nested DO/LOOP; comparisons; nested IF/ELSE/THEN' and functions - or, as the FORTH terminology would have it, "words."
"I thoroughly enjoyed building this," says Tsiodras. "I know full well that Forths are not supposed to be built in C++; they are supposed to be built in assembly, and also, utilize the Flash to store the user-compiled code at run-time. But that wasn't the point of this — the point was to have fun and learn Forth."
"What better way to learn a language... than to actually implement it! And... as a child of the 80s... I now know first-hand what Jupiter Ace was about," Tsiodras adds, referring to a FORTH-based home computer released by Jupiter Cantab, a company made up of former Sinclair Research staffers Richard Altwasser and Steven Vickers.
Tsiodras has written a blog post detailing the project, while the source code has been published to GitHub under an unspecified license.