This folder is a standalone web showcase for Durin's Code. It compiles the existing C++ compiler pipeline to WebAssembly with Emscripten and runs the generated JSON bytecode in a browser TypeScript VM.
The main compiler source under ../src, top-level CMake files, tests, and examples are not modified by this web app.
- Node.js and npm
- Emscripten SDK with
emccavailable onPATH
If emcc is installed but not visible in the terminal, load it first:
source ~/emsdk/emsdk_env.shcd web
npm installnpm run build:wasmThis writes:
public/wasm/durins.jspublic/wasm/durins.wasm
npm run devOpen the printed local URL and use the example picker. The recommended demo is 04_middle_earth.dc with:
take ring
go east
go east
destroy ring
npm run build
npm run previewThe final static site can be deployed to Vercel, Netlify, or GitHub Pages.
- The browser runtime intentionally reimplements the VM in TypeScript instead of porting the terminal
runGameLoop(). - The compiler Wasm build excludes
src/main.cppandsrc/vm/vm.cpp. - The current language has a known
||caveat in TAC generation, so the showcased examples avoid OR-heavy logic.