Hacker News new | past | comments | ask | show | jobs | submit login

> Beginner compiler writers don't need to know register allocation. They need to understand how to think about language translation, how to write an intermediate representation, how to learn a target language.

I don't think people that want to write a compiler want to end up with helloworld.c instead of helloword.exe. At least I don't.




At least for me, compiling to a simpler target made learning the ideas easier. Compiling to to raw assembly does give you more nerd credit but it also makes it harder to get started.


The opposite, really. I started learning about compilers because I wanted to implement my own syntactic ideas. Don't care at all how it runs.


That's what interpreters are great for.


Ideally, you'd emit LLVM IR or some similar bytecode or assembly. Then you'd use llc/opt or an appropriate assmebler to get an executable.

Trying to emit machine code isn't too interesting when you're writing your first compiler.


Similarly, trying to parse C++ isn't too interesting when you're writing your first backend.


The creator of C++ would disagree, as C++ was devised as a compile-to-c language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: