5 ms·
I don't think it matters that a third of the pages are spent on parsing - that only covers 20% of the chapters. It's just that parsing takes somewhat more spac
by Athas 7y ago
I don't think it matters that a third of the pages are spent on parsing - that only covers 20% of the chapters. It's just that parsing takes somewhat more space to explain because the figures, tables, and examples take up relatively more space than when explaining e.g. type checking. I think it is a superficial knee-jerk reaction to classify this book as mostly being about parsing.
Also, while it is true that production compilers (especially optimising ones) have relatively little effort spent on their parsers compared to everything else, if you consider a bare minimum compiler, parsing is going to be a proportionally much larger part of it - especially if you do not use a prewritten parser generator (which this book assumes you do not, since it's partly about how you would create such a generator).
I definitely agree that too many compiler resources place too much emphasis on parsing, but I don't think this specific book is a particularly egregious case. I have also read Appel's books, and while they are good, I think you need to have read something else first to cover the basics.
- ernst_klim 7y ago> bare minimum compiler But who needs books on that? Especially considering that if I would like to write a simple toyish compiler I would rather use a parser generator (handcrafting a parser makes sense only in the case of serious industrial grade compiler). These books are books on parsers, not books on compilers. IMHO for learning a compiler craft it's much better to use a parser generator (or even Lisp) to skip the syntax part and move to something that constitutes an actual compiler: runtime interaction, exceptions mechanisms, code generation, type inference, intermediate languages, effect tracking etc etc.
- Athas 7y agoThis is a textbook for a university course. The intended audience for this book needs a bare minimum compiler, because that is all they will have time to write. You can't just say "use a parser generator". Who is supposed to write the parser generator, then? This book is for people who want to learn how to do all that foundational stuff, not an industrial programmer who needs to build a good product quickly.
- ernst_klim 7y ago>You can't just say "use a parser generator" You can just give students grammar for parser generator, and a parsetree/AST. Or use Lisp (Common Lisp or Scheme) and avoid syntax whatsoever.
- rhardih 7y agoYeah, imagine going through all that, trying to build your first ever Compiler, in an 8 week course as a CS freshman... (which is the intended audience)
- tom_mellior 7y ago> the figures, tables, and examples take up relatively more space than when explaining e.g. type checking. When you explain instruction selection for instance, there are also lots of figures and tables and examples you could add. This book gets around that by not even mentioning instruction selection. Meh. The register allocation chapter does look pretty decent, it looks like it manages to explain all of liveness analysis, graph coloring, and spilling in 15 pages. Including examples and figures and tables. It looks like the author is able to explain complex stuff succinctly.