[HN Gopher] Compiling Scheme to WebAssembly
___________________________________________________________________
Compiling Scheme to WebAssembly
Author : chmaynard
Score : 50 points
Date : 2026-01-17 23:29 UTC (4 days ago)
(HTM) web link (eli.thegreenplace.net)
(TXT) w3m dump (eli.thegreenplace.net)
| nhatcher wrote:
| Eli Bendersky's post are always insightful and interesting.
|
| I really would like to see a small language that compiles to wasm
| in the browser.
|
| Of course you can use things like Lua that has it's own vm also
| in wasm. Or Rhai with it's own interpreter. But I am looking for
| a language that compiles to wasm in less than 1Mb of wasm
| tromp wrote:
| Ben Lynn's page https://crypto.stanford.edu/~blynn/compiler/
| compiles (a large subset of) Haskell to web assembly (which you
| can download; a prime number sieve yielded 40KB of code) and
| runs it in the browser.
| mathisfun123 wrote:
| you can just compile c/c++ to wasm in the browser - there are
| wasi/emscripten builds of clang itself around (yosys, clang-
| repl, etc).
| zamadatix wrote:
| C based Mandelbrot WASM demos can be ~1 KB total. Assuming you
| mean a simple scripting language though, Assembly Script does
| exactly that.
| spankalee wrote:
| AssemblyScript ships its own garbage collector and doesn't
| seem to making progress on supporting WASM GC.
| spankalee wrote:
| I'm working on a TypeScript/Swift/Dart style language, and
| currently this hello-world is 1444 bytes:
| export let main = () => { console.log("Hello,
| World!"); };
|
| I'm trying to make that smaller. The binary includes the
| Console class, which is needed (I may be able to tree-shake the
| non log() methods away), but also the Error and
| IndexOutOfBoundsError classes which aren't needed because there
| are no catch() expressions.
|
| I think it really helps to have a language designed from the
| ground-up to obsess over bytes for WASM. Trying to do that with
| a familiar high-level language with a rich standard library is
| tricky.
| dleslie wrote:
| Related: the uLisp assembler. It's small, elegant, and well-
| documented.
|
| http://www.ulisp.com/show?2Z88
| dannyobrien wrote:
| Also (on the bigger than this rather than smaller), Hoot,
| Spritely's Guile-on-Wasm project
| https://spritely.institute/hoot/
___________________________________________________________________
(page generated 2026-01-22 23:00 UTC)