#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck column:4
#columns:Front	Back	Tags	Deck
Crafting Interpreters: what is the phase about?	About half a year building two complete interpreters for Lox, a small but real language with closures and classes. First jlox, a tree-walking interpreter in Java (chapters 1 to 13), then clox, a bytecode virtual machine in C with its own hash table and garbage collector (chapters 14 to 30). A chapter a week, next to two NeetCode problems. You type every line yourself. It is the most fun phase of the path and the one that changes how you see every language you use.	cracked.guide cracked.guide::phase::interpreters cracked.guide::kind::about	cracked.guide::Crafting Interpreters::About this phase
Crafting Interpreters: what should you be able to do by the end?	<ul><li>Explain exactly what happens between typing code and it running: scanning, parsing, resolving, compiling, executing.</li><li>Write a recursive descent parser and a Pratt parser for any expression language.</li><li>Build a hash table, a bytecode VM, closures with upvalues and a mark-sweep garbage collector in C.</li><li>Debug memory bugs in C with sanitizers instead of guessing.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::kind::outcomes	cracked.guide::Crafting Interpreters::About this phase
Crafting Interpreters: what do you need before you start?	<ul><li>Comfort with one programming language, including classes and recursion.</li><li>Enough Java to read and write classes, interfaces and generics (see Week 0).</li><li>Enough C for pointers, structs and malloc/free before chapter 14, where clox starts (see Week 0).</li><li>A JDK, a C compiler, git and a public GitHub repo for verification.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::kind::need	cracked.guide::Crafting Interpreters::About this phase
Crafting Interpreters: how do you get the book?	Free. The whole book is online at craftinginterpreters.com, and the full source plus test suite is on GitHub. A print copy or eBook is nice to have and supports the author, but it is not needed.	cracked.guide cracked.guide::phase::interpreters cracked.guide::kind::book	cracked.guide::Crafting Interpreters::About this phase
Crafting Interpreters: tips for getting through it?	<ul><li>Type the code, do not paste it. The typing is where the learning happens.</li><li>Run the official test suite for each chapter; cracked.guide verifies your repo the same way.</li><li>Do challenges on a branch so semantic changes do not break the tests.</li><li>Compile clox with -Wall -Wextra -fsanitize=address,undefined from the first C chapter.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::kind::tips	cracked.guide::Crafting Interpreters::About this phase
Crafting Interpreters ch 1, Introduction: what does it cover?	Why build a language, who the book is for, and the plan: two interpreters for the same small language, Lox. Bob explains the book's style of showing every line of code.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 1, Introduction: why does it matter?	Sets expectations. You are about to write every line of two real interpreters yourself, which is the best way to stop seeing compilers as magic.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 1, Introduction: which part of the book is it in?	Welcome	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 1, a common trap: “Skipping the C linked-list challenge.” What's the catch?	It is a preview of exactly the pointer skills clox needs from chapter 14.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 1, a common trap: “Overthinking editor and build setup.” What's the catch?	A Makefile or a single javac command is enough for jlox.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 1: which end-of-chapter challenges are worth your time?	Challenge 1 is a reading exercise about little languages in the book's own build system; worth 10 minutes. Challenges 2 and 3 (hello world in Java, then a doubly linked list in C) are effectively your setup check. If the C linked list feels hard, spend extra time on pointers now; clox will demand it.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 1, Introduction: how should you work through it?	Read it in one sitting. Set up your environment now: a JDK, a C compiler, an editor and your lox repo. Do not skip the setup challenges; they are the real homework this week.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::01 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 01 Introduction
Crafting Interpreters ch 2, A Map of the Territory: what does it cover?	A tour of the parts of a language implementation: scanning, parsing, static analysis, intermediate representations, optimization, code generation, virtual machines and runtimes, plus the shortcuts and alternate routes like transpilers and JITs.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::02 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 02 A Map of the Territory
Crafting Interpreters ch 2, A Map of the Territory: why does it matter?	This map tells you where every later chapter fits. It is also the vocabulary you need to read about any real compiler or VM.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::02 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 02 A Map of the Territory
Crafting Interpreters ch 2, A Map of the Territory: which part of the book is it in?	Welcome	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::02 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 02 A Map of the Territory
Crafting Interpreters ch 2, a common trap: “Trying to memorize every term.” What's the catch?	You will learn them by building them.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::02 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 02 A Map of the Territory
Crafting Interpreters ch 2: which end-of-chapter challenges are worth your time?	Challenge 1 (find the scanner and parser in a real open source implementation) is the most valuable; pick a language you use and actually open the source. The other two are think-about-it questions.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::02 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 02 A Map of the Territory
Crafting Interpreters ch 2, A Map of the Territory: how should you work through it?	Read it once now, then come back to it when you start clox in chapter 14; it will make more sense the second time. Sketch the mountain diagram from memory afterward.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::02 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 02 A Map of the Territory
Crafting Interpreters ch 3, The Lox Language: what does it cover?	An informal tour of Lox: dynamic typing, automatic memory management, the data types, expressions, statements, variables, control flow, functions, closures, classes and inheritance.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Crafting Interpreters ch 3, The Lox Language: why does it matter?	You need to know the target language before you implement it. Lox is small but has real closures and classes, so it exercises the hard parts.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Crafting Interpreters ch 3, The Lox Language: which part of the book is it in?	Welcome	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Lox: what is it?	Lox is a small, dynamically typed scripting language designed by Robert Nystrom for the book Crafting Interpreters, implemented twice in it: as jlox and as clox.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Lox: Is Lox used in production?	No. It is a teaching language. Its value is that you can understand and build every part of it.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Lox: Where is the Lox language described?	Chapter 3 of Crafting Interpreters, &quot;The Lox Language&quot;, free at craftinginterpreters.com.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Crafting Interpreters ch 3, a common trap: “Assuming Lox behaves like JavaScript or Python in edge cases.” What's the catch?	Check the chapter.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Crafting Interpreters ch 3: which end-of-chapter challenges are worth your time?	Challenge 1 (write and run sample programs) is good to do once you have an interpreter. Keep your answer to challenge 3 (features you would add) in a notes file: chapter 13 asks you to implement one of them.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Crafting Interpreters ch 3, The Lox Language: how should you work through it?	Read it, then write a few Lox programs in a text file now (you can run them later with your own interpreter, or try the reference build from the repo). Keep a list of questions about the semantics; the book answers most of them later.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::03 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 03 The Lox Language
Crafting Interpreters ch 4, Scanning: what does it cover?	You build the scanner for jlox: turning source text into a list of tokens, handling lexemes, literals, keywords and identifiers, line numbers for errors, and the first bits of error reporting.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4, Scanning: why does it matter?	Every tool that reads text (config parsers, linters, syntax highlighters) starts with a scanner. It is the cleanest first step into the codebase.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4, Scanning: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 04 Scanning
jlox: what is it?	jlox is the tree-walk interpreter for the Lox language, written in Java in chapters 4 to 13 of Crafting Interpreters.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 04 Scanning
jlox: Can I write jlox in another language?	Yes, many people do, but you have to translate the book's Java as you go. The test suite still works: point it at your executable.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 04 Scanning
jlox: Does jlox need a specific Java version?	No recent feature is required. Any current JDK works; the book's code is plain Java.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4, a common trap: “Writing jlox in a language other than Java: totally fine, but you translate every snippet yourself and the Visitor-heavy code in later chapters is more work in some languages.” What's the catch?	Check the wiki of other implementations for your language.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4, a common trap: “Using a Java version too old for the code.” What's the catch?	Any modern JDK (17 or 21) works.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4: what traps should you watch for?	<ul><li>Off-by-one errors in current/start indices when extracting lexemes.</li><li>Forgetting to increment the line counter inside multi-line strings.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4: which end-of-chapter challenges are worth your time?	Challenge 4 (C-style block comments) is the one to actually implement; consider supporting nesting as the challenge suggests. Challenges 1 to 3 are discussion questions; think about them briefly. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 4, Scanning: how should you work through it?	Type the code yourself instead of copying; that is the whole point of the book. Run it on small inputs after each step. Set up the official test runner this week so every later chapter is checked automatically.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::04 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 04 Scanning
Crafting Interpreters ch 5, Representing Code: what does it cover?	You design the syntax tree for expressions: context-free grammars, the expression grammar for Lox, a small Java program that generates the AST classes, and the Visitor pattern for operating on trees, ending with an AST pretty printer.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 5, Representing Code: why does it matter?	ASTs are the central data structure of every compiler, linter and code formatter. The Visitor pattern explanation here is one of the clearest anywhere.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 5, Representing Code: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 5, a common trap: “In other languages, a sum type plus pattern matching (Rust enums, TypeScript unions) can replace the Visitor pattern.” What's the catch?	That is fine, but understand what the Visitor is doing first.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 5: what traps should you watch for?	<ul><li>Forgetting to rerun GenerateAst after changing the grammar, then wondering why classes are missing.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 5: which end-of-chapter challenges are worth your time?	Challenge 3 (an RPN printer) is short and a nice check that you understand visitors. Challenges 1 and 2 are thought exercises about grammars and functional versus object-oriented style.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 5, Representing Code: how should you work through it?	Write the GenerateAst tool exactly as shown; it saves a lot of typing later. Spend real time on the section about the expression problem and the Visitor pattern until you can explain why it exists.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::05 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 05 Representing Code
Crafting Interpreters ch 6, Parsing Expressions: what does it cover?	A recursive descent parser for Lox expressions, with precedence and associativity encoded in the grammar, plus syntax error reporting and panic-mode recovery by synchronizing at statement boundaries.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Crafting Interpreters ch 6, Parsing Expressions: why does it matter?	Recursive descent is how most production compilers (GCC, Clang, V8, Roslyn) parse. Once you can write one, you can parse almost anything.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Crafting Interpreters ch 6, Parsing Expressions: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Recursive descent parser: what is it?	A recursive descent parser is a top-down parser in which each grammar rule becomes a function, and functions call each other to match nested structure.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Recursive descent parser: Why not use a parser generator?	You can, but a hand-written recursive descent parser is easy to read, gives better error messages and needs no extra tool. Many large compilers use one.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Recursive descent parser: Can recursive descent handle left recursion?	Not directly; a rule like expr -&gt; expr + term loops forever. You rewrite it as a loop, which is what the Lox grammar does.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Crafting Interpreters ch 6: what traps should you watch for?	<ul><li>Getting associativity wrong by using recursion where the book uses a loop.</li><li>Error recovery that never resynchronizes, causing a cascade of bogus errors.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Crafting Interpreters ch 6: which end-of-chapter challenges are worth your time?	Challenges 1 (comma operator) and 2 (the ternary ?: operator) are great practice at adding grammar rules with the right precedence. Challenge 3 (error productions for binary operators missing a left operand) teaches good error messages. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Crafting Interpreters ch 6, Parsing Expressions: how should you work through it?	Map each grammar rule to its parsing method and check them side by side. Trace the parse of an expression like 1 - 2 * 3 == 4 on paper through the call stack.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::06 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 06 Parsing Expressions
Crafting Interpreters ch 7, Evaluating Expressions: what does it cover?	You make expressions run: a tree-walking evaluator over the AST, mapping Lox values to Java objects, truthiness, equality, runtime type checks and runtime error reporting.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 7, Evaluating Expressions: why does it matter?	This is the moment your interpreter actually computes something. Mapping a dynamic language's values onto a host language is the core design decision of any interpreter.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 7, Evaluating Expressions: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Tree-walk interpreter: what is it?	A tree-walk interpreter executes a program by recursively evaluating the nodes of its abstract syntax tree, with no compilation to another form.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Tree-walk interpreter: Are tree-walk interpreters used in real languages?	Yes, mostly early in a language's life or where simplicity matters more than speed. Many mature languages moved to bytecode VMs or JIT compilers later.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 7, a common trap: “Printing doubles: whole numbers should print without a trailing .0, as the book shows.” What's the catch?	The test suite checks exact output.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 7: what traps should you watch for?	<ul><li>Comparing Java Doubles with == instead of equals, or mishandling nil equality.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 7: which end-of-chapter challenges are worth your time?	Challenge 2 (string concatenation with a non-string operand) and challenge 3 (division by zero) make you decide semantics and implement them. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 7, Evaluating Expressions: how should you work through it?	Write the evaluator, then try every operator with wrong types to see your runtime errors. Compare how Lox equality and truthiness work with your favorite language.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::07 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 07 Evaluating Expressions
Crafting Interpreters ch 8, Statements and State: what does it cover?	Statements and state: expression and print statements, global variable declarations, the environment that maps names to values, assignment, and block scope with nested environments.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 8, Statements and State: why does it matter?	Scopes and environments are where interpreters get interesting, and every closure bug later traces back to understanding this chapter.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 8, Statements and State: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 8, a common trap: “Not restoring the previous environment when a block throws.” What's the catch?	Use try/finally as the book does.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 8: what traps should you watch for?	<ul><li>Treating assignment to an undefined variable as an implicit declaration.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 8: which end-of-chapter challenges are worth your time?	Challenge 1 (make the REPL print bare expressions) is a nice usability win. Challenge 2 (runtime error for uninitialized variables) changes semantics, so keep it on a branch. Challenge 3 is a scoping puzzle; answer it before running.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 8, Statements and State: how should you work through it?	Draw the environment chain for a few nested blocks. Run the shadowing examples in the chapter and predict the output before running.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::08 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 08 Statements and State
Crafting Interpreters ch 9, Control Flow: what does it cover?	Control flow: if/else, logical operators with short-circuiting, while loops, and for loops implemented by desugaring into while. Lox becomes Turing-complete.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::09 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 09 Control Flow
Crafting Interpreters ch 9, Control Flow: why does it matter?	Desugaring (implementing a feature by rewriting it into simpler features) is a key compiler technique. Short-circuit evaluation shows up in every language.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::09 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 09 Control Flow
Crafting Interpreters ch 9, Control Flow: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::09 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 09 Control Flow
Crafting Interpreters ch 9: what traps should you watch for?	<ul><li>The dangling else: make sure else binds to the nearest if.</li><li>Logical operators must return the operand value, not a converted boolean.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::09 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 09 Control Flow
Crafting Interpreters ch 9: which end-of-chapter challenges are worth your time?	Challenge 3 (add break) is the one to implement; it is a good exercise in parser state and in using an exception or flag to unwind. Challenges 1 and 2 are thought exercises. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::09 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 09 Control Flow
Crafting Interpreters ch 9, Control Flow: how should you work through it?	After implementing for-loop desugaring, print the AST of a for loop to see the rewritten while loop.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::09 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 09 Control Flow
Crafting Interpreters ch 10, Functions: what does it cover?	Functions: call expressions, arity checks, native functions like clock(), function declarations, return statements (implemented with an exception), and closures that capture their defining environment.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 10 Functions
Crafting Interpreters ch 10, Functions: why does it matter?	Functions and closures are the heart of most modern languages. Implementing them makes callbacks, higher-order functions and closures in JavaScript or Python fully transparent.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 10 Functions
Crafting Interpreters ch 10, Functions: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 10 Functions
Crafting Interpreters ch 10: what traps should you watch for?	<ul><li>Using an exception for return is correct here; do not try to &quot;fix&quot; it with flags unless you understand the trade-off.</li><li>Binding the closure to the global environment instead of the current one breaks closures.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 10 Functions
Crafting Interpreters ch 10: which end-of-chapter challenges are worth your time?	Challenge 2 (anonymous functions) is the best one to implement. Challenge 3 is a short validity puzzle about parameters and locals. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 10 Functions
Crafting Interpreters ch 10, Functions: how should you work through it?	Implement, then write a counter-making function to test closures. Write a recursive Fibonacci and time it with clock() so you have a baseline to compare against clox later.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 10 Functions
Crafting Interpreters ch 11, Resolving and Binding: what does it cover?	A static resolver pass that walks the AST before execution and records, for each variable use, how many scopes up its definition is. This fixes a closure bug caused by mutable environments and adds compile-time errors like reading a local in its own initializer.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::11 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 11 Resolving and Binding
Crafting Interpreters ch 11, Resolving and Binding: why does it matter?	This is your first semantic analysis pass. Linters, type checkers and compilers all work this way: a separate walk over the tree that computes facts about it.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::11 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 11 Resolving and Binding
Crafting Interpreters ch 11, Resolving and Binding: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::11 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 11 Resolving and Binding
Crafting Interpreters ch 11: what traps should you watch for?	<ul><li>Forgetting to resolve some node type, which leaves variables silently treated as globals.</li><li>Mismatched beginScope/endScope calls.</li><li>Resolving a function body in the wrong function type context, which breaks later return checks.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::11 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 11 Resolving and Binding
Crafting Interpreters ch 11: which end-of-chapter challenges are worth your time?	Challenge 3 (error on unused locals) is a nice small analysis to add. Challenge 4 (store locals in arrays indexed by slot instead of maps) is a real performance improvement and previews clox. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::11 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 11 Resolving and Binding
Crafting Interpreters ch 11, Resolving and Binding: how should you work through it?	Before reading the fix, run the example that shows the bug and make sure you understand why it misbehaves. Then implement the resolver. This chapter is subtle; plan for extra time.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::11 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 11 Resolving and Binding
Crafting Interpreters ch 12, Classes: what does it cover?	Classes: class declarations, instances with fields, property get and set, methods, this bound via a small closure, and initializers with init().	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::12 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 12 Classes
Crafting Interpreters ch 12, Classes: why does it matter?	Seeing how objects, methods and this are built from closures and maps explains a lot about JavaScript and Python object models.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::12 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 12 Classes
Crafting Interpreters ch 12, Classes: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::12 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 12 Classes
Crafting Interpreters ch 12: what traps should you watch for?	<ul><li>Returning the wrong value from init() when called directly.</li><li>Forgetting to bind this when a method is accessed but not immediately called.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::12 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 12 Classes
Crafting Interpreters ch 12: which end-of-chapter challenges are worth your time?	Challenges 1 (static methods) and 2 (getter methods) are both good. Challenge 3 is a design discussion about encapsulation. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::12 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 12 Classes
Crafting Interpreters ch 12, Classes: how should you work through it?	Implement in order and test after each step. Work through the explanation of how this is bound by an extra environment; draw it.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::12 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 12 Classes
Crafting Interpreters ch 13, Inheritance: what does it cover?	Single inheritance: superclass declarations, method lookup through the chain, and super calls, finishing jlox.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::13 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 13 Inheritance
Crafting Interpreters ch 13, Inheritance: why does it matter?	Method resolution order and super are how every OO language reuses code. Finishing jlox is a real milestone.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::13 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 13 Inheritance
Crafting Interpreters ch 13, Inheritance: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::13 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 13 Inheritance
Crafting Interpreters ch 13: what traps should you watch for?	<ul><li>A class inheriting from itself: make sure it is an error.</li><li>super lookups must use the superclass of the class where the method was defined, not of the instance.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::13 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 13 Inheritance
Crafting Interpreters ch 13: which end-of-chapter challenges are worth your time?	Challenge 3 (implement a feature you listed back in chapter 3) is the most rewarding. Challenge 2 (BETA-style inner) comes back in chapter 29, so if you skip it now, expect to meet it again. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::13 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 13 Inheritance
Crafting Interpreters ch 13, Inheritance: how should you work through it?	Implement, then run the full jlox test suite. Celebrate, then take a day before starting C.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::13 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 13 Inheritance
Crafting Interpreters ch 14, Chunks of Bytecode: what does it cover?	Start of clox: a C project with a dynamic array of bytecode (a chunk), a constant pool, line information, a disassembler and a memory reallocation function used for all allocation.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 14, Chunks of Bytecode: why does it matter?	Bytecode is how CPython, Lua, the JVM and many other runtimes execute code. This chapter is also a crash course in writing careful C.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 14, Chunks of Bytecode: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
clox: what is it?	clox is the bytecode virtual machine for the Lox language, written in C in chapters 14 to 30 of Crafting Interpreters.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
clox: Do I need to finish jlox before clox?	The book assumes it, because clox explains its design by contrast with jlox. You could start at chapter 14, but you would miss the reasons.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
clox: How fast is clox compared with jlox?	Much faster on the book's benchmarks, because it runs compact bytecode in a tight loop instead of walking Java objects. The exact factor depends on the program.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Bytecode virtual machine: what is it?	A bytecode virtual machine runs a program that has been compiled into a compact sequence of simple instructions (bytecode), decoding and executing one instruction at a time in a loop.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Bytecode virtual machine: Is bytecode the same as machine code?	No. Machine code runs on real hardware. Bytecode runs on a virtual machine, which is itself a program.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Bytecode virtual machine: Is a bytecode VM a compiler?	It usually comes with one: a compiler turns source into bytecode, then the VM runs it. clox does both in one pass.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 14, a common trap: “Reading freed memory after a reallocation moves the array.” What's the catch?	AddressSanitizer catches this.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 14: what traps should you watch for?	<ul><li>Forgetting to update capacity or count when growing an array.</li><li>Missing include guards or mixing up .h and .c responsibilities.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 14: which end-of-chapter challenges are worth your time?	Challenge 1 (compress line info, for example with run-length encoding) and challenge 2 (add a long constant instruction for more than 256 constants) are both worth doing. Challenge 3 (write your own allocator) is a big stretch; save it for later or connect it to Knuth 2.5.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 14, Chunks of Bytecode: how should you work through it?	Compile with warnings on (-Wall -Wextra) and use AddressSanitizer (-fsanitize=address) from day one. Build the disassembler and use it constantly.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::14 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 14 Chunks of Bytecode
Crafting Interpreters ch 15, A Virtual Machine: what does it cover?	The virtual machine: the instruction pointer, the main dispatch loop, a value stack, and arithmetic instructions, with tracing of the stack as it runs.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::15 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 15 A Virtual Machine
Crafting Interpreters ch 15, A Virtual Machine: why does it matter?	This loop is the beating heart of every bytecode interpreter. Understanding stack machines also helps you read JVM or WebAssembly bytecode.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::15 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 15 A Virtual Machine
Crafting Interpreters ch 15, A Virtual Machine: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::15 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 15 A Virtual Machine
Crafting Interpreters ch 15: what traps should you watch for?	<ul><li>Stack overflow with the fixed-size stack, since pushes are unchecked.</li><li>Pop order for binary operators: the right operand is on top.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::15 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 15 A Virtual Machine
Crafting Interpreters ch 15: which end-of-chapter challenges are worth your time?	Challenge 1 (write out bytecode for several expressions) is a quick and useful exercise. Challenge 3 (grow the stack dynamically) and challenge 4 (negate in place) are short C exercises worth doing.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::15 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 15 A Virtual Machine
Crafting Interpreters ch 15, A Virtual Machine: how should you work through it?	Enable the execution trace and step through a few hand-built chunks. Notice how each instruction pushes and pops.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::15 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 15 A Virtual Machine
Crafting Interpreters ch 16, Scanning on Demand: what does it cover?	A new scanner for clox that produces tokens on demand instead of all at once, pointing into the source string rather than copying lexemes, with a hand-written trie-like switch for keywords.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 16, Scanning on Demand: why does it matter?	Zero-copy scanning is how fast real-world parsers work. The keyword switch is a neat trick worth stealing.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 16, Scanning on Demand: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 16, a common trap: “Token lexemes are not null-terminated.” What's the catch?	Never pass them to printf with %s; use %.*s.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 16: what traps should you watch for?	<ul><li>The source buffer must outlive all tokens.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 16: which end-of-chapter challenges are worth your time?	Challenge 1 (string interpolation) is a great design problem; think through how the scanner would need to cooperate with the parser. Challenges 2 and 3 are design discussions.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 16, Scanning on Demand: how should you work through it?	Compare each function with your jlox scanner. Note how lexemes are pointers plus lengths, not strings.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
Crafting Interpreters ch 17, Compiling Expressions: what does it cover?	A single-pass compiler that parses expressions with a Pratt parser (a table of prefix and infix parse functions with precedence) and emits bytecode directly, with no AST.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Crafting Interpreters ch 17, Compiling Expressions: why does it matter?	Pratt parsing is an elegant, compact way to handle operator precedence and is used in many real compilers and tools.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Crafting Interpreters ch 17, Compiling Expressions: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Pratt parser: what is it?	A Pratt parser, or top-down operator precedence parser, parses expressions using a table that gives each token a prefix function, an infix function and a precedence.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Pratt parser: Is a Pratt parser recursive descent?	It is a top-down recursive parser too, but it drives precedence from a table instead of from a chain of grammar rules.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Pratt parser: What is binding power?	Another name for precedence in Pratt parsing: how strongly an operator holds on to the operands around it.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Crafting Interpreters ch 17: what traps should you watch for?	<ul><li>Getting precedence levels off by one in the rule table.</li><li>Forgetting that the compiler emits code as it parses, so order matters.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Crafting Interpreters ch 17: which end-of-chapter challenges are worth your time?	Challenge 1 (trace a tricky expression through the parse functions) is the most important; do it on paper. Challenge 3 (add the ternary operator) is a good stretch. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Crafting Interpreters ch 17, Compiling Expressions: how should you work through it?	This chapter is dense. Read the Pratt parser part twice. Trace the parse of a small expression through parsePrecedence and the rule table by hand, which is exactly what challenge 1 asks.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::17 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 17 Compiling Expressions
Crafting Interpreters ch 18, Types of Values: what does it cover?	Tagged unions for Lox values in C (numbers, booleans, nil), type checks in the VM, runtime errors, and new instructions for comparison and logical not.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::18 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 18 Types of Values
Crafting Interpreters ch 18, Types of Values: why does it matter?	Tagged unions are how dynamic languages represent values in a statically typed host. This design shows up in Lua, JavaScript engines and Ruby.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::18 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 18 Types of Values
Crafting Interpreters ch 18, Types of Values: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::18 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 18 Types of Values
Crafting Interpreters ch 18: what traps should you watch for?	<ul><li>Accessing the wrong union member without checking the tag first.</li><li>Forgetting to reset the stack after a runtime error.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::18 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 18 Types of Values
Crafting Interpreters ch 18: which end-of-chapter challenges are worth your time?	Both challenges are design discussions about instruction set size versus speed; think about them and maybe benchmark one idea.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::18 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 18 Types of Values
Crafting Interpreters ch 18, Types of Values: how should you work through it?	Draw the memory layout of the Value struct. Check sizeof(Value) on your machine.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::18 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 18 Types of Values
Crafting Interpreters ch 19, Strings: what does it cover?	Heap-allocated objects in clox, starting with strings: an Obj header, string objects, concatenation, and a linked list of all objects so they can be freed at exit.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::19 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 19 Strings
Crafting Interpreters ch 19, Strings: why does it matter?	This is where manual memory management starts in earnest. The object header plus linked list is the foundation for the garbage collector later.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::19 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 19 Strings
Crafting Interpreters ch 19, Strings: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::19 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 19 Strings
Crafting Interpreters ch 19: what traps should you watch for?	<ul><li>Forgetting the null terminator or the +1 in allocations.</li><li>Leaking the intermediate string in concatenation.</li><li>Casting between Obj* and ObjString* incorrectly.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::19 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 19 Strings
Crafting Interpreters ch 19: which end-of-chapter challenges are worth your time?	Challenge 1 (flexible array members to store characters inline) is a classic C optimization worth doing. Challenge 2 (strings that do not own their characters) is a good follow-up.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::19 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 19 Strings
Crafting Interpreters ch 19, Strings: how should you work through it?	Run every test under AddressSanitizer and LeakSanitizer. Understand the struct inheritance trick (an Obj as the first field) before moving on.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::19 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 19 Strings
Crafting Interpreters ch 20, Hash Tables: what does it cover?	A hash table from scratch with open addressing and linear probing, FNV-1a hashing, tombstones for deletion, growth by load factor, and string interning so string equality becomes pointer equality.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Crafting Interpreters ch 20, Hash Tables: why does it matter?	Hash tables are the most used data structure in practice. Building one yourself demystifies every dictionary and map you use, and Knuth 6.4 later analyzes exactly this design.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Crafting Interpreters ch 20, Hash Tables: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
String interning: what is it?	String interning stores exactly one copy of each distinct string value, so two equal strings are always the same object and can be compared by address.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
String interning: Do real languages intern strings?	Many do for identifiers and literals, and some intern all strings. Java interns string literals, for example, and exposes intern() for others.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Open addressing: what is it?	Open addressing is a hash table collision strategy in which every entry lives in the table's own array, and a collision is resolved by probing other slots until a free one is found.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Open addressing: Open addressing or chaining?	Open addressing is cache friendly and avoids allocations; chaining tolerates high load factors and simpler deletes. Knuth's §6.4 compares them with exact numbers.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Crafting Interpreters ch 20: what traps should you watch for?	<ul><li>Not treating tombstones correctly on insert versus lookup.</li><li>Infinite loop when the table has no empty slots (load factor too high).</li><li>Counting tombstones in the load factor or not, inconsistently.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Crafting Interpreters ch 20: which end-of-chapter challenges are worth your time?	Challenge 1 (support non-string keys) and challenge 2 (tune and compare hash table designs) are great; challenge 3 (benchmarking) pairs well with 2.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Crafting Interpreters ch 20, Hash Tables: how should you work through it?	Implement, then write a small stress test that inserts and deletes many keys and checks lookups. Re-read the tombstone section twice; it is the subtle part.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
Crafting Interpreters ch 21, Global Variables: what does it cover?	Statements and global variables in clox: print and expression statements, declarations, global variable get and set via the hash table, and assignment with correct precedence.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 21 Global Variables
Crafting Interpreters ch 21, Global Variables: why does it matter?	Shows how a single-pass compiler handles declarations and l-values, a trickier problem than in jlox.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 21 Global Variables
Crafting Interpreters ch 21, Global Variables: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 21 Global Variables
Crafting Interpreters ch 21: what traps should you watch for?	<ul><li>Invalid assignment targets silently accepted when canAssign is not threaded through correctly.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 21 Global Variables
Crafting Interpreters ch 21: which end-of-chapter challenges are worth your time?	Challenge 1 (stop adding duplicate name constants) and challenge 2 (faster global lookup) are both good engineering exercises. Challenge 3 (REPL-friendly forward references) is a design puzzle.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 21 Global Variables
Crafting Interpreters ch 21, Global Variables: how should you work through it?	Pay attention to how the canAssign flag prevents invalid assignment targets. Test with expressions like a * b = c.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 21 Global Variables
Crafting Interpreters ch 22, Local Variables: what does it cover?	Local variables on the VM stack: the compiler tracks locals and scope depth, so each local is just a stack slot index, making access much faster than hash lookups.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 22 Local Variables
Crafting Interpreters ch 22, Local Variables: why does it matter?	This is how real compilers do register and stack slot allocation in simple form. It also explains why locals are faster than globals in Python and Lua.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 22 Local Variables
Crafting Interpreters ch 22, Local Variables: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 22 Local Variables
Crafting Interpreters ch 22: what traps should you watch for?	<ul><li>Popping the wrong number of locals at the end of a scope.</li><li>Reading a local in its own initializer must be an error.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 22 Local Variables
Crafting Interpreters ch 22: which end-of-chapter challenges are worth your time?	Challenge 3 (const or final variables) and challenge 4 (more than 256 locals) are the implementable ones. Challenge 1 asks about faster local resolution.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 22 Local Variables
Crafting Interpreters ch 22, Local Variables: how should you work through it?	Use the disassembler to watch GET_LOCAL and SET_LOCAL slot numbers. Trace a nested block example on paper.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 22 Local Variables
Crafting Interpreters ch 23, Jumping Back and Forth: what does it cover?	Control flow in bytecode: jump instructions with backpatching for if/else, logical operators, while loops with backward jumps, and for loops.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::23 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 23 Jumping Back and Forth
Crafting Interpreters ch 23, Jumping Back and Forth: why does it matter?	Backpatching is how every assembler and compiler resolves forward jumps. You will see it again in real assemblers and in Knuth's MIX.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::23 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 23 Jumping Back and Forth
Crafting Interpreters ch 23, Jumping Back and Forth: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::23 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 23 Jumping Back and Forth
Crafting Interpreters ch 23: what traps should you watch for?	<ul><li>Jump offsets off by the size of the operand bytes.</li><li>Not popping the condition value on both branches.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::23 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 23 Jumping Back and Forth
Crafting Interpreters ch 23: which end-of-chapter challenges are worth your time?	Challenge 1 (a switch statement) and challenge 2 (continue) are both excellent. Challenge 3 is an open design question. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::23 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 23 Jumping Back and Forth
Crafting Interpreters ch 23, Jumping Back and Forth: how should you work through it?	Disassemble each control structure and draw the jump arrows. Off-by-one jump offsets are the usual bug; the disassembler shows them immediately.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::23 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 23 Jumping Back and Forth
Crafting Interpreters ch 24, Calls and Functions: what does it cover?	Function objects, call frames, a compiler per function, the call instruction, return, stack traces for errors, and native functions.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::24 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 24 Calls and Functions
Crafting Interpreters ch 24, Calls and Functions: why does it matter?	Call frames are exactly how your CPU and every runtime manage function calls. After this chapter, stack traces make complete sense.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::24 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 24 Calls and Functions
Crafting Interpreters ch 24, Calls and Functions: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::24 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 24 Calls and Functions
Crafting Interpreters ch 24: what traps should you watch for?	<ul><li>Wrong slot offset for the callee and arguments in a frame.</li><li>Not checking frame count for stack overflow on deep recursion.</li><li>Forgetting to update the cached frame pointer after a call or return.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::24 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 24 Calls and Functions
Crafting Interpreters ch 24: which end-of-chapter challenges are worth your time?	Challenge 1 (cache ip in a local or register) is a real speedup worth measuring. Challenges 2 and 3 (arity and error handling for natives) make the VM safer. Challenge 4 (add your own natives) is fun.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::24 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 24 Calls and Functions
Crafting Interpreters ch 24, Calls and Functions: how should you work through it?	One of the biggest chapters; plan two sessions. Draw the value stack and frames during a recursive call. Compare your Fibonacci benchmark against jlox from chapter 10.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::24 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 24 Calls and Functions
Crafting Interpreters ch 25, Closures: what does it cover?	Closures in clox with upvalues: variables captured from enclosing functions live on the stack until their frame returns, then get &quot;closed&quot; by moving them to the heap.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 25 Closures
Crafting Interpreters ch 25, Closures: why does it matter?	Upvalues are Lua's clever design for fast closures. This is widely considered the hardest chapter in the book and the most satisfying to get right.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 25 Closures
Crafting Interpreters ch 25, Closures: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 25 Closures
Upvalue: what is it?	An upvalue is a reference from a closure to a local variable of an enclosing function, which stays valid after that function returns.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 25 Closures
Upvalue: Does jlox use upvalues?	No. jlox closures hold a reference to their whole enclosing environment, a heap-allocated Java map, so the problem never arises.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 25 Closures
Crafting Interpreters ch 25: what traps should you watch for?	<ul><li>Keeping the open upvalues list unsorted, which breaks closing.</li><li>Closing upvalues in the wrong place (must happen when locals leave scope and at return).</li><li>Upvalue index versus local slot confusion in the compiler.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 25 Closures
Crafting Interpreters ch 25: which end-of-chapter challenges are worth your time?	Challenge 2 (a fresh variable per loop iteration) is a semantics change; do it on a branch. Challenge 3 (objects from closures) is a fun Lox program to write. Challenge 1 is a performance design question. 	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 25 Closures
Crafting Interpreters ch 25, Closures: how should you work through it?	Read the whole chapter once before coding. Draw the open upvalues list and the stack for the counter example. Use the test suite heavily; closure bugs are subtle.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::25 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 25 Closures
Crafting Interpreters ch 26, Garbage Collection: what does it cover?	A mark-sweep garbage collector: roots, marking with a gray stack (tricolor abstraction), tracing references, sweeping unreachable objects, weak references for the string table, and when to trigger collection.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 26, Garbage Collection: why does it matter?	GC is one of the most misunderstood parts of every runtime. After this, Java, Go and JavaScript GC logs make sense, and Knuth 2.3.5 will feel familiar.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 26, Garbage Collection: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Mark-sweep garbage collection: what is it?	Mark-sweep is a garbage collection algorithm that first marks every object reachable from a set of roots, then sweeps through all objects and frees the unmarked ones.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Mark-sweep garbage collection: Does mark-sweep move objects?	No. That is mark-compact or copying collection. Plain mark-sweep frees in place, so memory can fragment.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Mark-sweep garbage collection: What is a stress-test GC mode?	Collecting on every allocation. clox has a flag for it; it makes GC bugs show up immediately instead of rarely.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 26, a common trap: “An object allocated but not yet reachable gets collected mid-operation.” What's the catch?	Push temporaries on the stack before allocating again.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::trap	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 26: what traps should you watch for?	<ul><li>Forgetting to mark compiler roots while compiling.</li><li>Not removing unmarked strings from the intern table before sweeping.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 26: which end-of-chapter challenges are worth your time?	Challenge 1 (shrink the object header) and challenge 2 (avoid clearing mark bits on every sweep) are good optimizations. Challenge 3 (try another GC algorithm) is a big project; save it for after the book.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 26, Garbage Collection: how should you work through it?	Enable the stress-GC mode (collect on every allocation) and the GC log as the book suggests. Most bugs only show up under stress mode.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::26 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 26 Garbage Collection
Crafting Interpreters ch 27, Classes and Instances: what does it cover?	Classes and instances in clox: class objects, instance objects with a fields hash table, and get and set property instructions.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::27 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 27 Classes and Instances
Crafting Interpreters ch 27, Classes and Instances: why does it matter?	Shows the real cost of dynamic objects: every field access is a hash lookup, which is why engines like V8 invented hidden classes.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::27 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 27 Classes and Instances
Crafting Interpreters ch 27, Classes and Instances: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::27 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 27 Classes and Instances
Crafting Interpreters ch 27: what traps should you watch for?	<ul><li>Forgetting to blacken new object types in the GC, which causes use-after-free bugs.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::27 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 27 Classes and Instances
Crafting Interpreters ch 27: which end-of-chapter challenges are worth your time?	Challenges 1 (handling missing fields gracefully), 2 (dynamic field access by string) and 3 (deleting fields) all involve language design choices; pick one. Challenge 4 asks about faster field access, which connects to hidden classes.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::27 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 27 Classes and Instances
Crafting Interpreters ch 27, Classes and Instances: how should you work through it?	Remember to mark new object types in the GC. Run under stress GC again.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::27 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 27 Classes and Instances
Crafting Interpreters ch 28, Methods and Initializers: what does it cover?	Methods, bound methods, this, initializers, and the OP_INVOKE optimization that combines property lookup and call.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::28 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 28 Methods and Initializers
Crafting Interpreters ch 28, Methods and Initializers: why does it matter?	The invoke optimization is a real technique that production VMs use, and you get to measure its effect.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::28 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 28 Methods and Initializers
Crafting Interpreters ch 28, Methods and Initializers: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::28 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 28 Methods and Initializers
Crafting Interpreters ch 28: what traps should you watch for?	<ul><li>Not handling the case where a field shadows a method in OP_INVOKE.</li><li>Leaking bound method objects or forgetting to mark them.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::28 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 28 Methods and Initializers
Crafting Interpreters ch 28: which end-of-chapter challenges are worth your time?	Challenge 1 (faster init lookup) is quick. Challenge 2 is about inline caching, which is how fast JS engines work; reading about it is worthwhile even if you do not implement it.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::28 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 28 Methods and Initializers
Crafting Interpreters ch 28, Methods and Initializers: how should you work through it?	Benchmark method calls before and after OP_INVOKE.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::28 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 28 Methods and Initializers
Crafting Interpreters ch 29, Superclasses: what does it cover?	Inheritance in clox with copy-down inheritance (copy superclass methods into the subclass at definition time), and super calls, including an optimized super invoke instruction.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::29 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 29 Superclasses
Crafting Interpreters ch 29, Superclasses: why does it matter?	Copy-down is a neat trick that trades flexibility for speed, a classic VM design trade-off.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::29 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 29 Superclasses
Crafting Interpreters ch 29, Superclasses: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::29 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 29 Superclasses
Crafting Interpreters ch 29: what traps should you watch for?	<ul><li>A class inheriting from a non-class value must be a runtime error.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::29 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 29 Superclasses
Crafting Interpreters ch 29: which end-of-chapter challenges are worth your time?	Challenge 3 (BETA-style inner, again, now in C) is satisfying if you did it in jlox. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::29 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 29 Superclasses
Crafting Interpreters ch 29, Superclasses: how should you work through it?	Short chapter; run the full clox test suite at the end.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::29 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 29 Superclasses
Crafting Interpreters ch 30, Optimization: what does it cover?	Profiling and optimization: replacing modulo with bit masking in the hash table, then NaN boxing to pack every Lox value into 64 bits, with benchmarks showing the speedup.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::about	cracked.guide::Crafting Interpreters::Ch 30 Optimization
Crafting Interpreters ch 30, Optimization: why does it matter?	Measuring before optimizing is the most important performance habit. NaN boxing is used in real engines like LuaJIT and some JavaScript engines.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::why	cracked.guide::Crafting Interpreters::Ch 30 Optimization
Crafting Interpreters ch 30, Optimization: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::part	cracked.guide::Crafting Interpreters::Ch 30 Optimization
NaN boxing: what is it?	NaN boxing is a value representation that stores non-number values such as pointers, booleans and nil inside the spare bits of IEEE 754 double-precision NaN values, so that every value fits in 64 bits.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 30 Optimization
NaN boxing: Is NaN boxing portable?	Mostly, on 64-bit systems where pointers use 48 bits or so. It assumes IEEE 754 doubles and a pointer layout that fits, so it is a deliberate trade of portability for speed.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::definition	cracked.guide::Crafting Interpreters::Ch 30 Optimization
Crafting Interpreters ch 30: what traps should you watch for?	<ul><li>NaN boxing assumes 64-bit pointers fit in 48 bits; this is true on mainstream platforms today.</li><li>Optimizing without benchmarks.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::traps	cracked.guide::Crafting Interpreters::Ch 30 Optimization
Crafting Interpreters ch 30: which end-of-chapter challenges are worth your time?	Challenge 1 (find and fix another hotspot with a profiler) is the most valuable. Challenge 2 (small string optimization) is a nice C exercise. Challenge 3 asks you to reflect on the book; actually write it down.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::challenges	cracked.guide::Crafting Interpreters::Ch 30 Optimization
Crafting Interpreters ch 30, Optimization: how should you work through it?	Use a real profiler (perf, Instruments or VTune) on the benchmarks. Keep NaN boxing behind the compile-time flag the book uses so you can switch back to debug.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::30 cracked.guide::kind::approach	cracked.guide::Crafting Interpreters::Ch 30 Optimization
