Forth RV32I Assembler
Here’s an assembler for RV32I that I wrote in Forth. I find the definitions of the instructions and instruction types especially elegant, and I find it to be a great demonstration of how concise and powerful Forth can be.
The Infamous 'link' Macro
Each word (or function, in other languages) in Forth is stored as an entry in a linked list known as the dictionary. When bootstrapping a Forth from assembly, it is your responsibility to create and maintain this linked list structure. This is a tedious process and is the source of many errors when re-arranging words or defining new words; it’s incredibly easy to turn your list into a graph by mistake.