plum

#treesitter#compiler#wasm

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

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


examples/basics.plum
module basics

MAX_RETRIES = 3
PI = 3.14159
GREETING = "hello"

fun main() =
  dec := 42
  hex := 0xFF
  bin := 0b1010
  big := 1_000_000
  flt := 3.14
  flt2 := 12.0f
  exp := 6.022e23
  name := "plum"
  yes := True
  no := False

  sum := 1 + 2 * 3 - 4 / 2
  bits := 0b1100 & 0b1010 | 0b0001
  shifted := 1 << 4
  cmp := sum > 0 && bits != 0 || False
  grouped := {1 + 2} * {3 - 1}
  picked := cmp ? sum : bits
  negated := -sum
  positive := +sum
  inverted := !cmp
  a, b := 1, 2