2 ms·
I can also highly recommend the Coursera Compilers class. Sign up for it after it's over, and just work through things at your own pace. The provided scaffoldi
by zellyn 11y ago
I can also highly recommend the Coursera Compilers class. Sign up for it after it's over, and just work through things at your own pace.
The provided scaffolding code is either Java or C++, but with a bit more work, it's perfectly reasonable to re-write it in whatever language you desire. Here's mine, in Go: https://github.com/zellyn/gocool https://github.com/zellyn/gocool
Admittedly, it is the world's dumbest compiler (uses a single register, and there's no optimization), but it's still fun to actually "slay the dragon" and stop believing that only wizards can build a compiler. :-)
- pjmlp 11y agoWhen I did my compiler class at the university, our professor teached us a nice way to do dumb compilers, that I always suggest as learning process. Generating bytecodes in a suitable text format, that can be either be easily validated and executed with a dumb interpreter, or translated into machine code via a Macro Assembler. Surely the code performance sucks, but it gives the students the gratification of producing something that executes real machine code and that they can show off to their friends.
- mpd 11y agoI want to second this. I'm in the middle of this course right now. It has a lot of theory, which may not be terribly interesting if you just want to learn to build a compiler, but it's complete and the language you're building the compiler for has a little bit of everything.