Stream: general

Topic: WASM or Cranelift for programming language backend?


view this post on Zulip Srayan Jana (Nov 20 2025 at 05:29):

Hello!
Im curious, if I wanted to make my own programming language, would yall recommend to compile down to WASM or Cranelift. (Let's ignore the obvious advantage WASM has in that it can run in the browser n stuff)

view this post on Zulip Lann Martin (Nov 20 2025 at 14:29):

That cannot be answered without more information about your goals and constraints, but my answer is "almost certainly Wasm". :slight_smile:

view this post on Zulip Srayan Jana (Nov 21 2025 at 17:33):

I ask because I’ve seen a couple of new languages like Scheme-rs use crane lift, (and obviously rust uses it) so maybe it’s like crane lift can do stuff that WASM can’t? (Though rust can ALSO compile down to WASM so….)

view this post on Zulip Srayan Jana (Nov 21 2025 at 17:33):

I guess the main thing is that wasm is automatically sandboxed and needs to be run in a VM while cranelift compiled down to normal machine code

view this post on Zulip Chris Fallin (Nov 21 2025 at 17:46):

I think the main factors in either direction are:

view this post on Zulip Chris Fallin (Nov 21 2025 at 17:47):

If I were designing a new language with a compiler, a Wasm backend would be an easy choice for me -- the universality is worth it. But if you want to play with low-level performance or you want a toolchain that can build native binaries then by all means feel free to play with Cranelift

view this post on Zulip Srayan Jana (Nov 21 2025 at 19:48):

That makes sense, thanks yall!

view this post on Zulip とが (Nov 25 2025 at 18:49):

Hmm?? Cranelift is a backend of wasm, right? Is there any difference between compiling down to wasm and to cranelift?

view this post on Zulip Chris Fallin (Nov 25 2025 at 18:57):

Cranelift is a compiler library. Wasmtime uses Cranelift to compile Wasm to machine code. But Cranelift is not Wasm-specific.

Is there any difference between compiling down to wasm and to cranelift?

Put simply, yes. In one case you emit Wasm bytecodes. In another case you emit Cranelift IR.


Last updated: Dec 06 2025 at 05:03 UTC