Siobhan Fitzpatrick

Compiler Visualizers

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

Explore how a compiler processes source code. Pick a language, edit the sample program, and hit Run. The lexer, parser, and bytecode panels populate from a live compile; then use the Playback controls to step through execution and watch the bytecode arrow, AST highlight, stack, and console stay in sync.

Interacting with the visualization:

  • Click any AST node to link it to its tokens and bytecode.
  • 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.

fun loopPrinter(addMe, minusMe) {
  var i = 0;
  while (i < 10) {
    print addMe + i - minusMe;
    i = i + 1;
  }
}

loopPrinter(5, (2 + 1));
print !true;
print true and false;