TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Writing an Interpreter in Go or Crafting Interpreters?

35 点作者 lordleft25 天前
I&#x27;m thinking of learning about compilers and am pleased to find that there seems to be at least two very accessible choices, &quot;Writing An Interpreter In Go&quot; and Crafting Interpreters. Curious if folks here have experience with either and could provide recommendations?<p>https:&#x2F;&#x2F;interpreterbook.com&#x2F; https:&#x2F;&#x2F;craftinginterpreters.com&#x2F;

13 条评论

stefanos8225 天前
Read both if you like.<p>I read and liked them both, but my heart belongs to Bob&#x27;s writing, especially the C implementation in Crafting Interpreters and how he explains things.
wduquette21 天前
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.
评论 #43768643 未加载
greybox22 天前
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&#x27;ve been developing my own language [1] and that&#x27;s how I got started<p>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&#x27;ve never read the go book you are referring to<p>[1] <a href="https:&#x2F;&#x2F;youtu.be&#x2F;azR1mUfFjHI?si=PsP-7o-w1yIN4xyq" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;azR1mUfFjHI?si=PsP-7o-w1yIN4xyq</a>
eleventhborn21 天前
If you go with Crafting Interpreters, there is a coding challenge on CodeCrafters that follows the book: <a href="https:&#x2F;&#x2F;app.codecrafters.io&#x2F;courses&#x2F;interpreter&#x2F;overview">https:&#x2F;&#x2F;app.codecrafters.io&#x2F;courses&#x2F;interpreter&#x2F;overview</a><p>It is free (for now) and it helps me focused.
SwiftyBug22 天前
I&#x27;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 &quot;translate&quot; the understanding of the implementation shown in the book (which relies heavily in OOP) to something more idiomatic in Go.
kgabis21 天前
I went over &quot;Writing an Interpreter in Go&quot; and &quot;Writing a Compiler in Go&quot; 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&#x27;ve spent some time extending the compiler I&#x27;ve written and I&#x27;ve published it on github (<a href="https:&#x2F;&#x2F;github.com&#x2F;kgabis&#x2F;ape">https:&#x2F;&#x2F;github.com&#x2F;kgabis&#x2F;ape</a>). I&#x27;ve read Bob Nystrom&#x27;s previous book, so I&#x27;m sure Crafting Interpreters is great as well, but I really recommend Writing an Interpreter&#x2F;Compiler in Go.
__alexander21 天前
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.
评论 #43761702 未加载
Spartan-S6321 天前
I&#x27;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&#x27;s how I initially learned Go and it reinforced what I learned back in my undergrad on how parsers and compilers work.<p>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&#x27;s an incredible tome, as well. Read them all and see what different information you pick up from them!
markus_zhang22 天前
I only read Crafting Interpreters and I can recommend this one. It&#x27;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.
评论 #43758809 未加载
dusted21 天前
There&#x27;s also an excellent tutorial from LLVM, it got me started, I got some ideas and didn&#x27;t want to be too influenced by &quot;the right way&quot;, so I stopped somewhere mid tokenizer.. But I have a turing complete, interpreted language as of now, that I&#x27;m having a lot of fun thinking about.<p><a href="https:&#x2F;&#x2F;llvm.org&#x2F;docs&#x2F;tutorial&#x2F;MyFirstLanguageFrontend&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;llvm.org&#x2F;docs&#x2F;tutorial&#x2F;MyFirstLanguageFrontend&#x2F;index...</a>
评论 #43767819 未加载
FusspawnUK19 天前
Crafting interpreters is still the one book that made me truely understand how they worked. always get&#x27;s a vote from me!
angra_mainyu21 天前
I started them but dropped them and went straight for:<p>- Engineering a Compiler<p>- Programming Language Pragmatics<p>- Crafting a Compiler<p>Quite doable, particularly if you focus on one and supplement with the other two.
评论 #43767796 未加载
MeetingsBrowser20 天前
Both are great!