1. 18

  2. 4

    Ordered. Can’t wait to go through it, congrats on this!

    1. 3

      Writing an interpreter in Go seems like a bit of a copout to me, the garbage collector is probably the hardest and most interesting part… Of course, if you need a quick DSL to get work done, by all means implement it in Go, it will work very well.

      1. 3

        Go’s now entirely written in Go, in my understanding, including the GC. So you could bootstrap by using Go’s GC and then write your own eventually. (I haven’t read the book.)

        1. 3

          I explicitly address this copout in a section, because you’re right: Go is doing a lot of work for us there and we don’t need to write our own GC. But I think there are a lot of other really interesting things you’ll encounter when writing an interpreter, even without writing a GC: lexing the source code, defining your tokens, what your keywords will be, parsing those tokens, deciding what’s a statement and what’s an expression, parsing expressions, evaluating expressions and so on… In the end, I think, once you’ve finished the book you’re in a great position to tackle the GC problem on its own, as a separate topic you can dive into.

        2. 2

          I also ordered the paperback edition! Congrats on this!

          1. 1

            Any idea why he doesn’t make it available as an e-book on Amazon?

            1. 7

              It is available in the Kindle store. Here it is on Amazon.com. It just doesn’t show up on the same product page because I haven’t gotten around to figuring out how to do that yet.

              The paperback version is printed and distributed by createspace, a company Amazon bought a few years ago, and they also take care of putting it up in several Amazon stores. The Kindle version is handled by Amazon’s own “Kindle Direct Publishing” (KDP) platform. And even though createspace is already semi-integrated into KDP it’s not that easy to just point KDP at a ISBN and it connects the two products on one product page. Or at least I haven’t found out how to do that yet :)

              1. 3

                Can I ask, because you had success with this process, what you wrote the original book in, and what your actual conversion pipeline was? Pandoc is powerful, but I have to imagine it took you a bit until you were truly happy with the output everywhere, and I’d be really curious if that’s information/a pipeline that could be reused.

                1. 5

                  The book is just a bunch of markdown files plus metadata in a YAML file. There is nothing fancy about the files: written in Pandoc’s own markdown format, including fenced code blocks, copy and pasted straight from the source code.

                  The files are first passed to pp, which only sets two variables: the current version of the book and the URL of the zipped code folder.

                  Then they are passed to pandoc, which turns them into epub, PDF (using LaTeX) and HTML. The epub version is then converted to mobi (the Kindle format) using Amazon’s own Kindlegen tool.

                  All of this is packed into a Makefile I’m ashamed to show off.

                  But, really, most of the work is done by pandoc, which I love immensely. I tried my best not to spend a lot of time on the toolchain, muttering “don’t start shaving the yak now…” to myself all the time…