Answers.Body: <p>The &quot;problem&quot; with the dragon book is that it is so complete; intentionally so. Over its lifetime there have been tremendous advances in the theory and practice of building compilers. If you want &quot;state of the art&quot;, then you want the dragon book, probably a later (harder) edition, even.</p>
  <p>But it is a bit much, as you have seen, for a first course, or an overview of compiling. It is often used in graduate courses, for example, and, even then, in a follow-up course to one in Language Principles which discusses much of the underlying theory separately.</p>
  <p>While it is hard to find and a bit expensive, one of the best books for an introduction, and separately a bit of real literature in CS, get a copy of Brinch Hansen's <a href="https://rads.stackoverflow.com/amzn/click/com/0130830984" rel="nofollow noreferrer" rel="nofollow noreferrer">On Pascal Compilers</a>. It shows how to build a compiler as well as a machine to execute the code using Recursive Descent Parsing, which is easy to understand and suitable for LL languages (with a few extensions for non-LL features).</p>
  <p>Most commercial compilers use LR compiling techniques even if the language is LL, simply for efficiency reasons, but the theory is much harder as are the compilers. For state-of-the-art understanding, you need to delve into LR, but for a first introduction, LL is enough and easy to understand.</p>
  <p>LL compiling is also called Predictive Parsing, since it is easy to look at a language statement and choose a method for translating it, usually using keywords. The suitable languages for LL parsing are also easy for a human to read and understand. If a language (feature) absolutely demands LR parsing, then it will be difficult for a person to read.</p>
  <p>For example, the Dangling Else Problem in if statements is a consequence of the construct not being LL, though  LL parsers usually have special hacks to handle this common construct.</p>
  <p>Once you can handle Hansen's book, the dragon book won't be so daunting.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-12T20:36:59.360Z
Answers.LastActivityDate: 2021-06-19T10:42:05.987Z
Answers.LastEditDate: 2021-06-19T10:42:05.987Z
Answers.UserDisplayName: Buffy
Answers.Body: <p>I last taught the Compiler course in 2008, that's a longtime with probably newer books have appeared. (ie sorry if the answer is somehow outdated)</p>
  <p>But I did had the same complains from the students, then one of them (Hussain Hassan Mehanna, he's probably a prof in UK now) told me that his friend in AUC uses a book called &quot;Compiler Construction, Principles &amp; Practice&quot; by Kenneth C. Louden
  I brought it, the faculty agreed, the students liked it; ..... it was fine</p>
  <p><img src="https://i.sstatic.net/uffRl.jpg" alt="enter image description here" />
  But I kept the original classic one as a 2ndary reference, just not the textbook</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-16T20:24:14.623Z
Answers.LastActivityDate: 2021-06-17T02:55:11.993Z
Answers.LastEditDate: 2021-06-17T02:55:11.993Z
Answers.UserDisplayName: ShAr
Body: <p>I am currently following the red dragon book:</p>
  <p><a href="https://i.sstatic.net/PBj7n.png" rel="noreferrer"><img src="https://i.sstatic.net/PBj7n.png" alt="Red Dragon Book" /></a></p>
  <p>But most of the time, I have difficulty understanding the kinds of stuff in the book. Though the content is fine, and I end up asking questions on cs.StackExchange or StackOverflow. Then I thought of reading the reviews of the text and find out whether it is only me who is facing is the problem or there are people like me as well, finding the language hard to understand. Then I came across the <a href="https://www.goodreads.com/book/show/703102.Compilers" rel="noreferrer">review</a> page of this book in good reads and among many reviews, I found one which explains the problem with the text probably. Here it is:</p>
  <blockquote>
  <p>Good content, horrendous writing.</p>
  <p>The good thing about this book is it is comprehensive and covers a lot of ground from different vantage points. For example, the parsing chapters also cover the design of lex and yacc apart from basic topics. The type checking and runtime environment chapters had examples from C and ML to cover different scenarios.</p>
  <p>Now the bad parts. The book is awfully written and I cannot understand how can a book in its 2nd (or 3rd?) edition continue to be so bad. It was shoddy writing throughout but the prize for the worst writing is these topics:</p>
  <ol>
  <li>Discussion of bottom-up parsing where they directly jump to deterministic graph without discussing the nondeterministic version.</li>
  <li>Implementation of L-attributed SDTs with an obtuse parser stack.</li>
  <li>Implementation of type unification with their shoddy graph data structure.</li>
  <li>Implementation of run time system for ML using &quot;display&quot; which is incomprehensible.</li>
  </ol>
  <p>Another consistent problem is their horrible use of passive voice. This interacts really badly with their discussion of mathematical aspects. While the use of passive voice might be excusable, its shoddy use is not.</p>
  <p>Reading this book often felt like deciphering some ancient text. I needed to translate a lot of obtuse writing into something that can be understood in my head. This translation happens for all readings involuntarily but it was alarming I had to consciously do it for this book.</p>
  <p>I am not sure why is this book called a &quot;classic&quot; computer science book. It is more like a kind of book that students are forced to study by their professors. This book is impossible to read unless you are following some other source. I followed Prof. Alex Aiken's lectures</p>
  <p>This book might be responsible for the unpopularity of the study and research in programming languages. I agree compilers are not easy but this book has taken a difficult topic and made it incomprehensible thereby doing a disservice to this whole field of study.</p>
  </blockquote>
  <hr />
  <p>I am not criticizing the text or authors. The only thing is that probably the text does not suit a self-learner like myself. Could anyone suggest a compiler text to substitute the red dragon book possibly? A book with easy language, such that one easily understand what the authors tried to mean just by reading a sentence once. This would help a self-learner to focus more on the concept rather than getting lost in finding out the meaning behind the lines.</p>
  <p>A book that is lucid and easy to read and equivalent in power to the red dragon book as far as the contents and the examples are concerned.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-14T04:16:47.853Z
Comments.Text: That cover _does_ show its age. An IBM-PC (or clone) is a might old device.
Comments.UserDisplayName: Gypsy Spellweaver
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-09T13:04:31.577Z
Comments.Text: "Crafting interpreters" is what you need.
Comments.UserDisplayName: alinsoar
Tags: <self-learning><resource-request><textbook><compiling>
Title: Book to substitute "Compilers: Principles, Techniques and Tools" by Ullman et. al. (popularly known as the red dragon book)
ThreadText: # Book to substitute "Compilers: Principles, Techniques and Tools" by Ullman et. al. (popularly known as the red dragon book)
  
  (Asked by: username_0 on 2021-04-12)
  
  I am currently following the red dragon book:
  
  [![Red Dragon Book](https://i.sstatic.net/PBj7n.png)](https://i.sstatic.net/PBj7n.png)
  
  But most of the time, I have difficulty understanding the kinds of stuff in the book. Though the content is fine, and I end up asking questions on cs.StackExchange or StackOverflow. Then I thought of reading the reviews of the text and find out whether it is only me who is facing is the problem or there are people like me as well, finding the language hard to understand. Then I came across the [review](https://www.goodreads.com/book/show/703102.Compilers) page of this book in good reads and among many reviews, I found one which explains the problem with the text probably. Here it is:
  
  > Good content, horrendous writing.
  >
  > The good thing about this book is it is comprehensive and covers a lot of ground from different vantage points. For example, the parsing chapters also cover the design of lex and yacc apart from basic topics. The type checking and runtime environment chapters had examples from C and ML to cover different scenarios.
  >
  > Now the bad parts. The book is awfully written and I cannot understand how can a book in its 2nd (or 3rd?) edition continue to be so bad. It was shoddy writing throughout but the prize for the worst writing is these topics:
  >
  > 1. Discussion of bottom-up parsing where they directly jump to deterministic graph without discussing the nondeterministic version.
  > 2. Implementation of L-attributed SDTs with an obtuse parser stack.
  > 3. Implementation of type unification with their shoddy graph data structure.
  > 4. Implementation of run time system for ML using "display" which is incomprehensible.
  >
  > Another consistent problem is their horrible use of passive voice. This interacts really badly with their discussion of mathematical aspects. While the use of passive voice might be excusable, its shoddy use is not.
  >
  > Reading this book often felt like deciphering some ancient text. I needed to translate a lot of obtuse writing into something that can be understood in my head. This translation happens for all readings involuntarily but it was alarming I had to consciously do it for this book.
  >
  > I am not sure why is this book called a "classic" computer science book. It is more like a kind of book that students are forced to study by their professors. This book is impossible to read unless you are following some other source. I followed Prof. Alex Aiken's lectures
  >
  > This book might be responsible for the unpopularity of the study and research in programming languages. I agree compilers are not easy but this book has taken a difficult topic and made it incomprehensible thereby doing a disservice to this whole field of study.
  
  ---
  
  I am not criticizing the text or authors. The only thing is that probably the text does not suit a self-learner like myself. Could anyone suggest a compiler text to substitute the red dragon book possibly? A book with easy language, such that one easily understand what the authors tried to mean just by reading a sentence once. This would help a self-learner to focus more on the concept rather than getting lost in finding out the meaning behind the lines.
  
  A book that is lucid and easy to read and equivalent in power to the red dragon book as far as the contents and the examples are concerned.
  
  **Tags:** self-learning, resource-request, textbook, compiling
  
  > **Comments:**
  > **username_1**: That cover _does_ show its age. An IBM-PC (or clone) is a might old device.  
  > **username_2**: "Crafting interpreters" is what you need.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2021-04-12. Score: 8
  
  The "problem" with the dragon book is that it is so complete; intentionally so. Over its lifetime there have been tremendous advances in the theory and practice of building compilers. If you want "state of the art", then you want the dragon book, probably a later (harder) edition, even.
  
  But it is a bit much, as you have seen, for a first course, or an overview of compiling. It is often used in graduate courses, for example, and, even then, in a follow-up course to one in Language Principles which discusses much of the underlying theory separately.
  
  While it is hard to find and a bit expensive, one of the best books for an introduction, and separately a bit of real literature in CS, get a copy of Brinch Hansen's [On Pascal Compilers](https://rads.stackoverflow.com/amzn/click/com/0130830984). It shows how to build a compiler as well as a machine to execute the code using Recursive Descent Parsing, which is easy to understand and suitable for LL languages (with a few extensions for non-LL features).
  
  Most commercial compilers use LR compiling techniques even if the language is LL, simply for efficiency reasons, but the theory is much harder as are the compilers. For state-of-the-art understanding, you need to delve into LR, but for a first introduction, LL is enough and easy to understand.
  
  LL compiling is also called Predictive Parsing, since it is easy to look at a language statement and choose a method for translating it, usually using keywords. The suitable languages for LL parsing are also easy for a human to read and understand. If a language (feature) absolutely demands LR parsing, then it will be difficult for a person to read.
  
  For example, the Dangling Else Problem in if statements is a consequence of the construct not being LL, though LL parsers usually have special hacks to handle this common construct.
  
  Once you can handle Hansen's book, the dragon book won't be so daunting.
  
  
  ---
  
  ### Answer by username_4 on 2021-06-16. Score: 4
  
  I last taught the Compiler course in 2008, that's a longtime with probably newer books have appeared. (ie sorry if the answer is somehow outdated)
  
  But I did had the same complains from the students, then one of them (Hussain Hassan Mehanna, he's probably a prof in UK now) told me that his friend in AUC uses a book called "Compiler Construction, Principles & Practice" by Kenneth C. Louden
  I brought it, the faculty agreed, the students liked it; ..... it was fine
  
  ![enter image description here](https://i.sstatic.net/uffRl.jpg)
  But I kept the original classic one as a 2ndary reference, just not the textbook
  
  
  ---
  
  