A few people have been asking me how to learn how to write compilers.
After all, when I studied they didn't require me to write a compiler, but they didn't teach much about how to write them either, so how did I do it?
I went to the university library and got the Dragon Book. But I didn't have time to read it before I had to return it, so I can't say I've actually read it though. Since I was still interested in writing a compiler when I had to return the book I figured I had to get some documentation that could stay with me (and at the time I didn't have the money to buy any book) so I yahooed a bit and found some resources about recursive descent compilers and printed it out (the original site I used was of course not wikipedia, but it doesn't seem to be available anymore, at least I can't find it - it was some university course in a South African university if I remember correctly).
So, armed with some a little bit of knowledge and much patience I started writing, and here I am today, with a compiler that's actually working on such weird architectures as ppc or s390x.
It sounds easy and for me it wasn't really that hard (the head-aches I got a few times were usually because of the buggy and lacking Reflection.Emit from MS - this could probably have been avoided had Jb Evain written Cecil a few years earlier).
However I certainly didn't think I would get this far when I started!
No comments:
Post a Comment