HolyC to WebAssembly. A compiler and runtime for running HolyC programs in browsers and Node.js.
Try the editor in TempleOS-Web →
Use the compiler
From a JavaScript module in this checkout:
import {compileHolyC} from "./src/compiler.js";
import {createHost} from "./src/runtime/host.js";
const {bytes}=compileHolyC('"Hello\n";',{lenient:false});
const host=createHost({ansi:false,onText:text=>process.stdout.write(text)});
const {instance}=await WebAssembly.instantiate(bytes,{env:host.env});
host.attach(instance);
instance.exports.__main();Use lenient:false so unsupported symbols and calls produce errors. The older lenient mode can replace them with zeros.
What it supports
The runtime supplies graphics, sound, keyboard input, memory and supported TempleOS APIs. Apps/HEMU supplies the WebAssembly host for HEMU's HolyC machine; HolyC-fmt uses it to run its HolyC formatter.
This is a compiler and compatibility runtime, not the TempleOS kernel. Native language behavior is checked against V5.03, but unsupported assembly, hardware and OS behavior remain. A successful compile alone does not establish compatibility.
Development
npm test
npm run test:strictRuntime HolyC lives in Kernel/, Compiler/ and Adam/. Run npm run generate
after editing it; npm test also checks that its generated browser module is current.
The tests compare WASM behavior with recorded TempleOS V5.03 results. Reproducing the native oracle also needs its documented QEMU and disk setup.
Credits
TempleOS, HolyC, the sword-and-scales artwork and the 8×8 system font were created by Terry A. Davis. TempleOS is public domain. The banner uses its font and artwork.