plum

#treesitter#compiler#wasm

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

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


0bb6882Peter John 2026-07-24T11:49:51+05:30
feat(examples): migrate types.plum, functions.plum, match.plum generics to bracket syntax
examples/functions.plum CHANGED
@@ -13,10 +13,10 @@ sumAll(nums: ...Int) -> Int =
13
13
  total = total + v
14
14
  total
15
15
 
16
- wrap(value: a) -> Bool =
16
+ wrap(value: T) -> Bool =
17
17
  True
18
18
 
19
- pair(first: a, second: b) -> Bool =
19
+ pair(first: T, second: U) -> Bool =
20
20
  True
21
21
 
22
22
  useWrap() -> Bool =
examples/match.plum CHANGED
@@ -4,7 +4,7 @@ enum Color =
4
4
  | Blue
5
5
 
6
6
  enum Option =
7
- | Some(Int)
7
+ | Some[Int]
8
8
  | None
9
9
 
10
10
  describeNumber(n: Int) -> Str =
examples/types.plum CHANGED
@@ -5,15 +5,15 @@ type Point =
5
5
  type Named(Stringable) =
6
6
  name: Str
7
7
 
8
- type Box(a) =
8
+ type Box[T] =
9
- value: a
9
+ value: T
10
10
 
11
11
  trait Shape =
12
12
  area() -> Float
13
13
  perimeter() -> Float
14
14
 
15
- trait Comparable(a: Ord) =
15
+ trait Comparable[T: Ord] =
16
- compareTo(other: a) -> Int
16
+ compareTo(other: T) -> Int
17
17
 
18
18
  enum Color =
19
19
  | Red
@@ -21,7 +21,7 @@ enum Color =
21
21
  | Blue
22
22
 
23
23
  enum Option =
24
- | Some(Int)
24
+ | Some[Int]
25
25
  | None
26
26
 
27
27
  makeIntBox() -> Box =