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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Crafting Interpreters

274 点作者 vvoruganti大约 3 年前

15 条评论

aidos大约 3 年前
If you’re wondering if you should invest your time in this exceptional book, you could read this first in order to fully appreciate how exceptional it is.<p><a href="https:&#x2F;&#x2F;journal.stuffwithstuff.com&#x2F;2020&#x2F;04&#x2F;05&#x2F;crafting-crafting-interpreters&#x2F;" rel="nofollow">https:&#x2F;&#x2F;journal.stuffwithstuff.com&#x2F;2020&#x2F;04&#x2F;05&#x2F;crafting-craft...</a>
评论 #31206527 未加载
评论 #31204213 未加载
thundergolfer大约 3 年前
I&#x27;m working through this right now and it&#x27;s awesome. I&#x27;ve completed the Java interpreter and I&#x27;m halfway through the C bytecode stack-based interpreter[1]. I&#x27;d estimate I&#x27;ve spent around 30-40 hours with the book.<p>Throughout I&#x27;ve used both the website and the dead-tree version of the book. The website is great with 2 monitors, but you might be too tempted to copy-paste the code.<p>The one thing the book doesn&#x27;t mandate is the use of the Lox test suite, but I think it should be incorporated into the book. It&#x27;s easier to hack on your implementation when there&#x27;s a test suite to validate that everything still works as it should at Chapter X.<p>1. <a href="https:&#x2F;&#x2F;github.com&#x2F;thundergolfer&#x2F;uni&#x2F;tree&#x2F;main&#x2F;books&#x2F;crafting_interpreters" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;thundergolfer&#x2F;uni&#x2F;tree&#x2F;main&#x2F;books&#x2F;craftin...</a>
评论 #31202381 未加载
评论 #31202786 未加载
henrikeh大约 3 年前
I have been reading it and implementing the interpreter in Ada to learn about both interpreters and Ada better. It is a wonderful way to learn, since I constantly have to go beyond the surface level. What is the purpose of this and that in the interpreter? How do I model&#x2F;implement this well in Ada?<p>If you are curious about languages, I can only recommend trying to learn a new one while following this book.<p><a href="https:&#x2F;&#x2F;gitlab.com&#x2F;henrikenggaard&#x2F;ada-lox" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;henrikenggaard&#x2F;ada-lox</a>
评论 #31203812 未加载
评论 #31204090 未加载
sixstringtheory大约 3 年前
Previous discussion from when it came out in print, including discussion with the author: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27997167" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27997167</a>
dragonelite大约 3 年前
I have bought a copy of this book to support the author, but haven&#x27;t had time yet to implement any of it. Still wondering if i should do the implementation in Rust or Zig.
评论 #31211532 未加载
评论 #31202610 未加载
评论 #31205076 未加载
webmaven大约 3 年前
The link should really be to <a href="https:&#x2F;&#x2F;craftinginterpreters.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;craftinginterpreters.com&#x2F;</a>
catchclose8919大约 3 年前
How does it compare with &quot;Writing An Interpreter In Go&quot;? (<a href="https:&#x2F;&#x2F;interpreterbook.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;interpreterbook.com&#x2F;</a>)
评论 #31202915 未加载
agomez314大约 3 年前
Great book which took away my fears of making a compiler. It&#x27;s analogous to the 4-minute mile, where it seems so daunting to do until someone else does it and suddenly it seems achievable. Wish there could be books like this but for other &quot;scary&quot; parts of computing like operating systems or windowing system
评论 #31209918 未加载
smcl大约 3 年前
This reminds me that I need to return to my implementation! I maybe bit off a bit more than I could chew by using it as an opportunity to learn D (which is very nice, thanks @WalterBright!) and ended up with a weird bug in my implementation of section 25 &quot;Closures&quot; in the bytecode interpreter, got distracted by Advent of Code and didn&#x27;t come back to it yet.<p>Anyway, heartily recommend both working through Crafting Interpreters and learning the D language.
golergka大约 3 年前
Great book! Already implemented the first part with Typescript instead of Java, and still working through the second with Rust instead of C. I don&#x27;t think I would ever learn to use unsafe is not for it.
p0nce大约 3 年前
Haven&#x27;t got the book yet, but started using Wren. It&#x27;s a nice language if you want scripting and OOP (though I haven&#x27;t used Lua).
shafin_大约 3 年前
One of the two best technical books i&#x27;ve ever read is this one and the other one is os three easy pieces
Derbasti大约 3 年前
One of the best books about programming I have ever read. Simply brilliant!
hardware2win大约 3 年前
The worst thing is how much time building a compiler takes<p>Cli, lsp, cicd, docs, reading about other langs<p>And we arent even talking about the most important piece of code
olvy0大约 3 年前
Somewhat tangentially to this discussion, I&#x27;ve been burned by DSLs at work.<p>Personal rant follows. Apologies for being vague about the details, I&#x27;ve also changed some of them.<p>Our internal product has had 2 different DSLs written for it, one a graphical one written early in the 2000s, and another textual one written about 6 years ago. Both of them were partially driven by the same guy, the first one as an implementer and the second one as a manager. The second one was supposed to replace the first one. That first, graphical one, was disliked by many internal users, and was never actually fully completed.<p>Many internal apps were written in both those DSLs, and so far we have kept full backwards compatibility with both of them, including still occasionally fixing bugs in the interpreter. We have a vague plan to retire the first (graphical) one in a couple of years, once everyone has migrated to the second one.<p>I was against this second DSL from the beginning, and had a big fight against that manager guy who suggested it. I wanted to use an existing language instead of writing our own, <i>again</i>. However I was promptly shut out from the decision making process. From what I could tell this was because a guy on another team convinced that manager that writing a new language is trivial, using a commercial parser generator we have the license to.<p>I might mention that the product has many other features and the language is just one of them. It might be the most user-visible one, but there are many layers beneath it.<p>So that second language was built essentially by a commitee, without my direct involvement, with another team, which proved to be a long and painful process that took many hours. And to my great chagrin I did end up partially implementing the transpiler for this language and implementing some of framework required to bolt it into the existing product.<p>This was sort of fun for a while but I was fully aware I was deep into NIH land.<p>The language itself was simple enough, but many features added around it caused a large amount of bugs. Features included an in-app editor with full auto-complete, customized validations and warnings, automatic refactorings, a simple but performant on-line coverage engine, a primitive debugger, and so on. The bugs were mostly in the interface between our code and the code coming from the second team, since implementation of those features was split between us and them. Also a large number of bugs came from the effort to be fully backwards compatible with the older DSL language, which had some weird features due to its graphical nature, in order to allow conversion from the old language to the new.<p>The initial rollout of the language was met with some success, but it was mainly users who were relieved they don&#x27;t have to the first (graphical) DSL anymore. Then users of course started asking for more features in this language.<p>However, just then, most of the team left. For about a year I was the only one left and I was swamped with work. Now we do have a team back, but it&#x27;s mostly new people, and each of them is already responsible for an existing feature other than this DSL.<p>As a result, this DSL has very little documentation, except a tutorial course and some bare-bones help. Also, to cut corners, me and the team lead purposefully made some design decisions that impact performance, making our app very slow at times when users write lots of long functions in this DSL.<p>But now we&#x27;re stuck. The current team lead is practically the only one who knows about this language and all the nitty gritty design issues in it. And as a team lead they don&#x27;t have time to spend on it.<p>My team lead tries to be continue being an IC (individual contributor), and fix one of more severe of the performance problems on her own, but since they also has to function as a team lead, it took a long time, and also led to a series of very difficult bugs which we still deal with to this day.<p>I made some effort to wrote a post-transpiler phase which essentially bypasses some of the performance problems users have ran into, making her work somewhat redundant, but it&#x27;s not quite enough.<p>At the same time, there are requests from users and internal support to integrate &quot;proper&quot; scripting languages (python) or to expose APIs for our app.<p>So all this soured writing compilers &#x2F; interpreters, and DSLs in general, for me. I used to love learning new languages and wrote my own complete and fully tested parser for some small languages, including the C&#x2F;C++ preprocessor. But now I can&#x27;t bear thinking about doing it.<p>Once you have customers for this DSL, with demands and bug reports, and you hardly have the manpower to actually dedicate to improving it, it isn&#x27;t fun anymore. Not to mention I was against this NIH thing from the beginning, and it pains me to keep supporting it.<p>Currently I&#x27;m thinking about integrating C# as a kind of scripting language, since we&#x27;re already a Microsoft shop, although that has been changing in the last decade. TBH this was suggested years ago by the same guy who was responsible for the 2 DSLs, but I rejected it then due to performance issues. Now with AOT compilation, Roslyn, and VSCode &#x2F; Monaco and its extensions, this might just be the correct time. I&#x27;m not yet sure how exactly this will play out, but we&#x27;ll see.