Tsuki

archived 2024
Compilers WebAssembly Rust

For my bachelor’s thesis I built Tsuki, a simple functional programming language that targets the WebAssembly VM. It borrows a bit from Austral but in syntax and semantics it’s definitely Rust’s child:

module collatz

fn collatz(n: Int) -> Int {
  if n % 2 {
    n / 2
  } else {
      3 * n + 1
  }
} 

At a glance, it’s basic features are:

  • An expression-based syntax
  • Static type systems
  • Support for first-class functions
  • Ocaml-style modules (not fully implemented)

I had a lot of fun building this, especially combing through the WebAssembly specification while working on codegen. Sadly I couldn’t include some features like: type inference, algebraic datatypes (with exhaustive pattern matching) and a language server because of my thesis deadline I plan to include them in my next language though :)