plum

#treesitter#compiler#wasm

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

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


plum-tooling/tree-sitter-plum/test/aa.plum
module std

import std/int
import std/str

PI = 3.14
MSG = "Hello World"
SUM = 1 + {{2 * 3} / 4}
ENABLED = !False

# Animal is a set of behavior of every animal species
trait IAnimal =
  speak() -> Str

# Cat is an animal that meows always
type Cat(IAnimal, IToStr) =
  name: Str
  age: Int

  fun withName(name: Str) -> Cat =
    Cat(name: name, age: self.age)

  fun withAge(age: Int) -> Cat =
    Cat(name: self.name, age: age)

  fun speak() -> Str =
    "meow"

  fun toStr() -> Str =
    for i in 0..10
      printLn("delta")
    if dog > 1
      printLn("Hellow")
    else
      printLn("New")
    "Cat({self.name}, {self.age})"

fun main() =
  printLn("Hello world")