Earlier quoted context omitted.
I think there more obvious problems with the dragon book: in particular, ~300+ pages are spent focusing on techniques for doing parsing and lexing. Now if I want to write a baby yacc [sic], this might be useful. But in this modern era, parsing is a very well understood problem, with lots of easy to use tool. Yes in a production compiler helpful syntax and type error messages are key, but when you're learning the comp…
Even if you are writing a production compiler, you will likely not be using a tool, nor writing a tool, to generate the parser. Most production commercial compilers in practice use hand-written recursive descent with a hand-written lexer, which itself potentially uses feedback from the parser (very handy for parsing C or C++). Recursive descent usually gives context for error recovery that matches the way most progra…
Learning to write a compiler
41–42 of 42 posts
Re: Learning to write a compiler
#42I'm upvoting this just to hopefully start a discussion and hear more about this topic from fellow HNers. I hear the Dragon Book mentioned almost daily around here; I'm intrigued. Do you think this book could be read by someone who's not actually interested in writing a compiler? Does the book stand by itself? I'm interested in reading it, but I don't really think I have the motivation to start writing my own compiler…
"could be read?" Of course. whether you would enjoy it is another issue. Compare; "Do you think I could take piano lessons if I am not actually interested in playing a piano?" "Do you think I could study architecture if I am not actually interested in designing buildings?" The former is not popular, the latter is, but AFAIK few people study the grunt work of architecture for fun. It all depends on where your interest…