plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
examples/basics.plum
| 0e1801a | 1 | module basics |
| 0e1801a | 2 | |
| 0e1801a | 3 | MAX_RETRIES = 3 |
| 0e1801a | 4 | PI = 3.14159 |
| 0e1801a | 5 | GREETING = "hello" |
| 0e1801a | 6 | |
| 0fe3528 | 7 | fun main() = |
| 0000000 | 8 | dec := 42 |
| 0000000 | 9 | hex := 0xFF |
| 0000000 | 10 | bin := 0b1010 |
| 0000000 | 11 | big := 1_000_000 |
| 0000000 | 12 | flt := 3.14 |
| 0000000 | 13 | flt2 := 12.0f |
| 0000000 | 14 | exp := 6.022e23 |
| 0000000 | 15 | name := "plum" |
| 0000000 | 16 | yes := True |
| 0000000 | 17 | no := False |
| 0e1801a | 18 | |
| 0000000 | 19 | sum := 1 + 2 * 3 - 4 / 2 |
| 0000000 | 20 | bits := 0b1100 & 0b1010 | 0b0001 |
| 0000000 | 21 | shifted := 1 << 4 |
| 0000000 | 22 | cmp := sum > 0 && bits != 0 || False |
| 0000000 | 23 | grouped := {1 + 2} * {3 - 1} |
| 0000000 | 24 | picked := cmp ? sum : bits |
| 0000000 | 25 | negated := -sum |
| 0000000 | 26 | positive := +sum |
| 0000000 | 27 | inverted := !cmp |
| 0000000 | 28 | a, b := 1, 2 |