neuron-explorer
Steering-first neuron explorer for Qwen3.5-4B: push every MLP neuron, keep every rollout, browse the results
A C and C++ compiler written in plain JavaScript compiles the unmodified source of DOS-era and early-Linux games and emulators, and runs them in the tab. Play, or write C in Live C.
Developer toolsJavaScript · CGitHub @jfrelat-labOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Compile Quake, Doom, MAME and ScummVM from their original C/C++ source and play them in your browser. A C and C++ compiler written in plain JavaScript, no WebAssembly.
Taken from the repository README
Loading the full README.
Read the full README ↗A C and C++ compiler that targets JavaScript and is itself written in plain JavaScript. It compiles the unmodified source of games and emulators from the DOS, Windows 95 and early Linux era — MAME, Quake, Doom, ScummVM, Keen Dreams — and runs them in a browser tab or in Node.
No WebAssembly, no build step, no dependencies. The compiler runs in the page.
Try it: prism-compiler.pages.dev — the games, compiled and playing in the tab, and Live C: type C or C++ (console, GLUT, SDL, X11 or Win32) and run it, or load one of Rosetta Code's solutions.
Every picture is a frame PRISM drew from the game's unmodified source. ▶ starts the game; the others open the showcase, which asks for your copy.
C / C++ / asm source ─▶ preprocessor ─▶ parser + sema ─▶ JavaScript source ─▶ the engine's own JIT ─▶ run
(gcc -E exact) (i386 or 16-bit (readable, one function
DOS ABI, exact) per C function)
The game is not ported. Its source compiles as it shipped, and the platform it was written for is supplied in JavaScript underneath it. That platform covers:
Nothing in a game's tree is edited. Build switches the tree already has are configuration, not modification.
PRISM has a sibling, MIRAGE, which recompiles a program's x86 binary. MIRAGE needs a binary and no source; PRISM needs published source and no binary.
far, _seg and huge pointers.asm, whole TASM modules, Watcom #pragma aux and NASM.Per-program status, and what each one is checked against, is in docs/COMPAT.md. None of that software is in this repository; see Third-party software.
| Reaches | |
|---|---|
| MAME 0.34 (DJGPP, Allegro, SEAL); 0.1 to 0.7 before it | 15 of 15 games bit-identical to a native gcc build over 1,500 frames |
| Quake: DOS, X11, svgalib, SunOS, Win32; GLQuake | the same pixels on four platform layers; GLQuake within 1 pixel of 307,200 of Mesa |
| Quake II (software and GL), Quake III Arena, Enemy Territory | play; Quake II GL within 3 pixels of Mesa |
| Doom, Heretic, Hexen, Hexen II | play; Doom with its sound server as a second process |
| ScummVM 0.6.1 and 0.10.0, thirteen engines | 3,000 of 3,000 frames and every audio buffer equal to a native g++ build, for each of 20 game demos |
| Keen Dreams (16-bit Borland C++ and TASM) | plays; its screens are the shipped KDREAMS.EXE's under DOSBox-X |
| OpenDUNE, Jump 'n Bump, SDLPoP, OpenTyrian, Tux Racer, Cube, Chromium B.S.U. | play; most are pinned to a reference build |
| Lua 5.4, PuTTY, SQLite, Tcl 8.4 | their own test suites, or gcc's output |
What does not work yet:
Tier-0 output is about 9.5× slower than clang -O2 native on the same benchmark. That is enough
for the games above: Quake's own timedemo reports several hundred frames a second. In the browser,
with the WebGL backend, Cube runs at about 145 fps and Enemy Territory at about 30 fps in a map.
Node 22. The upstream sources are not in the repository. Each targets/*.json has a fetch line
saying where its source comes from and where to unpack it under corpus/, which git ignores.
git clone --depth 1 -b v5.4.7 https://github.com/lua/lua.git corpus/lua # targets/lua.json's fetch line
node tools/build.mjs targets/lua.json --run "--args=-e print(6*7)" # compiles Lua, prints 42
node tools/build.mjs --list # every target and variant
node tools/serve.mjs --data=/path/to/your/game/files # the browser shell
Open the printed URL, pick a program, give it its data files and press Run. The shell compiles
the program in a worker. It shows a text screen until the program opens a display, then the
display. Each program is a descriptor in web/programs/*.json. The dev server exists because
SharedArrayBuffer needs the COOP/COEP headers. The page loads src/ as plain ES modules, so the
browser runs the same files the Node gates run.
Live C (web/live/) is the part that needs nothing else: type C or C++ and run it in the page,
with the emitted JavaScript beside it. It works from any static host; on one that does not send the
COOP/COEP headers (GitHub Pages), web/coi-sw.js adds them. The repository's index.html is
the project page for GitHub Pages and links to it.
A static showcase. node tools/site.mjs writes site/, a copy of the shelf that needs no
server: the programs whose code and data may be passed on, each precompiled with its licences and
the source it was built from, and a gallery that plays the visitor's own copy of the rest. That is
what prism-compiler.pages.dev serves. How it is built, checked and
hosted, and how the page adapts to the visitor's language and keyboard: docs/SITE.md.
No game data is fetched or stored by this repository. The page reads only the files you
give it, or a directory you name with --data.
A comparison proves something only if it gives the same answer every time it is made. PRISM is built so that it does:
__DATE__ and __TIME__
are fixed (Jan 1 1996, 00:00:00) rather than the wall clock, as SOURCE_DATE_EPOCH fixes
them for gcc. A precompiled bundle is keyed by a hash of the compiler and the program, so it is
rebuilt exactly when one of them changes.Only the page relaxes this, where a person is watching: Live C stamps __DATE__ with the present,
and a game in the browser runs on the real clock. The gates keep a fixed date, UTC and US key
positions.
PRISM is checked against other compilers and other machines, never against its own expectations.
node tools/gates.mjs runs every gate and reports each as PASS, SKIP or FAIL. A gate that needs
something the repository does not ship (a corpus, game data, the gcc container) reports SKIP, not
FAIL.
| Gate | Reference |
|---|---|
| Preprocessor | gcc -E, token for token, including 289 whole translation units |
i386 layout (sizeof, offsetof, bitfields) | gcc 12 i386, about 105,000 checks |
| 16-bit layouts and execution | Open Watcom and Borland C++ 2.0, run under DOSBox-X |
| c-testsuite, gcc.c-torture/execute | 0 wrong answers |
| Random programs (csmith) | gcc -O0 and -O2 |
| TASM front end; translated TASM routines | Turbo Assembler 2.5's object code; that object code run under Unicorn |
| C++ features | g++, case by case |
| Games | native builds of the same sources (MAME, ScummVM, Quake), Mesa (the GL programs), the shipped DOS binaries under DOSBox-X (Keen Dreams, Dune II, Jump 'n Bump) |
| GLU, SDL_mixer, zlib | libGLU, SDL_mixer 1.2 and gcc-built zlib, to the bit |
Every gate carries a control: a deliberate mutation that it must catch. A gate that cannot fail
proves nothing. The references that need a C compiler run in a linux/386 gcc container
(npm run oracle:build). Gates that compare against one replay committed goldens, so most can run
without it. docs/TESTING.md has the details.
Is it an emulator? No. Nothing x86 is executed: the game's C source is compiled to JavaScript, and the machine it was written for (DOS, Win32, X11, SDL, OpenGL...) is supplied as libraries underneath it. Its sibling project MIRAGE is the other approach: it recompiles a program's x86 binary.
Why JavaScript and not WebAssembly? Readable output, run by the browser's own JIT: one JavaScript function per C function, which is what makes a defect findable by reading. The choice is measured, not assumed: the comparison page sets PRISM against Emscripten, Cheerp and an emulated x86 build, on compile time, run time and size.
Is it fast enough? For these games, yes: about 9.5× slower than clang -O2 with no optimiser
yet, and Quake's own timedemo reports several hundred frames a second. See How fast.
What can I play without any files? Everything with a Play button on
the showcase (its Play now filter): programs whose code and data may be passed on --
the DOOM and Heretic shareware, the Monkey Island, Day of the Tentacle and Sam & Max demos, Beneath
a Steel Sky, Tux Racer, Cube and more. The others ask for your files: give the page your game's folder
or .zip and it plays from there. Your files are read in your browser and sent nowhere.
What about licences? PRISM is MIT. This repository holds no game, no game data and no ROM. The showcase ships only builds whose code and data may be passed on, each with its licences and the exact source it was built from (prism-sources releases), and says so where a caution applies.
What does it need from the browser? SharedArrayBuffer, so cross-origin isolation (the site
sends the headers; any static host can, through _headers or web/coi-sw.js), and WebGL 2 for the
3D games. It is developed and checked mostly in Chromium-based browsers.
Can I compile my own code? In the page, with Live C:
console programs and GLUT, SDL, X11 or Win32 windows, several files, C or C++. Locally, a
targets/*.json describes a whole program and tools/build.mjs compiles and runs it in Node (see
Quick start).
What does "written with Claude Code" mean? The code in this repository was written by Claude Code, Anthropic's coding agent; the commit messages carry its name. None of it is taken on trust: every claim about C, a library or a picture is held to an independent implementation by a gate (see How it is tested), and the runs are deterministic so anyone can check them again.
Reference documents describe the present state:
The record is LOG.md: the long form of every roadmap row up to 2026-09-27, with the measurements, dead ends and defects found. Later work is recorded in commit messages.
This repository contains PRISM and the small test programs written for it (tests/). It contains no
game, game data, emulator source or ROM. The tools that need them look in corpus/ (sources) or in a
directory you name (data). Both are ignored by git. Bring your own, and check that you are allowed
to use what you bring.
Some parts of PRISM's runtime reproduce a library's behaviour from that library's source. Those parts, and their licences, are listed in THIRD-PARTY.md.
PRISM was written with Claude Code.
MIT, except where THIRD-PARTY.md says otherwise. The licence covers PRISM itself, not the programs you compile with it.