notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

TreeWalkInterpreter.md (720B)


      1 # Tree Walk Interpreter
      2 
      3 **Source:** Crafting Interpreters
      4 
      5 **Definition:** A tree walk interpreter is an interpreter that builds an AST and walks it (executing instructions as it goes). 
      6 
      7 Many modern interpreters favor bytecode / VMs.
      8 
      9 ## Parts
     10 
     11 - Lexer
     12     - Converts source code to tokens
     13     - Token parts
     14         - Lexeme
     15             - The smallest\* sequence of characters that means something
     16                 - Adheres to maximal munch principle so things like "orchid" don't become the reserved word "or".
     17         - Token type
     18             - Token types are just the kind of thing it is, so it could be a specific keyword, a type of literal, or any number of other things
     19 - Parser
     20     - Parses tokens into an AST