Which Programming Languages Have Compilers That Can Run as WebAssembly?

August 5, 2026 3 answers
Asked by VelvetKite42
I'm designing a Minecraft mod that adds programmable computers and other devices, somewhat differently from ComputerCraft or CC:Tweaked. I'd like to use WebAssembly as the execution format, but I also need players to edit and compile code inside the game. That means the compiler itself must be able to run inside a WebAssembly runtime. Are there relatively simple languages with usable, maintained compilers available as .wasm modules? I'm aware of projects such as clang.wasm, but I'd like to know what other options exist.

Answers

QuartzMango19
If youโ€™re using the Java edition of the game, Endive may help with the runtime side. Itโ€™s a WebAssembly runtime and compiler implementation written in Java, so it can potentially be embedded directly into a mod. It doesnโ€™t answer which source languages you can compile, thoughโ€”you still need a compiler for the language you want players to use.

VelvetKite42: Iโ€™m already using that runtime. The part Iโ€™m still trying to solve is finding a language compiler that can run inside it.

Reply to this answer
MellowPine7
TinyGo is one possibility, and there are several other language toolchains that can target WebAssembly. However, there doesnโ€™t seem to be a single complete, well-maintained catalog of compilers that are themselves distributed as .wasm files. Youโ€™ll probably need to check each projectโ€™s build setup and determine whether its compiler can be built for WebAssembly.
Reply to this answer
CedarFox31
A WebAssembly compiler is rarely completely self-contained. It may need filesystem access, environment APIs, or other host functions to read source files, produce output, and manage temporary files. In a game mod, those APIs would need to be provided by Java or by the WebAssembly runtime. In principle, any compiler written in a language that can target WebAssembly could itself be compiled to .wasm, but making it practical may require substantial shims and runtime support.

BriskLemon8: That also means a compiler written in Java might be easier to integrate with the mod than a large native compiler ported to WebAssembly, depending on how much host functionality it expects.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions