Riscrithm – An intuitive RISC-V assembler and optimizer coded in Go
Key takeaways
- If you're looking at this, you are probably getting your hands dirty with Riscrithm, a high-level macro-assembly dialect that compiles straight down to pure RISC-V assembly.
- To compile your source code, you'll use the riscrithm CLI tool.
- riscrithm "source_code_file" "assembly_target_file" [-o/--optimize] Source Code: Your Riscrithm input file.
Hey there. If you're looking at this, you are probably getting your hands dirty with Riscrithm, a high-level macro-assembly dialect that compiles straight down to pure RISC-V assembly. Think of it as a bridge between the readability of a high-level language and the raw, deterministic control of bare-metal hardware. Let's dive straight into how the compiler works, the syntax rules, and what's happening under the hood.
To compile your source code, you'll use the riscrithm CLI tool. The syntax is straightforward:
riscrithm "source_code_file" "assembly_target_file" [-o/--optimize] Source Code: Your Riscrithm input file. Target File: The generated .s assembly file. If this file doesn't exist, the compiler will create it for you on the fly. Optimization: Pass -o or --optimize to enable the optimization sweep (more on the compiler architecture later). 2. File Structure & Globals Every Riscrithm file must declare its target section and entrypoint at the very top. These, along with macro definitions, are the only lines allowed to exist completely unindented outside of a label block.