Crafting Interpreters · Week 1
Crafting Interpreters 3: The Lox Language: reading guide
An informal tour of Lox: dynamic typing, automatic memory management, the data types, expressions, statements, variables, control flow, functions, closures, classes and inheritance.
Time About 2 hours this week
Why it matters
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.
How to approach 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.
Challenges
3 challenges at the end of the chapter.
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.
Traps
- Assuming Lox behaves like JavaScript or Python in edge cases. Check the chapter.