Live data from Hacker News

Crafting Interpreters: A Review

chidiwilliams.com

51–60 of 155 posts

Re: Crafting Interpreters: A Review

#51
This is my favorite book!

But I think it could be more straight forward if the first interpreter didn't use Java, but a modern main stream language that can avoid code generation and Visitor Pattern. Those parts feels like unnecessary detour.

Re: Crafting Interpreters: A Review

#52
I hesitated a little bit before deciding to purchase and go through the book. Had already read many glowing reviews then, but was not sure if the choice of language (Java) for the first half of the book would be a hindrance (it's not the stack I am most familiar with).

Decided to buy it anyway, primarily because the two implementations of the toy language piqued my interest (most other books only go through one implementation).

Boy was I glad I did.

Writing is superb, end-of-chapter challenges are instructive, code samples are meticulously and beautifully done. Here and there I also encountered references to other languages (e.g. had a brief detour to Lua internals [1], thanks to a side note), which I have enjoyed too.

Went through the first half twice: first using Java as it is written and then secondly implemented the interpreter in Rust (my initial fear turned out to be unfounded). Currently going through the second half.

So if you're reading this, thank you, Bob :).

[1] https://www.lua.org/doc/jucs05.pdf

Re: Crafting Interpreters: A Review

#53
I love this book! My only gripe is that I wish it was a whole series, no, a whole genre of books. We need more hands on, code first books that take you through 1-2 extended projects where you can type along and get working code at the end. These books should have CS theory, but still be fundamentally focused on implementation. It'd be really fun to have one of these for a more functional compiler (type checking, code generation, optimization), for a language service (query based compilation, concrete syntax trees, language server protocol), for databases, operating systems, and so on. Ideally they'd be a cross between an O'Reilly book and a SerenityOS stream

Re: Crafting Interpreters: A Review

#55
post #3

I've been wanting to read this book, but I'm not sure how I should go about it. Are you supposed to read and type out the code examples? I'm just wondering if I will learn anything that way?

I read the beginning sections of each chapter until I understand conceptually what the chapter implements by the end. (I needed more assistance for the initial chapters not knowing what the output of scanning or parsing would be, or where to start, but by the later chapters, it becomes pretty clear what the output of implementing say, classes, is).

Then I would try to implement it on my own without reading, having Chapter 3, the language specs, open in a different tab for reference. I chose Java because (1) I wasn't very familiar with it, and (2) I wanted the option to use their code snippets.

My goal is to pass all of the edge test cases the book mentions. So finally I would read the chapter and take some notes on the different design choices and test cases I missed. The reading is quite fast once you've already implemented because you know what to look for.

Re: Crafting Interpreters: A Review

#56

The author says it took about 6 months to thoroughly go through the book and examples. This is really useful in setting expectations.

I got through all chapters in around 1.5 months, spending 50-60 hours[1]. I'd do solid 4-5 hour blocks on Saturdays and Sundays when I was most into it. I'm following teachyourselfcs.com[2], so I'm hoping to solidify the concepts the book intro'd by reimplementing the bytecode interpeter in Rust (rlox) and following Alex Aiken's lectures online. OP appears to have reimplemented Lox in Golang (glox) for reinforcement.…

As another data point, I've taken about 1.5 months for Part 1 of the book, chipping away at it for 1-2 hours on weekday mornings.

Re: Crafting Interpreters: A Review

#57
post #52

I hesitated a little bit before deciding to purchase and go through the book. Had already read many glowing reviews then, but was not sure if the choice of language (Java) for the first half of the book would be a hindrance (it's not the stack I am most familiar with). Decided to buy it anyway, primarily because the two implementations of the toy language piqued my interest (most other books only go through one imple…

You're welcome! :D

Re: Crafting Interpreters: A Review

#58

This is my favorite book! But I think it could be more straight forward if the first interpreter didn't use Java, but a modern main stream language that can avoid code generation and Visitor Pattern. Those parts feels like unnecessary detour.

> but a modern main stream language that can avoid code generation and Visitor Pattern.

Yeah, a language with nice algebraic datatypes and pattern matching does eliminate the need for Visitor patterns.

But the reality is that many programmers are working in object-oriented languages where the Visitor pattern is useful, so I deliberately picked Java in order to teach that approach. The book tries to meet you where you are and not where you might wish you were.

Re: Crafting Interpreters: A Review

#59

This is the kind of book that really pays dividends into the future. Once you realize that lexing and parsing is not really that difficult, it makes a whole class of problems much easier.

> it makes a whole class of problems much easier.

The other big realisation is just how freaking enormous that class of problems is.

Re: Crafting Interpreters: A Review

#60

Without a doubt one of the best technical books I have ever read. To me, it was a missing piece of the big puzzle of "how do computers work". I read many a book to answer this question, and came away with three books: - CODE by Charles Petzold explains the CPU - Operating Systems: Three Easy Pieces by Arpaci-Dusseau explain OSes - Crafting Interpreters by Robert Nystrom explains programming languages Masterfully done…

Any defining book for networks?
Post reply on HN