Website | Source | Docs | Core library - open-sourced standard library, compiler source code is not available yet.

MoonBit is an end-to-end programming language toolchain for cloud and edge computing using WebAssembly. The language is like Rust with GC support. The fast compiler is optimized to produce very compact WASM binaries.

Getting Started

As of 6 Oct 2025, installation is via VSCode extension ("Moonbit Language") or manual (via curl): curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash (macOS/Linux) or Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex (POSH)

Examples

///|
fn main {
  // explicit type annotation
  let a1 : Int = 10
  println((10 : Int))

  // Variable with type inference (Int inferred from value 20)
  let b = 20
  println("a + b = \{a1 + b}")

  // Mutable variable - can be modified
  let mut c = 10
  println("c before: \{c}")
  c = c + 1
  println("c after: \{c}")

  // Immutable variable - cannot be modified
  let d = 20
  println("d = \{d}")
  // d = d + 1  // Uncommenting this line will cause a compilation error
}

Language Tour


Tags: language   web assembly   browser  

Last modified 14 December 2025