Crafting “Crafting Interpreters” (2020)
Here is my journey with this book so far:<p>I decided to follow the book but write in Clojure (at least the interpreter) instead of Java.<p>This went well, but then I decided I also wanted to write the lexer as a state machine in a data DSL (nested maps).<p>This went kind of well, but it seemed incredibly verbose, because a ton of states would have the same input messages, so I decided to write a macro that maps regular expressions to tokens one to one and produces a (data DSL) state machine that later drives the lexer.<p>Then I realized that I get a non-deterministic state machine that I needed to convert to a deterministic one.<p>Then I decided that the string representation of regular expressions suck, and that I want to write a DSL for those too...<p>Then left at the above, switched to a few other books in between and am trying to decide whether I should ditch the lexer entirely and just use s-expressions. I probably won't, because it's fun so far, but boy did I get sidetracked...