Customers who viewed this item also viewed
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet or computer – no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
Writing An Interpreter In Go Paperback – 7 Aug. 2018
Purchase options and add-ons
Writing An Interpreter In Go - Version 1.7 - Find out more at https://interpreterbook.com
In this book we will create a programming language together. We'll start with 0 lines of code and end up with a fully working interpreter for the Monkey programming language.
Step by step. From tokens to output. All code shown and included. Fully tested.
Buy this book to learn:
- How to build an interpreter for a C-like programming language from scratch
- What a lexer, a parser and an Abstract Syntax Tree (AST) are and how to build your own
- What closures are and how and why they work
- What the Pratt parsing technique and a recursive descent parser is
- What others talk about when they talk about built-in data structures
- What REPL stands for and how to build one
Why this book?
This is the book I wanted to have a year ago. This is the book I couldn't find. I wrote this book for you and me. So why should you buy it? What's different about it, compared to other interpreter or compiler literature?
- Working code is the focus. Code is not just found in the appendix. Code is the main focus of this book.
- It's small! It has around 200 pages of which a great deal are readable, syntax-highlighted, working code.
- The code presented in the book is easy to understand, easy to extend, easy to maintain.
- No 3rd party libraries! You're not left wondering: "But how does tool X do that?" We won't use a tool X. We only use the Go standard library and write everything ourselves.
- Tests! The interpreter we build in the book is fully tested! Sometimes in TDD style, sometimes with the tests written after. You can easily run the tests to experiment with the interpreter and make changes.
This book is for you if you...
- learn by building, love to look under the hood
- love programming and to program for the sake of learning and joy!
- are interested in how your favorite, interpreted programming language works
- never took a compiler course in college
- want to get started with interpreters or compilers…
- ... but don't want to work through a theory-heavy, 800 pages, 4 pounds compiler book as a beginner
- kept screaming "show me the code!" when reading about interpreters and compilers
- always wanted to say: "Holy shit, I built a programming language!"
- Print length264 pages
- LanguageEnglish
- Publication date7 Aug. 2018
- Dimensions17.78 x 1.52 x 25.4 cm
- ISBN-103982016118
- ISBN-13978-3982016115
Frequently bought together

Customers who viewed this item also viewed
Product details
- Publisher : Thorsten Ball
- Publication date : 7 Aug. 2018
- Language : English
- Print length : 264 pages
- ISBN-10 : 3982016118
- ISBN-13 : 978-3982016115
- Item weight : 100 g
- Dimensions : 17.78 x 1.52 x 25.4 cm
- Best Sellers Rank: 421 in Computing & Internet Programming
- 26,130 in Books in English
- 32,697 in Books in other languages
- Customer reviews:
About the author

Thorsten Ball is a professional software developer and writer.
His writing is a result of his love for what he calls "recreational programming", where he digs deep into various topics, hoping to come out the other end with a better understanding of what it is that we do when we program. For the last few years, the two topics that kept his attention the most are systems programming and programming languages.
He's also interested in the other side of doing professional software development: software engineering in a team, communicating through code, team and company culture and how to write great code together.
This fascination with programming and what it means to develop software, turned into his two books and various blog posts, podcast appearances and talks.
Products related to this item
Customer reviews
Customer Reviews, including Product Star Ratings, help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyses reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from other countries
N. DansonReviewed in the United Kingdom on 24 June 20235.0 out of 5 stars 5 stars for the book, but 2 for the kindle formatting
Format: Kindle EditionVerified PurchaseThe book is really good. I’ve written a few toy compilers and interpreters, but wanted to get an insight into how other do it without dedicating my life to compiler research papers.
To avoid copy/paste I took the code and verbatim copied to Rust.
The book is generally very good - not perfect but overall worth 5 stars. But on Kindle the code formatting is awful and very hard to read. Obviously I haven’t checked the paperback version but the code formatting makes the examples very hard to read.
So a good book and worth it, but shame about the code formatting
Sergey TenReviewed in the United States on 24 September 20205.0 out of 5 stars Well-researched book that democratizes programming language design for everyone
Format: Kindle EditionVerified PurchaseJust like the author says in the beginning, the book is intended to be a practical guide to programming language design, and fill the void between step-by-step tutorials and academic volumes. The book definitely delivers on the promise - it builds the interpreter from the ground up, from lexer to parser to evaluator, with tests written first to give the reader an immediate view of what's coming. I especially liked the fact that the author doesn't cut corners on writing test harness for the code, and doesn't abuse the "<such and such> is left as an exercise for the reader" phrase - that alone is an indicator of thoroughness and no-nonsense approach to writing. Also, be sure to download the "lost chapter" from the link at the end of the book - coming from the C/C++ background, this was an eye opener for me on what a good macro system can do.
Looking forward to reading his Compiler book.
Josh WestonReviewed in Canada on 9 July 20225.0 out of 5 stars Worth every penny
Format: PaperbackVerified PurchaseI learned so much from working through this book, and not just about interpreters - about dealing with complexity, writing proper unit tests, writing a REPL, etc. I am looking forward to moving on to the next book in the series on writing a compilers.
Joel ThormeierReviewed in Germany on 11 January 20245.0 out of 5 stars Great book for learning by doing
Format: PaperbackVerified PurchaseI mostly got this to have a project to learn more about Go with. But generelly it's an excellent book that I can recommend as an introduction to both go and building interpreters. Personally, I understand systems best by working on them and this strikes the perfect balance between a theory laden dissertation and a trivial example. It's clear, concise and hands on. However, if you are mostly interested about in depth theoretical aspects of interpreters or already have the foundations this is probably not for you.
-
FranckReviewed in France on 9 October 20175.0 out of 5 stars Un tour de force
Ce livre réussi le tour de force d’aborder un sujet complexe souvent obscure et de le rendre limpide et accessible avec une facilité déconcertante.
Non seulement l'auteur ne triche pas (vous allez réellement écrire 100% du code sans outils tierce ou librairies spécialisées) mais vous allez le faire de façon extrêmement progressive.
Le découpage des étapes est tellement bien fait qu’à aucun moment vous ne devez absorber plus d’un ou deux concepts à la fois. Tout s’enchaine d’une façon fluide et logique. Lorsqu’une question germe dans votre esprit, la réponse apparait sur la page comme si l’auteur était dans votre tête !
A lire absolument.



