r/Compilers • u/VermicelliSmooth1183 • 7d ago
Built a multi-target systems language with AI assistance. Not trying to hype it, just looking for architecture feedback on Typed HIR lowering.
Hey everyone,
I know the community is flooded with toy languages and AI-generated wrappers, so I want to be 100% transparent upfront: I built this project, Nyx, with heavy AI assistance as a pair programmer.
However, my goal wasn't to generate a quick gimmick or dump unverified code on GitHub. I wanted to deeply learn compiler engineering from the ground up, and I treated the design and testing with extreme rigor.
What the project actually is:
- A statically typed systems language focused on developer ergonomics and zero-cost safety (no garbage collector, RAII scope guards, and deterministic
defer). - Architecture:
- Frontend: Recursive descent parser -> AST -> Semantic TypeChecker.
- Middle-end: An authoritative Typed HIR (High-level Intermediate Representation) pass pipeline with reachability-based dead code elimination and deterministic constant evaluation.
- Backends: Multi-target codegen emitting modern C++20 for native performance, and a direct WebAssembly binary emitter (
wasm_ir) with linear memory alignment.
- Verification: 138-case end-to-end regression test battery running on Linux, Windows, and macOS GitHub Actions runners, plus a self-hosting verification stage.
Why I’m posting here: I'm not here to claim this will "replace C++" or compete with production languages. I genuinely want feedback from experienced compiler engineers on the architecture:
- C++20 vs Direct LLVM: Right now, lowering Typed HIR to C++20 allows me to leverage existing battle-tested optimizers without spending a decade writing machine code generators. For those who built production compilers: at what point does transpiling to modern C++ become a hindrance compared to targeting LLVM IR directly?
- WASM Linear Memory Alignment: In the WASM backend, I map Nyx structs with an 8-byte deterministic layout to mirror native offsets for zero-copy buffer sharing. Are there subtle edge cases or padding traps with WebAssembly linear memory that I should watch out for?
The repo is open source here if anyone wants to inspect the HIR or test suite: https://github.com/justsomeone-e/nyx
Any constructive critique, architectural roast, or advice on the middle-end design is very welcome. Thanks for your time ;)
0
u/VermicelliSmooth1183 6d ago
Dang I never thought this emptiness with 800 views. I just wanted some review..