1. 14

  2. 4

    Love the book! I ported the tree-walking interpreter to Swift and wrote a little bit on how it compared to the Java version in the README.

    I’m doing the same with the bytecode/VM interpreter. Will be interesting to see how far I can get with Swift without resorting to any unsafe pointer manipulation and how the performance will compare.

    1. 1

      Awesome! I love seeing how the code maps to other languages. I think Swift is surprisingly well-suited for language stuff with it’s nice ML-like enums.

    2. 3

      I’ve been working on a toy porgramming language implemention for a while, and I’ve been eagerly awaiting this section of Crafting Interpeters to be published, becuase creating my own bytecode interpreter is one o the many substeps of a PL implemention that I don’t fully grok. Thanks munificent for working on this book (and please try to get Ch 15 out quickly so I can read it too :) )

      1. 3

        Yes it’s great to see this. What other books cover bytecode interpreters?

        Most compiler textbooks don’t appear to cover the subject? As far as I remember the Dragon Book covers a “three address code”, but it’s more of an IR to compile down to assembly, not a stack machine.

        I found this article interesting – it has a very compact style:


        1. 1

          Thank you! Hopefully the next chapters won’t take quite as long. The past couple of months had a much greater number of personal life… things… than usual.