Live data from Hacker News

Tell HN: The dragon compiler book (2nd edition) is a great book

news.ycombinator.com

11–20 of 48 posts

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#11
post #4

From the parsers I see in the wild (not strictly speaking about compilers here), I think most programmers should definitely spend some time studying the basics of them. It’s incredible to me how people mess up parsing even the simplest of file formats or make it super complicated.

I think people should know about parsing, but I don't think the material on parsing in most compiler books (LL parsing, shift-reduce conflicts, etc.) is particularly relevant.

I've had good experiences using parser combinator libraries. They are straight-forward to use, and to write, and expressive. Beyond that, it's seeing how to breakdown a parsing problem into a grammar that I think is the main skill.

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#12
post #5
post #4

From the parsers I see in the wild (not strictly speaking about compilers here), I think most programmers should definitely spend some time studying the basics of them. It’s incredible to me how people mess up parsing even the simplest of file formats or make it super complicated.

Hi, my name is Weston, and I'm bad at parsing (and it hurts the whole time I do it because I'm just barely clever enough to do it badly/dangerously). What else should I study besides the first 5 chapters of the 2nd edition of the dragon book?

Sorry if I misinterpreted your comment, but the last sentence reads like a snark. Why did you have to go from “the basics” to “read half a compiler book”? Most developers don’t even seem to read a single Wikipedia article on it.

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#13
I remember picking this book up at the university library in my second year because I had seen it in the movie “Hackers” and the cover looked really cool. I distinctly remember the parsing chapters especially recursive descent parsing. It was one of those light bulb “oh, this is how you do it” moments. Well worth spending a few weekends playing with that book, even if it’s somewhat dated, its like SICP in a sense more of a “mind expansion” device than anything else.

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#14
Besides devoting too many pages to parsing, I think compiler practitioners have low opinion of the book because it isn't useful for them. For example, the second edition claims to be updated to modern optimization techniques, and in a sense that's true, but it is useless because the book isn't using SSA. For practitioners, SSA is not optional these days, and everything about optimization in the book needs to be updated to SSA to be useful.

But you are probably not a compiler practitioner. Then I agree it is a good book to learn about compilers.

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#15

I remember picking this book up at the university library in my second year because I had seen it in the movie “Hackers” and the cover looked really cool. I distinctly remember the parsing chapters especially recursive descent parsing. It was one of those light bulb “oh, this is how you do it” moments. Well worth spending a few weekends playing with that book, even if it’s somewhat dated, its like SICP in a sense mor…

I know nothing about compiler design or compiler parsing. How broadly applicable are the chapters on parsing? Will it make the average programmer instantly more equipped to, say, write a robust JSON parser?

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#17

I remember picking this book up at the university library in my second year because I had seen it in the movie “Hackers” and the cover looked really cool. I distinctly remember the parsing chapters especially recursive descent parsing. It was one of those light bulb “oh, this is how you do it” moments. Well worth spending a few weekends playing with that book, even if it’s somewhat dated, its like SICP in a sense mor…

I know nothing about compiler design or compiler parsing. How broadly applicable are the chapters on parsing? Will it make the average programmer instantly more equipped to, say, write a robust JSON parser?

Yes.

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#18
post #14

Besides devoting too many pages to parsing, I think compiler practitioners have low opinion of the book because it isn't useful for them. For example, the second edition claims to be updated to modern optimization techniques, and in a sense that's true, but it is useless because the book isn't using SSA. For practitioners, SSA is not optional these days, and everything about optimization in the book needs to be updat…

Do you recommend a book that’s more up-to-date?

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#19
post #5
post #4

From the parsers I see in the wild (not strictly speaking about compilers here), I think most programmers should definitely spend some time studying the basics of them. It’s incredible to me how people mess up parsing even the simplest of file formats or make it super complicated.

Hi, my name is Weston, and I'm bad at parsing (and it hurts the whole time I do it because I'm just barely clever enough to do it badly/dangerously). What else should I study besides the first 5 chapters of the 2nd edition of the dragon book?

Well - do you want to be good at parsing/has any need for it? Even if you write your own programming language you are much better off using something like ANTLR to generate your grammar — the advantage is a well-specified standard description of your own grammar and no parser bugs.

Though mind you, not everyone shares my sentiment here, last time I wrote that people were adamant about hand-written parsers.

Re: Tell HN: The dragon compiler book (2nd edition) is a great book

#20

I remember picking this book up at the university library in my second year because I had seen it in the movie “Hackers” and the cover looked really cool. I distinctly remember the parsing chapters especially recursive descent parsing. It was one of those light bulb “oh, this is how you do it” moments. Well worth spending a few weekends playing with that book, even if it’s somewhat dated, its like SICP in a sense mor…

I know nothing about compiler design or compiler parsing. How broadly applicable are the chapters on parsing? Will it make the average programmer instantly more equipped to, say, write a robust JSON parser?

I’m not convinced that it would actually be particularly good as a parsing book either.

But the average programmer should just use a CSV parser lib, why reinvent the wheel? For custom tasks learning about ANTLR is much more productive (a good parser generator)

Post reply on HN