24 comments

  • stefanos82 5 days ago

    Read both if you like.

    I read and liked them both, but my heart belongs to Bob's writing, especially the C implementation in Crafting Interpreters and how he explains things.

  • wduquette 2 days ago

    Crafting Interpreters is the right at the top of my list of favorite programming books…and I’ve been reading them since the late 70’s. Amazingly clear and well-designed.

    • __rito__ 19 hours ago

      May I get the list of your favorite programming books?

      • wduquette 7 hours ago

        Heh. The books on the list would be the ones from which I learned new ways to think about programming. Most of them are now long out-of-date, as witness the discussion on "101 BASIC Games" going on elsewhere on Hacker News.

        "101 Basic Games", edited by David Ahl and published by DEC. I learned to program by typing in the code from this book back in the late '70's.

        "Write Your Own Programming Language Using C++", by Norman E. Smith. This is about writing a simple Forth interpreter. I used what I learned to write a simple Forth interpreter in C, which I then used as an embedded extension language in a couple of apps I was working on at the time. This was on a VAX, and rather before I'd ever heard of anything like TCL/TK.

        "Tcl and the Tk Toolkit", by John Ousterhout, which (among other things) explained how an embedded extension language ought to work.

        The O'Reilly X Windows books, and various O'Reilly books with animals on the cover. They were essential references, back in the day.

        "The C++ FAQs", by I don't remember who. I never used C++ much; but this book was an excellent introduction to all of the pitfalls in the C++ of the day, and how to use C++ without shooting yourself in the foot--and an even better example of how to write for programmers. It was a big influence on how I later wrote programmer's documentation.

        "Refactoring", by Martin Fowler. I've never followed the advice in this book slavishly, but it's tremendously affirming to read a new book encouraging you to do what you were doing already without having a name for it.

        "Effective Java", by Joshua Bloch, which I spent a lot of time with about ten years ago; it helped me come to grips with Java and avoid a variety of foot-guns, much like "The C++ FAQs".

        Various Lisp books; I don't like Lisp all that much, or Scheme either; but I come back to one or the other every few years and take another look, because I always learn something.

        Various other texts on specific programming languages, as I experiment with them; "Learn You a Haskell for a Great Good" sticks out mostly because it has a memorable title.

        And "Crafting Interpreters", which I've worked all the way through and then run with. Last month I implemented a simple Datalog implementation in a few days using the techniques from CI; I'll soon be integrating it into a much enhanced version of Nystrom's Lox.

  • greybox 2 days ago

    I recommend skimming over the first few chapters of crafting interpreters, the main value there is the recursive descent algorithm and abstract syntax trees, the rest is implementation. I've been developing my own language [1] and that's how I got started

    The ideas in crafting interpreters are not language specific, the examples are in java, but I used C++ for instance. Im sure you could transfer the same ideas to Go. Then again I've never read the go book you are referring to

    [1] https://youtu.be/azR1mUfFjHI?si=PsP-7o-w1yIN4xyq

  • kgabis a day ago

    I went over "Writing an Interpreter in Go" and "Writing a Compiler in Go" but instead of doing it in Go, I did it in C. In hindsight it was a very good decision, because it forced me to write the code myself, instead of mindlessly copying it. After finishing the books I've spent some time extending the compiler I've written and I've published it on github (https://github.com/kgabis/ape). I've read Bob Nystrom's previous book, so I'm sure Crafting Interpreters is great as well, but I really recommend Writing an Interpreter/Compiler in Go.

  • eleventhborn 2 days ago

    If you go with Crafting Interpreters, there is a coding challenge on CodeCrafters that follows the book: https://app.codecrafters.io/courses/interpreter/overview

    It is free (for now) and it helps me focused.

  • __alexander 2 days ago

    Crafting Interpreters has been sitting on my shelf for two or so years. I would love to read the book but the use of Java shelved it. I don’t have the time to understand the concepts from the book while simultaneously learning Java.

    • vips7L a day ago

      Bob uses basic programming constructs. If you know any language you can follow the book.

      • __alexander a day ago

        Yes, but half the code in the book is implemented in Java.

        • blenderob a day ago

          You can use Python or anything else you like to implement your code. The Java code he writes is simple, imperative code. But the OOP stuff might get in the way. If you've got programming experience, it isn't hard to read it and write your own in your preferred language.

        • markus_zhang 20 hours ago

          Or you can simply jump to the second part in C. I don't think it's mandatory to read the first part for the second one. Plus the second part is more interesting as it implements a VM.

          • __alexander 5 hours ago

            Oh, that is good to know. Thanks.

  • SwiftyBug 2 days ago

    I'm doing Crafting Interpreters... in Go! The book uses Java, but I prefer Go so I just went with it. It was an interesting exercise to "translate" the understanding of the implementation shown in the book (which relies heavily in OOP) to something more idiomatic in Go.

  • dusted 2 days ago

    There's also an excellent tutorial from LLVM, it got me started, I got some ideas and didn't want to be too influenced by "the right way", so I stopped somewhere mid tokenizer.. But I have a turing complete, interpreted language as of now, that I'm having a lot of fun thinking about.

    https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index...

    • MeetingsBrowser a day ago

      The kaleidoscope tutorial is a good tour of LLVM capabiltiies, but I don't think I would consider it an alternative to either of these books.

  • Spartan-S63 2 days ago

    I've read Writing an Interpreter in Go and Writing a Compiler in Go. Crafting Interpreters is on my bookshelf and on the list to get through Soon™. The latter books by Thorsten Ball are an incredibly approachable introduction to the topic. It's how I initially learned Go and it reinforced what I learned back in my undergrad on how parsers and compilers work.

    I love writing parsers and get far too few opportunities to flex that muscle. I wish I had read Crafting Interpreters for this question, as well, but by all accounts it's an incredible tome, as well. Read them all and see what different information you pick up from them!

  • markus_zhang 3 days ago

    I only read Crafting Interpreters and I can recommend this one. It's also free as a website so you can evaluate it before making a purchase. I did think it is interesting enough to go straight to make the purchase.

    • agarren 2 days ago

      I really enjoy Crafting Interpreters, but I’ve revisited it a couple times and haven’t yet made it through half the book. It’s very well written and there’s a lot of material to chew on. That said, Writing an Interpreter in Go, is short, sweet, and the Pratt Parser implementation and explanation are great! I haven’t cracked open his compiler book yet, but the interpreter book was a breeze.

      • markus_zhang a day ago

        Yeah I agree lox has a bit of too many features. I didn't complete the interpreter part and now I'm diving into the VM part. I'm not particularly interested in the more advanced stuffs. I won't get a compiler job anyway.

  • angra_mainyu 2 days ago

    I started them but dropped them and went straight for:

    - Engineering a Compiler

    - Programming Language Pragmatics

    - Crafting a Compiler

    Quite doable, particularly if you focus on one and supplement with the other two.

    • MeetingsBrowser a day ago

      Why drop them? If you have time for 3 books, you can probably find time for 5. Writing an Interpreter in Go and Crafting Interpreters are both great, and much more fun than these.

  • MeetingsBrowser a day ago

    Both are great!