4 ms·
s/The single best resource/Out of the resources I've read, the one I've personally found most useful/ ;) I should also probably add that I only ever read the
by peterkelly 14y ago
s/The single best resource/Out of the resources I've read, the one I've personally found most useful/
;)
I should also probably add that I only ever read the dragon book years after I first started learning about compilers through more gentle means such as the 3rd-year compiler construction course I studied, and a bunch of other reading and experimentation. It's probably better to start off with something simpler. I haven't read either of the two books you referenced; they may indeed be more appropriate for a beginner.
While I haven't used ANTLR, I've used bison & flex, as well as Stratego (which operates on a much higher level and is actually very nice).
I guess it depends on what aspect of compilers you're most interested in and how much depth you want to go into. The dragon book will teach you all about how to write your own lexer + parser generator (which I found quite fascinating), but you don't need to know about NFAs/DFA construction etc. if you just want to create your own language implementation, given the existence of many good lexer/parser generators to which you can just pass in a formal grammar.
Another book I also found very useful was "The Implementation of Functional Programming Languages" by Simon Peyton Jones (http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/index.htm http://research.microsoft.com/en-us/um/people/simonpj/papers...), though it's mostly of use only if you're specifically interested in functional programming (which is what I've mainly focused on my research; this book is much more specialised than some of the others).
- stiff 14y agoThe dragon book will teach you all about how to write your own lexer + parser generator (which I found quite fascinating), but you don't need to know about NFAs/DFA construction etc. One of the most fun projects I made inspired by the Dragon Book was a small grep implementation that was building up an NFA from a regular expression parsed by recursive descent and than simulating the NFA using an algorithm with two stacks described in the book :) It's just that it takes a lot of time to get something practical running starting from just the Dragon Book, and it can be discouraging given how much effort it takes to read it. Overall I can second everything you say, though.