logoalt Hacker News

vidarhtoday at 4:57 PM0 repliesview on HN

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