A runtime & debugging engine
glassjar
My fork of debugger.sh, the engine I built with Jacob Roberts-Baca, Fabio Ibañez, Justin Vassantachart, and Chris Gregg. Our paper was accepted at SIGCSE TS 2027.
glassjar runs and debugs code locally in the browser. It started as debugger.sh, a project I built at Stanford with Jacob Roberts-Baca, Fabio Ibañez, Justin Vassantachart, and Chris Gregg, and that we wrote up together in a paper accepted at SIGCSE TS 2027. The first half of this page is that shared work. glassjar is my fork of it, where I’ve kept building on my own, and what it adds is further down.
The motivation came out of teaching. In every intro class, the first few weeks go to fighting installation problems instead of writing code. We wanted something that would let us run, debug, and visualize code without anyone installing anything.
For C/C++, Python, and Rust, we take the real toolchains and compile them to WebAssembly, targeting WASI. These are the versions glassjar runs today:
- C / C++
- Clang 22.1
- Python
- CPython 3.15
- Rust
- rustc 1.96, lightly patched, 2024 edition
So the real compilers for these languages run right in your tab.
Built as a library
We decided early on to make this a headless library, so anyone who needs to run or inspect code can drop it into their own system. That’s why we call it the engine.
An educator can fit it into their class, and since the engine has full access to the program’s memory, things like live code visualization become possible. Outside of education, it works for any case where a person or a service wants to run and inspect code without a backend.
In a classroom, that means code snippets you can debug right inside lecture notes, autograders that run on the student’s machine, and memory diagrams built from real program state instead of a whiteboard.
Piloting it with students
We piloted it in a CS2 section at Stanford, and 70% of program runs were followed by an actual debugging action: a breakpoint, a step, or a continue. We never told students to use the debugger. It was just there, so they used it.
Seeing where the pointer is when looping through the linked list helped me understand what is actually going on.
-
struct node { -
int val; -
struct node *next; -
}; -
-
int sum(struct node *head) { -
int total = 0; -
struct node *cur = head; -
while (cur) { -
total += cur->val; -
cur = cur->next; -
} -
return total; -
}
Variables
- total
- 3
- cur
- node 2 (val 1)
Memory
What glassjar adds
After the paper, I forked both halves of the project, the engine and the IDE around it, to keep building on them.
Most of that work went into speed. The engine used to start from scratch on every run, so a hello world in C++ or Rust took seconds. Now:
The engine is published on npm as glassjar. It carries the group’s engine forward along with later debugger and compiler fixes from Jacob and Justin, which I merged into one line. On top of that I:
- keep the worker and its compiled compilers warm between runs, while every run still gets a fresh sandbox, so nothing one program writes is visible to the next
- skip the compiler entirely when you re-run unchanged C++, and precompile a file’s
#includeblock once, the way clangd does - rebuilt clang from the same LLVM commit with everything a WebAssembly compiler never uses left out, and compile it while it downloads so Chrome can cache its machine code between visits
- build our own CPython 3.15, a third of the download of the old 3.11 runtime, and rewrote the Python debugger on
sys.monitoringso code runs at nearly full speed until it reaches a breakpoint - support multi-file programs: Rust modules, C++ headers in folders, Python imports
- serve the toolchains from my own CDN, retry downloads that fail on a flaky network, and let a site host the engine’s WebAssembly itself (a single
wasmUrloption)
The IDE is live at ide.yousefabuhashem.com. I:
- added IntelliSense for all three languages: C++ uses the engine’s own clang, so completions and hovers know the Stanford library and its docs; Python uses basedpyright; Rust uses rust-analyzer compiled to WebAssembly
- added multi-file workspaces, with a file explorer, tabs, quick open, and breakpoints that work across files
- replaced its Supabase backend with a small Cloudflare Worker API on R2 for share links and telemetry, with a hard daily write budget so a traffic spike can’t turn into a bill
- redesigned the interface to be easier to pick up: a visible C++/Python/Rust switch, Run that turns into Debug once breakpoints are set, a status pill showing where the program is paused, and a layout that works on a phone. It opens on Python, with a jar of fireflies drawn in the terminal
I also just want to explore how far this can stretch beyond education. LeetCode, HackerRank, interview tools, and docs with live examples all run untrusted code on their own servers. LLM apps run small snippets all the time too, like when they make you a graph. I wonder how much of that could move to the user’s device, and what it would save.
Speaking of LLMs, when an LLM debugs, it mostly reruns the code, adds print statements, and reads the output. That’s not how we teach people to debug. In every OS class I took, the debugger and I spent a lot of long nights together. glassjar could give an LLM the same debugger.
Try it
npm install glassjar
Or open the glassjar IDE and start typing. The group’s original debugger.sh is still up too.
Fair warning: your first visit still downloads a whole compiler, and C++ is the biggest one. The IDE starts that download as soon as the page loads, and the browser caches it, so after the first run everything takes a fraction of a second.
If you are here, you are curious :) read more, and reach out!
This project had a lot of strange problems: compiling compilers to WebAssembly, rewriting binaries to slip debug hooks between statements, and pulling debug information back out of the output to turn it into something a person can read.
If you’re interested, our paper has the details of the engine we built together. It was accepted at SIGCSE TS 2027, and that link is the camera-ready version. Or, even better, let’s talk about it over coffee.