Interpreters
jlox vs clox
jlox is a tree-walk interpreter in Java: it parses Lox into a syntax tree and evaluates the tree, leaning on the JVM for memory. clox is a bytecode virtual machine in C: it compiles Lox in one pass to bytecode and runs it in a loop, with its own hash table and garbage collector. Same language, same tests, very different insides.
Side by side
| jlox | clox | |
|---|---|---|
| Language | Java | C |
| Chapters | 4 to 13 | 14 to 30 |
| Front end | Scanner, recursive descent parser, AST | Scanner on demand, single-pass Pratt parser, no AST |
| Execution | Walks the AST (Visitor pattern) | Stack-based bytecode VM |
| Variables | Environments: chained hash maps | Stack slots, globals table, upvalues |
| Memory | The JVM's garbage collector | Its own mark-sweep collector |
| Hash table | java.util.HashMap | Written from scratch, with string interning |
| Speed | Slow | Many times faster |
| Hours in our guides | about 57 | about 100 |
Why the book builds both
jlox makes the ideas visible: you can see the tree, and every concept (scope, closures, classes) maps to a few clear classes. clox makes them fast, and in doing so shows you what high-level languages hide: how values are represented, how a call frame works, how closures capture variables, how memory is reclaimed. Most people find clox harder and more rewarding.
Can I skip one?
You can skip jlox if you already understand ASTs, environments and resolvers, but clox explains its design by contrast with jlox, so you lose some of the why. You can stop after jlox if you only want the front end, but you miss the half of the book that teaches performance and memory. On the cracked.guide path both are required: jlox in weeks 1 to 11, clox in weeks 12 to 28, and both pass the official test suite.
Writing them in other languages
Many people write "jlox" in Python, Go, TypeScript or Rust, and "clox" in Rust or Zig. That works and the test suite still applies: point it at your executable. Be aware that a garbage-collected host language hides the memory chapters of clox, and Rust's ownership rules make some of clox's pointer tricks awkward.
Questions
Is clox harder than jlox?
Yes, for most people. C gives you nothing for free, and closures and garbage collection are the hardest chapters in the book.
Which is faster, jlox or clox?
clox, by a wide margin, because it runs compact bytecode in a tight loop instead of walking a tree of Java objects.