plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
c465715
— Peter John
2026-07-19T17:38:56+05:30
chore: remove old root src/ after workspace migration
Generated files not shown: Cargo.lock
- src/main.rs +0 -58
src/main.rs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
use tree_sitter;
|
|
2
|
-
use tree_sitter_plum;
|
|
3
|
-
|
|
4
|
-
fn main() {
|
|
5
|
-
let code = r#"
|
|
6
|
-
module std
|
|
7
|
-
|
|
8
|
-
import std/int
|
|
9
|
-
import std/str
|
|
10
|
-
|
|
11
|
-
PI = 3.14
|
|
12
|
-
MSG = "Hello World"
|
|
13
|
-
SUM = 1 + {{2 * 3} / 4}
|
|
14
|
-
ENABLED = !False
|
|
15
|
-
|
|
16
|
-
# Animal is a set of behavior of every animal species
|
|
17
|
-
trait Animal =
|
|
18
|
-
speak() -> Str
|
|
19
|
-
|
|
20
|
-
# Cat is an animal that meows always
|
|
21
|
-
type Cat(Animal, IToStr) =
|
|
22
|
-
name: Str
|
|
23
|
-
age: Int
|
|
24
|
-
|
|
25
|
-
withName<Cat>(name: Str) -> Cat =
|
|
26
|
-
Cat(name: name, age: self.age)
|
|
27
|
-
|
|
28
|
-
withAge<Cat>(age: Int) -> Cat =
|
|
29
|
-
Cat(name: self.name, age: age)
|
|
30
|
-
|
|
31
|
-
speak<Cat>() -> Str =
|
|
32
|
-
"meow"
|
|
33
|
-
|
|
34
|
-
toStr<Cat>() -> Str =
|
|
35
|
-
for i in 0..10
|
|
36
|
-
printLn("delta")
|
|
37
|
-
if dog > 1
|
|
38
|
-
printLn("Hellow")
|
|
39
|
-
else
|
|
40
|
-
printLn("New")
|
|
41
|
-
"Cat({self.name}, {self.age})"
|
|
42
|
-
|
|
43
|
-
main() =
|
|
44
|
-
printLn("Hello world")
|
|
45
|
-
|
|
46
|
-
"#;
|
|
47
|
-
let mut parser = tree_sitter::Parser::new();
|
|
48
|
-
let language = tree_sitter_plum::LANGUAGE;
|
|
49
|
-
parser
|
|
50
|
-
.set_language(&language.into())
|
|
51
|
-
.expect("Error loading plum parser");
|
|
52
|
-
let tree = parser.parse(code, None).unwrap();
|
|
53
|
-
assert!(!tree.root_node().has_error());
|
|
54
|
-
let mut cursor = tree.root_node().walk();
|
|
55
|
-
for item in tree.root_node().children(&mut cursor) {
|
|
56
|
-
println!("kind:{} {}", item.kind(), item.to_sexp());
|
|
57
|
-
}
|
|
58
|
-
}
|