Developer Alexander Williams has written and released a “tiny hand-written” port of the Forth programming language to the low-cost Longan Nano RISC-V microcontroller, using only RISC-V assembly — and it’s called FiveForths.
“I fixed the compiler and now FiveForths is fully functional,” Williams writes. “When I say done, I mean ‘fully functional.’ There are still some optimizations and improvements I want to make in the future, but so far it’s just about ‘done.'”
First released in 1970 by Charles H. Moore, Forth is a stack-oriented programming language that failed to make inroads in the early home computing market against rival BASIC but which found itself a niche in the embedded sector — including use in various space applications, from astronomy to the Philae space-faring robot developed by the European Space Agency to deliver the first-ever non-destructive landing on a comet nucleus.
FiveForths is a hand-crafted port of the Forth language to the RISC-V ISA. (📷: Alexander Williams)
Williams’ desire to create his own Forth implementation for the free and open source RISC-V instruction set architecture began in November 2021 — though only lasted a month before other priorities took over. Williams picked the project back up in November 2022, and has now successfully got the project up and running on the low-cost 32-bit Longan Nano microcontroller.
The project is notable for having been hand-crafted in RISC-V assembly, and for its compact size — ideal for microcontroller use, where resources are typically constrained. The source code is available on GitHub under the permissive MIT license, while Williams has penned a series of “Devlogs” covering major milestones in the project on the FiveForths website.