plum

#treesitter#compiler#wasm

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

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


examples/control_flow.plum
fun loopSum(limit: Int) -> Int =
  total := 0
  for i := range limit
    if i == 3
      continue
    if i == 8
      break
    total = total + i
  return total

fun classify(n: Int) -> Str =
  if n < 0
    return "negative"
  else if n == 0
    return "zero"
  else
    return "positive"

fun countdown(start: Int) -> Int =
  i := start
  while i > 0
    i = i - 1
  return i

fun placeholder() =
  todo

fun checkPositive(n: Int) =
  assert n > 0