If we are exploring a compiler redesign in zig... I would like to try and put together some high-level design documentation to help us top-down engineer this thing. I want to look ahead at the things we know we want and need and try to plan a little for them; even if they may not be the first things we implement.
To be clear -- I think it's really important to build the smallest subset of features end to end first. We can be sure we have a solid testing and debugging approach before we start adding more complexity into the mix.
The key question I have at the moment is; "what is the smallest subset of features, and why?"
I think we can figure out the overall structure, the key functions, and the interfaces between the stages.
We've accumulated a lot of things that we know we want to remove, and also features we want to build... so it would be helpful to compile a summary of these.
I'd like to compile a wishlist for each stage -- so we can step back and look at what we have.
If you have any thoughts, or can think of things we've mentioned related to the above. Can you just drop them in this thread (even if it's just a vague dot point summary) -- and I can start putting it all together.
Put the stages into a single page...
Roc Compiler Stages 1-page v1.svg
As a note, for the new compiler pipeline, I think the plan is to start with only gen-llvm and the interpretter. No gen dev or gen wasm.
kk I'll update it.
Roc Compiler Stages 1-page v2.svg
As much as it wouldn't be as fast as a direct-to-WASM compiler, using LLVM for WASM gen should be fine for now
If you want compilation speed, you use the interpreter
Hmm, though I guess wasm doesn't have access to a file system, so maybe that doesn't work. Not sure.
Though theoretically it could be just like loading a bunch of js scripts, but instead of js they are roc files and converted into wasm
Last updated: Jul 06 2025 at 12:14 UTC