Crafting Interpreters

Robert Nystrom

出版时间

2021-07-28

ISBN

9780990582939

评分

★★★★★
书籍介绍
这是一本把「造一个语言」从神话拉回手工艺领域的书。作者没有堆砌NFA转DFA的数学恐惧,而是带着读者亲手实现一个解释器:从Pratt解析器、树行走解释器,到字节码虚拟机、垃圾回收与优化,每一步都先用Java、再用C完整实现两遍。读者最看重的正是这种「手把手」的踏实感——它不追求理论高度,而追求你能照着敲出能跑的代码。书里那些幽默的插图和旁白,把枯燥的编译器原理讲得举重若轻。它适合那些曾被本科编译课吓退、却仍想知道编程语言究竟如何运转的人;也适合想为简历添上「我写过解释器」的工程师。读完你会明白:编译并非少数专家的秘术,而是一门可被拆解、可被习得的手艺。
作者简介
Robert Nystrom has programmed professionally for twenty years, about half of which is in games. During his eight years at Electronic Arts, he worked on behemoths like Madden and smaller titles like Henry Hatsworth in the Puzzling Adventure. He's shipped games on the PC, GameCube, PS2, XBox, X360, and DS, but is most proud of the tools and shared libraries he created for others to build on. He loves seeing usable, beautiful code magnify the creative ability of others. Robert lives with his wife and two daughters in Seattle where you are most likely to find him cooking for his friends and plying them with good beer.
精彩摘录
  • "This means that in some ways prototypal languages are more fundamental than classes. They are really neat to implement because they’re so simple. Also, they can express lots of unusual patterns that classes steer you away from. But I’ve looked at a lot of code written in prototypal languages—includi"
用户评论
写完了jlox
作者展示了如何实现一个语言的解释器。包含了 Pratt Parser、Tree-walk Interpreter、Bytecode VM、Garbage Collection、Optimization。佩服作者分解复杂 topic 的能力,几乎每章结尾时都有一个可以运行的解释器。
阅读体验极佳。作者循循善诱,就差“手把手”教学了。基本上每一行代码都包含在书中(极少数不一致的,可以在 github 上找到)。除了正文,还有 asides、challenges、design notes,趣味性、扩展性也都有了。
非常好的书,让我这个编译器小白受益匪浅
下载
收藏