Raymart Balaguer

Reading List

I recently rediscovered my love for reading technical books. Many are surprisingly approachable - some only 100-300 pages long, making them perfect for focused weekly reading sessions.

Over the next month, I'll be reading and sharing notes on these books:

Reading List:


Notes on Ruby Under a Microscope

Tokenization

  • Breaking text into tokens (like identifiers, keywords, operators)
  • Grouping characters together
  • Adding labels to token types

Parsing

  • Makes sense of the token stream
  • Ruby uses Bison parser with LALR algorithm
  • Creates Abstract Syntax Tree (AST) for the compiler
  • Ruby's AST is implemented using Arrays

Compilation

  • Ruby 1.9 introduced YARV (Yet Another Ruby VM)
  • Compiles AST into YARV bytecode rather than machine code
  • Performs optimizations during compilation:
    • Method inlining
    • Constant expression evaluation
  • Ruby's compiler.c is implemented as a large switch statement