Siobhan Fitzpatrick

Lox Compiler Visualizer

Interactive views of how Lox source is lexed, parsed, compiled, and executed step by step.

Welcome to the Lox Compiler Visualizer!

You can read a little background about it here

Interacting with the visualization:

  • Type code into the code editor and click build
  • Click any lexer token, AST node or bytecode instruction to link them together
  • Use arrow keys in the AST panel: left/right for siblings, up for parent, down for first child.
  • After a run, scrub or step through execution with the playback bar; the stack panel shows the reconstructed evaluation stack at each step.
  • Click empty space in a panel or outside the visualizer to deselect.
  • Drag inside the AST panel to pan the tree.

clox — the bytecode VM from Crafting Interpreters — compiled to WebAssembly.