plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


examples/types.plum
type Point =
  x: Int
  y: Int

type Named(Stringable) =
  name: Str

type Box[T] =
  value: T

trait Shape =
  area() -> Float
  perimeter() -> Float

trait Comparable[T: Ord] =
  compareTo(other: T) -> Int

enum Color =
  | Red
  | Green
  | Blue

enum Option =
  | Some[Int]
  | None

fun makeIntBox() -> Box =
  Box(value: 5)

fun makeStrBox() -> Box =
  Box(value: "x")