~repos /plum

#treesitter#compiler#wasm

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

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


2c5c010b Peter John

HEAD -> master

7 months ago
add cmake
Files changed (1) hide show
  1. cmake.hs +48 -0
cmake.hs ADDED
@@ -0,0 +1,48 @@
1
+ struct Cat {
2
+ val name: Str
3
+ val age: Int
4
+
5
+ fn init(allocator: *Allocator) Cat {
6
+ return Cat {
7
+ name: Str.alloc(allocator)
8
+ }
9
+ }
10
+ }
11
+
12
+ enum ReadError =
13
+ | Eof
14
+ | Closed
15
+
16
+ enum WriteError =
17
+ | Eof
18
+ | Closed
19
+
20
+ fn getTime(dt: DetermineTime) Int? =
21
+ if dt == 123 then
22
+ Some(dt)
23
+ else
24
+ None
25
+
26
+ fn compare(x: Int y: Int) -> Ordering = match
27
+ | x > y = GT
28
+ | x == y = EQ
29
+ | x < y = LT
30
+
31
+ fn countThrows(n: Int) -> Array<Array<Int>> = do
32
+ x <- 1 .. 6
33
+ y <- 1 .. 6
34
+ if x + y == n then
35
+ [x, y]
36
+ else
37
+ empty
38
+
39
+ getTime()
40
+ |> putLnStr
41
+ |> Task.err
42
+
43
+
44
+ # for is a builder function which exposes continue/break methods
45
+ for (items) \d ->
46
+ if d == "5" then
47
+ break()
48
+ putLnStr(d)