Customers who viewed this item also viewed
Buy New
$39.00$39.00
FREE delivery Tuesday, April 28
Advertisement
Advertisement
Ships from: Amazon.com Sold by: Amazon.com
Used - Very Good
$21.95$21.95
$4.99 delivery Saturday, May 2
Advertisement
Advertisement
Ships from: Half Price Books Inc Sold by: Half Price Books Inc
Sorry, there was a problem.
There was an error retrieving your Wish Lists. Please try again.Sorry, there was a problem.
List unavailable.
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 – August 7, 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 dateAugust 7, 2018
- Dimensions7 x 0.6 x 10 inches
- ISBN-103982016118
- ISBN-13978-3982016115
Frequently bought together

Deals on related products
Customers also bought or read
- Go Programming Language, The (Addison-Wesley Professional Computing Series)
Paperback$32.46$32.46Delivery Tue, Apr 28 - Writing a C Compiler: Build a Real Programming Language from Scratch
Paperback$42.43$42.43FREE delivery Tue, Apr 28 - Concurrency in Go: Tools and Techniques for Developers
Paperback$46.76$46.76FREE delivery Tue, Apr 28 - Operating Systems: Three Easy Pieces#1 Best SellerComputer Operating Systems Theory
Paperback$28.27$28.27Delivery Tue, Apr 28 - Rust for Rustaceans: Idiomatic Programming for Experienced Developers
Paperback$29.49$29.49Delivery Tue, Apr 28 - Mastering Go: Leverage Go's expertise for advanced utilities, empowering you to develop professional software
Paperback$41.90$41.90FREE delivery Apr 29 - 30 - Structure and Interpretation of Computer Programs - 2nd Edition (MIT Electrical Engineering and Computer Science)
Paperback$59.90$59.90FREE delivery May 9 - 12 - LLVM Code Generation: A deep dive into compiler backend development
Paperback$38.59$38.59FREE delivery Tue, Apr 28 - Powerful Command-Line Applications in Go: Build Fast and Maintainable Tools
Paperback$40.05$40.05FREE delivery Tue, Apr 28 - Zero To Production In Rust: An introduction to backend development
Paperback$49.99$49.99FREE delivery Tue, Apr 28 - Design Patterns: Elements of Reusable Object-Oriented Software#1 Best SellerObject-Oriented Design
Hardcover$31.92$31.92Delivery May 2 - 7 - The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition)#1 Best SellerSoftware Design & Engineering
Hardcover$41.64$41.64FREE delivery Tue, Apr 28 - Domain-Driven Design: Tackling Complexity in the Heart of Software
Hardcover$57.61$57.61FREE delivery Tue, Apr 28 - Programming Rust: Fast, Safe Systems Development#1 Best SellerFunctional Software Programming
Paperback$43.99$43.99FREE delivery Tue, Apr 28 - Network Programming with Go: Code Secure and Reliable Network Services from Scratch
Paperback$35.58$35.58FREE delivery May 3 - 8 - 50 Algorithms Every Programmer Should Know: Tackle computer science challenges with classic to modern algorithms in machine learning, software design, data systems, and cryptography
Paperback$35.55$35.55FREE delivery Tue, Apr 28 - Grokking Algorithms, Second Edition: An illustrated guide for programmers and other curious people
Paperback$39.70$39.70FREE delivery Tue, Apr 28 - Coding Interview Patterns: Nail Your Next Coding Interview
Paperback$39.86$39.86FREE delivery Tue, Apr 28 - Code: The Hidden Language of Computer Hardware and Software
Paperback$33.12$33.12Delivery Tue, Apr 28
Product details
- Publisher : Thorsten Ball
- Publication date : August 7, 2018
- Language : English
- Print length : 264 pages
- ISBN-10 : 3982016118
- ISBN-13 : 978-3982016115
- Item Weight : 3.53 ounces
- Dimensions : 7 x 0.6 x 10 inches
- Best Sellers Rank: #399,199 in Books (See Top 100 in Books)
- #643 in Programming Languages (Books)
- 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 analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonReviews with images
An ambitious book that is concise in it's delivery
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on September 24, 2020Format: KindleVerified 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.
- Reviewed in the United States on June 6, 2017I've read many books and web articles on writing compilers and interpreters and this is one of the most accessible yet. The author describes step by step how to construct a Top Down Operator Precedence or Pratt Parser. The book contains a lot of simple elegant code that is a joy to read. The book contains just enough theory to help you understand , but not too much that you get overwhelmed. Recommend to any one interested in how parsers work. I would love it if the author writes a second volume focused on optimization or compiling down to native instruction.
- Reviewed in the United States on April 12, 2020Format: PaperbackVerified PurchaseI have both the waiig and the wacig books. I followed both books and entered the code myself. It took me about 2 months to finish the books and code in sequence. (It's important that you follow them in sequence.)
The compiler book went much faster because the basics are the same as the interpreter book. Instead of tree-walk to eval, the compiler emits instructions for the vm to execute. Since early in my career I was an assembly language programmer. The vm's stack architecture is quite natural to me so the vm portion, though new, was easy for me to follow as well.
Both books are wonderfully written. Code in both book work as advertised. I enjoyed reading and following the code immensely.
Ever since I left school I wanted to someday write a compiler. I did it! :-) . I am thinking about re-implementing the programs in Python. That should be quite fun, I would think.
- Reviewed in the United States on May 17, 2018A good book for getting started on writing an interpreter. By the end of this book, you have a functioning little language and interpreter for the author's homegrown language called Monkey.
You learn the basics of lexing, parsing (using Pratt Parsing) and evaluation (tree walking) and how you can use these techniques in developing an interpreter.
This is a great book for getting started writing an interpreter and shows that it isn't some sort of magic. The code is written in Go, however, the techniques are covered in enough depth so that you can easily translate them.
I dock it one star because I felt the author could have left out writing all of the tests and left that to the downloadable code. While testing your code is a good thing, I feel that it's coverage in the book was a little too much. Leaving this out would have left a little more room to add more language features or perhaps show how to handle right associativity with the Pratt Parser.
- Reviewed in the United States on March 16, 2019Format: PaperbackVerified PurchaseThe writing is very accessible, and the Pratt Parser implemented is thoughtfully constructed. You can build the whole thing in a couple of months as a side project, and although there are several parts that are not production-ready, the author generally notes these up front so you can go back later and improve them.
Also, I really like the fact that the interpreter is built TDD-style. That makes it easy to spot errors early, and also to extend the implementation painlessly.
- Reviewed in the United States on June 23, 2017This is probably the 9th book about compilers I bought and read in the last two years... And I loved it. The author is really honest with his introduction on why he wrote the book and what is expected to cover on it so you are completely warned from the beginning.
This is not a book to learn Go (there are better books about it) neither a book about how to design a programming language (there are many other academic books about it) or a book about different parsing algorithms (for that I recommend Language Implementation Patterns by Parr) but it is a book about writing an interpreter in Go, exactly as the title says, and I love it.
- Reviewed in the United States on August 5, 2019Format: PaperbackVerified PurchaseSo far so good, I love this book. It's simple to follow, and Thorsten's style of teaching is great.
- Reviewed in the United States on October 30, 2025Format: KindleVerified PurchaseGo is easy to read. This instructional book is easy to read. The text even includes code that executes recursively and uses closures. But it leaves out simple yet crucially important things, like looping constructs (for/while) and modules (import, private/public).
The "Lost Chapter" covering meta programming is a nice touch, though. It's a separate, free chapter, and well worth your time.
Top reviews from other countries
N. DansonReviewed in the United Kingdom on June 24, 20235.0 out of 5 stars 5 stars for the book, but 2 for the kindle formatting
Format: KindleVerified 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
Josh WestonReviewed in Canada on July 9, 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 January 11, 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 October 9, 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.
A. HahnReviewed in Sweden on November 19, 20235.0 out of 5 stars Fantastic introduction
Format: PaperbackVerified PurchaseAn introduction to interpreters for anyone






















