by Philip Blair, Oscar Spencer
Grain is a new programming language that compiles to WebAssembly via Binaryen.

Grain is a new programming language that compiles to WebAssembly via Binaryen.

  • Powered by WebAssembly - Enter the future. Grain compiles directly to WebAssembly, taking full advantage of its speed and efficiency.
  • Sensible Types - No runtime type errors, ever. Every bit of Grain you write is thoroughly sifted for type errors, with no need for type annotations.
  • Functional Yet Flexible - Grain has its roots in functional programming, but is flexible enough to accommodate different programming styles for various applications.
enum Topping { Cheese, Pepperoni, Peppers, Pineapple }
enum Order { Pizza(Topping), Calzone(Topping) }

record Person { name: String, order: Order }

let person = { name: "Steve", order: Calzone(Pepperoni) }

match (person) {
  { order: Pizza(_), _ } => print("All pizzas are great here."),
  { order: Calzone(Peppers), _ } => print("Someone with great taste!"),
  { order: _, _ } => print("Yep, that's an order.")
}
Information updated 02/02/21
View Comments