Officina · AI
Write. Run. Understand.
Write a Python, C or Java program and press Trace. It runs here, in your browser, while the tracer records its lines, variables, calls and output. Then step through what happened, forwards and back, at your own pace.
Running and tracing stay on your device. The trace records real execution; the optional tutor explains it.Back to the notebook
Input — what input() reads, one line per call
Ctrl/⌘ + Enter traces. In the trace: ← → step, Space plays, and clicking a line jumps to the next time it runs.
The code or input has changed since this trace.
Nothing traced yet. Write a program on the Code tab and press Trace.
How this works
Python runs on CPython compiled to WebAssembly, in a background worker. C is compiled by clang and Java by the Eclipse compiler — the same toolchains the notebook uses — here in your browser, and Java then runs onCheerpJ's JVM. Before a C or Java program is compiled, the tracer adds calls to it, on the lines they belong to, that report each step as it runs. Stepping through the finished recording never runs anything again.
In C, arrays, strings, structs and enums are shown as values, and a pointer by what it points at; a variable not yet given a value shows as ?. Indexing past an array, dividing by zero or following a NULL pointer stops the trace on the line that did it, where C itself would carry on into undefined behaviour. In Java, objects are shown field by field and the JDK's collections by what they hold; code inside a lambda runs without being traced. goto and threads are not supported. Every run stops at 50,000 steps or five seconds, and a trace cut short says so.
C's compiler and Java's JVM are large, so each is fetched the first time you pick its language and kept by your browser after that. CheerpJ is the one thing here loaded from another site: its free licence allows it only from the vendor's own domain.
The tutor under the program is a language model on this site's server. When you ask it something, your program and what the interpreter recorded about the step in view are sent to it, and it is asked to put those facts into words — it never produces a trace, and every answer is marked as its account. A program it writes goes into the editor to be traced like any other, so you can watch whether it works.