upvote
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