Brinch Hansen on Pascal Compilers
Use the Amazon App to scan ISBNs and compare prices.
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
- Publisher : Prentice Hall (September 1, 1985)
- Language : English
- Hardcover : 310 pages
- ISBN-10 : 0130830984
- ISBN-13 : 978-0130830982
- Item Weight : 1.46 pounds
- Dimensions : 7.25 x 1 x 9.75 inches
- Best Sellers Rank: #1,269,322 in Books (See Top 100 in Books)
- Customer Reviews:
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
We used this book in a compiler class many years ago along with the Dragon Book.
Personally, I found this one more useful and practical than the Dragon Book over the years.
With the Dragon Book you'll get a good survey of compilers and compiler strategies and shift reduce parsing.
With this book, it will walk you tutorial style step by step through implementation of a recursive descent parser.
This book is undoubtedly the best compiler book. And I think it always will be. Brinch tells you the steps of creating a Pascal-like compiler, clearly stating the correct way to get the results. You don't need a PhD to create a compiler. If you follow the book, there are numerous code examples, and there is an entire listing in the appendix. The book has no typos, the code fragments are concise and understandable, and there is no missing code.
In about 1000 lines, a non-trivial compiler can be written. You can easily adjust the code to make your compiler of choice.
Some things to be aware of:
1) The book was written in the old DOS days. This is an advantage because the author had to keep the code small while making it as powerful as possible.
2) I expected the book to teach me how to compile to a DOS native EXE program. Unfortunately, it doesn't. The book is about creating interpretive-compilers, which involve a Virtual Machine. The VM used is simple, and is stack based. If you want an executable, you can still do it. You'd just have to write code that maps the virtual machine code to a real CPU. To do that, you'd need the specs of the CPU.
3) The book doesn't use object-oriented-programming. The procedural style of the code makes for easy reading and once you understand it, you will be in a good position to create your own language (even an OO one).
4) The Virtual Machine is stack-based. This results in ease of compiler creation. Most other compiler books are more advanced and use registers instead of stacks. You only need to use registers if you want to write an optimising compiler, which this book does not teach you.
5) The book uses a top-down, recursive descent, parser. This is the best way to handcraft a compiler. Many compilers use this type of parser. They are simple enough that you can easily code them. Most books on compilers teach too much theory, especially trying to explain DFA and then telling you that it's too hard to hand-code, so you should tools like lex and yacc. I've found it much better to simply hand-code these first 2 stages. In that way, you get a perfect knowledge of its workings.
6) The best method of error-recovery is given
7) There is some formal maths but the English explanations make it understandable.
Hopefully the publishers will reprint this book. Otherwise, grab a copy asap.