i am currently making a compiler. i already finished making parsing using the pest crate and i made some custom IR code. but i now need to make a builder. i know already how to create a custom builder, but making the custom IR took long enough, so i wanted to see if there's any cool crates to make my life easier for this. please suggest any crate you guys know, I'd love to see what options would i have.
a builder for the compiler. meaning, something that takes in IR tokens as input, and for every IR token, it returns a String of the equivalent in another language. so for example, this c code:
int main() {return 0;}
could be turned into this IR:
<function> () -> int {<std::return>(int::0)}
and then be compiled into assembly
section .text:
global _start
_start:
mov ebx 0
mov eax 1
syscall ; int 0x80, but simpler
If you want to target WebAssembly, the wasm-encoder crate is one of the most popular, and it's maintained by The Bytecode Alliance so you know it'll be the most up to date.