2 ms·
Writing a compiler for a real language targeting a real processor architecture with meaningful optimizations is a very big job -- far too big to undertake just
by johan_larson 10y ago
Writing a compiler for a real language targeting a real processor architecture with meaningful optimizations is a very big job -- far too big to undertake just for fun or just to learn. Simplifying the problem is imperative.
I've done a bit of digging into various approaches and guides. There are a lot of them, because every respectable CS curriculum needs a compilers course.
The one I find most intriguing is by Niklaus Wirth, the guy behind Pascal and Modula-2. In his "Compiler Construction" PDF, he guides you through building a compiler as a series of exercises in a bit over a hundred pages. I get the impression you could work through the guide in 2-3 of weeks full time or perhaps a quarter as a side project.
http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf