Skip to content

Repository files navigation

petal

CI

A programming language that compiles to web assembly.

# Mix of TypeScript and Rust syntax
fn add(a: Int, b: Int): Int  {
  return a + b
}

let three = add(1, 2)

# Exposed functions are exposed to the host environment in the compiled wasm module
# This function can be called from JavaScript on the web
# The goal is to automatically generate a TypeScript API for the wasm module
expose fn do_work(n: Int): Int {
  return n * 2
}

todo

This is a rough list of everything that needs to be done

  • Compiler structure setup
    • Errors
    • Lexer/Parser
    • IR generation
    • Type checking
    • Wat generation
    • Wasm bytes generation
  • Testing architecture
    • Snapshot tests
    • Output comparison
    • Assertions
  • Primitive constants
  • Binary operations
  • Unary operations
  • Control flow
    • If
    • Loops
    • Return
  • Functions
    • Creation
    • Calling
    • Return values
  • Import host functions
  • Encode wasm directly
  • Memory
  • Strings
  • Modules
  • Structs
  • Arrays
  • Generics
    • Generic typechecking
    • Polymorphic wasm generation
  • Standard library
  • Number casting
  • VSCode syntax highlighting
  • TypeScript bindings
  • Match expressions
  • Component spec generation
  • Website
    • Landing page
    • Docs
    • Dev blog
    • Playground

examples

How do we know that the language is actually useful?

  • Hello world
  • Fibonacci
  • FizzBuzz
  • Wasm4 game
  • Interop with TypeScript
  • HTTP handler

About

A programming language that compiles to web assembly

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages