CS 128C++ in the browser

STANDALONE PROOF OF CONCEPT

A runnable, powered by WebAssembly.

Edit the C++, then run it right here. Your browser compiles and executes the program.

RUNNABLE · WASM-LIGHT

Hello, browser.

A real C++ program, compiled locally into WebAssembly.

#include <iostream>

int main() {
  std::cout << "Hello from CS 128!\n";
}
Program input (stdin)
Ready
Click Run to compile and execute your code.

This prototype uses a custom compile/link/run pipeline with our Clang 16.0.6 build and libc++. It targets C++20 and enables WebAssembly C++ exceptions. Native sanitizer diagnostics are not included.

How this proof of concept works

All compiler assets are served as static files. Clang compiles each source file, LLD links the objects, and a WASI worker executes the resulting Wasm. The local server serves files only. No source code is sent to a compilation service.

Compilation is limited to 30 seconds per step and execution to 5 seconds. Stop terminates the active worker. Output is capped at 64 KiB.

Clang 16 source · WASI adapter