Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Crafting Interpreters – Web Version (craftinginterpreters.com)
176 points by Thursday24 on Feb 14, 2022 | hide | past | favorite | 34 comments


This is a book that, if you can afford it, should be bought on general principle. There are very few books that show how recursive descent works and this one is incredibly well done.

The fact he gives it away for free is amazing.


I feel compelled to point that while I do give the book away for free which benefits lots of people, it also apparently benefits me too. Sales of the book (and my first book, Game Programming Patterns which is also online for free) have been way better than I ever expected. I think a large part of that comes from the web edition making the book better known that it would be otherwise.

So this seems to be a strategy where everyone wins. People who can't afford it get to read it. People who can but want to see if they like it first can do that. Others who can afford it support my writing. I get a lot of readers and sales.

I stumbled onto this model completely randomly, but it seems to have worked out really well for me.


Wow thanks so much for writing both of these! Game Programming Patterns helped me so much when I wrote a game engine my senior year. I read the book online and bought the physical book when I saw how useful it was. I immediately bought Crafting Interpreters when it first came out and I hope to give it a proper read through when I have some time.


Unrelated, but I did want to thank you for Game Programming Patterns; it's made game development much much less stressful for me.


That's great to hear!


Thanks. This book helped me a lot in my projects.

I'd like to see more books in the future about crafting relational databases (server or not). I know it's a huge endeavor, but I find techniques related to efficient file writing, data persistence, partitioning, indexing and effective datafile querying fascinating. After all, databases are also "mini" file systems.


It turns out the type in the print edition is small enough to trouble my ageing eyes, but I'm more than happy to have bought a copy to support such a labor of love!


Aw, darn. I'm sorry to hear that. My eyes definitely aren't what they used to be either, and I tried to typeset the book as readably as possible (which is a big part of why the page size is larger than most other technical books).


Crafting Interpreters was an amazing experience and the printed version is just beautiful. Thank you! :)


Which way of buying the print books is best for you? I've been meaning to pick both these up!


Thank you for asking. :)

I think I technically make the most of you buy it from Amazon, but I'm not picky. You can also call your local bookstore and ask them to order a copy. I won't make quite as much, but you support a local business, which is always good.


No problem, I used to work in the book biz! As I don't think we have a store on my tiny island that is hooked up to regular new book distributors, I'll go with Amazon. Thanks for making these.


ordered and looking forward to them! :-)


I totally agree. If you're into computers and computer-sciency interests and interpreters/compilers, try going through the Dragon book and try going through Bob's book. You'll realize that even though the Dragon book sells for something like $160, the Crafting Interpreters book is worth many times over for its pedagogy. (Of course both books have very different aims so it's not an apples-to-apples comparison, one is a good book for an overall Compilers course and the other gets you right in to writing your own interpreter with just enough theory to see how things fit together).


Just ordered it. I've read a parts of it when it was still being worked on and it was a delight. Can't wait to read it all.


This book was absolutely amazing! It is astonishingly well-written, almost actually exciting to read at times, and chock full of fascinating insights and anecdotes. Oh, and its main text was really useful as well, uncovering so many programming language behaviors I had seen many times before, but never figured out why things were as they are.

Truly, I can't recommend this book enough, if the topic is at all interesting to you!

(And follow it up with Code, by Charles Petzold, to see how a processor works, and Operating Systems, Three Easy Pieces by Arpaci-Dusseau for how OSs work)


Wow, that's a wonderful gesture from the author. I haven't read it yet, but I've seen so many great reviews on HN and other social media sites.

Here's some of the past discussions:

* https://news.ycombinator.com/item?id=27997167 (6 months ago | 118 comments)

* https://news.ycombinator.com/item?id=22788738 (2 years ago | 74 comments)

* https://news.ycombinator.com/item?id=13406081 (5 years ago | 75 comments)


Related. The author's love for their craft oozes through their work. If I'm not wrong every single illustration in the book is hand-drawn; like literally. Take a look: https://www.youtube.com/watch?v=iN1MsCXkPSA


You're correct. Hand lettered too, because I am apparently obsessive.

I talk about it more here: http://journal.stuffwithstuff.com/2021/07/29/640-pages-in-15...


It's a great book! I really liked how it guides step-by-step, always having something working building up to the full interpreter for Lox. I haven't yet gotten around to the 2nd part of the book (the C based interpreter/vm) because I got carried away with adding extra features to my Kotlin Lox implementation (including a JVM backend)! https://github.com/mrjameshamilton/klox


We're waiting for Crafting Typecheckers, Bob!


Robert Nystrom has generously made the entirety of his "Crafting Interpreters" available for free.


This was the original format; it was published on the web as it was being written, long before availability in print.

(Not to say that it's not excellent of him to make and keep it freely available; it is!)


Chelsea Troy, a Staff Engineer at Mozilla, keeps a blog where a lot of her posts work through various aspects of this book. I've really enjoyed reading them.

https://chelseatroy.com/


Well worth paying for it as pdf or book by the way.


The layout and typography is frankly superb.


I will read this book some day. It is always in my mind but, I'm too busy these days.


I only started reading it, but I absolutely love the author's style! I wish I could write this well...


I was so excited for this, then I realized it uses C (which I'm not familiar with).


The first half of the book uses Java, which you might be more familiar with. The C it uses is fairly vanilla. You shouldn't have to be a C expert to understand it.

Also, all of the code in the book has been ported to a large number of languages:

https://github.com/munificent/craftinginterpreters/wiki/Lox-...


The book has two interpreters. The first one is in Java. The second one uses C. If you're familiar with Java then it makes for a great learning experience to contrast the Java version with the C version. (I think it's worth it to learn just enough C to be able to go through this second version. It makes for an awesome learning experience!)


I hate, HAAAAAAATEEEE, C.

But his C is so clean. Is readable as far as is possible, imho.

Plus, exist some many implementations of this in as languages are, so you can go along (https://github.com/search?q=crafting+interpreters or using https://github.com/search?q=lox+interpreter).


The golang based https://interpreterbook.com/ project might be interesting to you instead, then?


The first implementation is in java and the second is in c. Even if you don’t know C you should give this book a shot!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: