plum

#treesitter#compiler#wasm

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

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


plum-examples/basics.plum
0e1801a 1
module basics
73b5e55 2
import std/Bool
ca5fd6f 3
import std/Number
29313cb 4
import std/Str
0e1801a 5
0e1801a 6
MAX_RETRIES = 3
73e4ff1 7
GOLDEN_RATIO = 1.61803
0e1801a 8
GREETING = "hello"
0e1801a 9
0fe3528 10
fun main() =
a271f34 11
  dec := 42
a271f34 12
  hex := 0xFF
f13d4c2 13
  bin := 0b1010
a271f34 14
  big := 1_000_000
a271f34 15
  flt := 3.14
a271f34 16
  flt2 := 12.0f
73e4ff1 17
  avogadro := 6.022e23
a271f34 18
  name := "plum"
a271f34 19
  yes := True
a271f34 20
  no := False
a271f34 21
  sum := 1 + 2 * 3 - 4 / 2
f13d4c2 22
  bits := 0b1100 & 0b1010 | 0b0001
a271f34 23
  shifted := 1 << 4
a271f34 24
  cmp := sum > 0 && bits != 0 || False
a271f34 25
  grouped := {1 + 2} * {3 - 1}
a271f34 26
  picked := cmp ? sum : bits
a271f34 27
  negated := -sum
a271f34 28
  positive := +sum
a271f34 29
  inverted := !cmp
a271f34 30
  a, b := 1, 2