frameletCALLSTACK THEATEREVERY CALL HAS A PART TO PLAY.
FIRST CALLS / SCENE 01

Keep every call in character.

Follow the active frame. Give each return its proper place.

CUE 11 / 5
THE CALL STACK1 FRAME
Active WaitingTOP FRAME RUNS FIRST
Raising the curtain…
FRAME IN FOCUSF1 · main(n=2)ACTIVE

Ready for its next line.

The script

main

Only the active frame runs. Waiting callers keep their own values.

A call makes a new frame.

The caller waits while the new frame takes its turn. Its local values stay safe.

FINAL OUTPUT?

Return to the original caller to reveal it.

YOU’RE THE STAGE DIRECTOR

What happens next?

Read the highlighted line and choose its next action.

0 missed cues
WELCOME TO CALLSTACK THEATER

Small calls.
A whole cast of frames.

Help Framelet direct a tiny program. Each function call has its own frame, arguments and local values. Follow the highlighted line, then choose what the interpreter does next.

  1. 1
    Look at the active frame.

    The top frame runs. Waiting callers keep their values and a place for the result they need.

  2. 2
    Give the next cue.

    A call adds a fresh frame. A return removes the current frame and sends its value to the waiting caller’s pending expression.

  3. 3
    Follow every return home.

    Select the correct frame, argument or returned value. Finish the scene when the original call returns its final output.

The theater is interactive.

Tap a 3D frame to inspect its own locals and see its offered actions. Use All frames to show every option again. Each action has a number for the keyboard.

1–4 Choose visible actionZ Undo last correct cueH Hint · R RestartM Sound · Esc Close helpEnter Next after successTab & Enter Use controls

3 stars: no missed cues or hints. 2 stars: up to two missed cues, no hints. 1 star: every completed scene. Undo and restart preserve missed cues and hint use; your best stars are saved when browser storage is available.

BEHIND THE CURTAIN

Calls pause.
Returns resume.

A call stack keeps track of function calls. Calling a function creates a new frame; that frame runs while its caller waits. When it returns, its frame leaves the stack and execution resumes in the caller.

Same function. Separate values.

Recursion is a function calling itself. Each invocation has its own arguments and locals. A base case returns without making another recursive call, allowing the waiting calls to finish.

The theater uses a small, language-neutral pseudocode with whole-number arithmetic. IF tests are resolved before the highlighted call or return cue. Expressions are evaluated from left to right. A waiting expression keeps its earlier result while it waits for another call.

Programs here are bounded and terminate. The theater shows at most five simultaneous frames as a teaching rule; real programming environments have their own stack limits. There are no asynchronous callbacks in these scenes.

Learning sources & credits

Programming references: MDN’s Call stack and Recursion.

Framelet, the theater and frame props are original Blender models. Sound effects: Kenney Interface Sounds (CC0). Runtime: Three.js (MIT). Fonts: Fredoka, IBM Plex Mono and DM Sans, Google Fonts.

60 scenes in each of three courses, for 180 scenes total.