upvote
>The people contributing to LLVM probably know everything down to assembly generation. they're truly incredible.

Not really. I was webdev who then switched into compilers job with LLVM being foundation

LLVM itself is huge, it is not trivial to be familiar with every it's areas/mechanisms, but writing not-complex passes, bug fixing, regression fixing does not require some fancy knowledge

reply
If you don’t mind me asking, why and how did you make the switch? Going from webdev to compilers seems like a strong U turn that’s not easy to pull off, especially because the resources on compilers out there are extremely scarce
reply
I've been working full time for like 3 yrs as C# dev + doing higher edu at weekends at the same time and I was about to decide thesis topic.

I've been searching for something challenging and found some very random post on programming forums about how compilers are hard etc and decided to give it a try.

I had kind of advantage that I accidentally had some significant amount of experience with handwritten parsers (at first job we were doing custom-markdown-like-language renderer as PoC or even when doing apprenticeship in high school I was rolling out csv parser instead of using libs, because... I'm not sure why, I probably didnt know how to use package manager or something)

I started reading about it a lot like dragon book (but it wasnt that useful tbh, too much math heavy)

or https://www.cs.cornell.edu/courses/cs6120/2020fa/self-guided...

or playlist like this: https://www.youtube.com/watch?v=wgHIkdUQbp0

And after year of jumping into it from time to time I've implemented small, custom-lang to LLVM IR to webassembly (via LLVM) compiler.

Then I had to find new job (we were very poorly paid) and I was interested in semiconductors industry because it was gaining traction (e.g chip war book) and it felt way more engineering oriented unlike web dev. Web dev tech decisions felt for me very religious, like fancy-conferences/blogposts oriented.

And since semiconductor industry often touches compilers, then that was opportunity for: better salary, interesting projects and in future transition to compilers

I've joined semico company as C# dev and then due to project cancellations/lay offs I managed to join compiler team and stress hard during first months since I had to learn new lang, new ecosystem, tools, approaches, techniques (e.g debugging) and only familiar thing was LLVM, which I was very beginner at.

but after that initial shock things were better, but I feel like I still need to improve my knowledge related to modern hardware, modern computer architecture, etc.

Debugging is very, very useful, cross-stack skill :)

reply
Assembly generation is actually pretty simple, it's optimizing everything that's difficult. Writing an assembler is a great way to get acquainted with compiler construction, because you don't need to think about optimization and types and the other features that make high level languages complicated aren't needed.
reply
I actually started my first compiler my allowing (only) inline assembler first, and then starting to wrap higher level constructs around it.

It adds a little bit of complexity (you need to be very clear on how you handle registers) but it worked surprisingly well, and it makes it easy to built up the complexity step by step.

It also meant I could bootstrap the compiler itself with just an assembler.

Sadly I lost the source decades ago.

(Making assembler an integral construct of a higher-level language is also not a unique approach - there's Randall Hyde's High-Level Assembly[1] and others.)

[1] https://en.wikipedia.org/wiki/High_Level_Assembly

reply
I keep saying 'someday...' and never actually doing it because of making a living, but this time I think I should try a few small examples
reply
I fell you, My dream is to build my own compiler for WASM to use it later for my own pet projects. But after 9-5 job I'm exhusted and only able to work for max 1 hour.

But I still have hope that I will make it. Maybe coding agent will help me but I dont like the idea that I need help from AI to build this. I want to create compilers through my own hands.

Anyway, I hope you will make it anyway. :)

reply
Honestly whipping up a lexer/parser and a REPL is one of my favorite ways to learn a new language. You can cover a lot of ground in a "real" language by just doing the frontend implementation of your own made-up language grammar and a little eval loop and its great for learning/teaching because you don't get bogged down in trying to solve some actual problem.

Which is to say: no shame in just settling for that simple C backend!

reply