VM visualizer
Follow an expression through the stack-based virtual machine. Run an example, step through its bytecode, or change the expression and input yourself.
Reading the execution
The arrow marks the next instruction. Step executes it and moves the instruction pointer; Run advances automatically every half second. Step backward to inspect an earlier state, or reset to start again.
The stack holds intermediate values. Its top value appears first. When execution completes, the final result appears below the stack.
From bytecode to a result
For 1 + 2 * 3, the compiler emits six instructions:
| Instruction | Effect |
|---|---|
CONST 1 | Push 1 onto the stack |
CONST 2 | Push 2 |
CONST 3 | Push 3 |
MUL | Pop 2 and 3, then push 6 |
ADD | Pop 1 and 6, then push 7 |
RETURN | Return the top value |
The visualizer uses the actual Yexp VM and its debug callbacks. The displayed instructions and values come from the same runtime used in your application.
Control flow
Choose a conditional or logical expression to see the instruction pointer jump. A ternary evaluates one branch; && and || short-circuit when the left operand determines the result.
Pipelines, selectors, and lambdas can produce more involved programs. Choose a collection example and step through it to inspect how the stack changes.
Try your own expression
Edit the expression or its JSON input above. Changes compile a new program and reset execution. Invalid syntax or input shows an error beside the editors.
For a larger editor with AST inspection, use the playground. Read the architecture guide for the compiler and runtime design, or the language guide for supported syntax.