Crafting Interpreters 2020-07-26

By Max Woerner Chase

I spent a little time today figuring out the plan for implementing the resolver for Lox. (To be real, I spent more of the day watching Portal-related speedruns.) Now, one thing that I notice happening with my "bad-at-following-directions" take on tutorials, is that I eventually pile on so many changes and quick hacks, that it becomes impractical to follow the precise details of the tutorial so closely while keeping my reworks, and I have to refactor it to either accord with the tutorial, or what appeals to me aesthetically. I don't recall ever taking the former option, but it's there.

Anyway, the "reckoning" for the Lox tutorial wasn't too bad, at least I don't think it was. The basic point of friction is that I'm tracking state very differently from the tutorial, and that means that, while the JLox resolver works by injecting state onto an Interpreter instance, my codebase has all of the mutable state essentially concentrated into a single new class, which updates via attr.evolve rather than mutation. So, to implement the resolver, I have to have it take a state, and put data on the state.

There are a bunch of improvements I want to make first, that are slightly more complicated than the corresponding improvements to JLox. Once I make those improvements, I should be ready to implement the resolver and move on. For now, I want to wind down and cool off.

Good night.