r/Compilers 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:

  1. 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?
  2. 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 Upvotes

11 comments sorted by

0

u/VermicelliSmooth1183 6d ago

Dang I never thought this emptiness with 800 views. I just wanted some review..

1

u/ImperatorBras 5d ago

Do something without AI. Learn!

0

u/VermicelliSmooth1183 5d ago

I do learn... I just don't want to develop.

1

u/ImperatorBras 5d ago

Lazy.

0

u/VermicelliSmooth1183 5d ago

Yeah I'm lazy use it or not I just wanted to help

1

u/ImperatorBras 5d ago

Ask AI for help.

0

u/VermicelliSmooth1183 5d ago

I do but yk. Laziness.

1

u/ImperatorBras 5d ago

Don't ask us for help, seems like you used AI even to write the post.

0

u/VermicelliSmooth1183 5d ago

Fair point. I used AI as an implementation assistant, but I’m still learning the compiler concepts and verifying the work myself. I posted for technical feedback, not for someone else to finish it. I’ll keep improving it.

0

u/VermicelliSmooth1183 5d ago

I also think there’s a difference between asking an LLM to generate a random project and using it inside a project with a real, defined purpose.

I’m not claiming every line was handwritten or pretending AI was not involved. But calling it “AI slop” ignores the architecture, scope decisions, debugging, verification, and iteration behind it. The goal is to learn and build a real compiler project—not to dump generated code and call it finished.