19
19
20
20
## CONTRIBUTING
21
21
22
- 中文见[ 此处] ( ./CONTRIBUTING-CN.md )
23
- 欢迎加入[ qq群] ( http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=vjKI1nbRHAIz1UbmDOjttLurEw93mLhA&authKey=U6cUmnIxiptTskr9trZZ9vc2p291uWht8TlzPSOEPXliihLC9vAYMaRwDI0%2FolR8&noverify=0&group_code=688301255 )
22
+ [ CONTRIBUTING] ( CONTRIBUTING.md ) |[ 贡献代码] ( https://pivotlang.tech/docs/CONTRIBUTING-CN.html )
23
+
24
+ 欢迎加入: [ QQ群] ( http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=nlRLeRcRfr0SxXcLYsjsXobP6X7EeV_c&authKey=rdyEXtc0uMqjYS4i%2FJapoi7CUdwtKgtK5V8Xv0WKgIIb9n4ZkFaIo9mgkflqV%2Frf&noverify=0&group_code=688301255 ) [ discord] ( https://discord.gg/ZYNhYu6sW9 )
24
25
25
26
## dependencies
26
27
27
- - [ llvm -18] ( https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.2 )
28
- - [ rust ] ( https://www.rust-lang.org/ )
28
+ - [ LLVM -18] ( https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.5 )
29
+ - [ Rust ] ( https://www.rust-lang.org/ )
29
30
30
31
** 重要** :如果你想参与开发,请先在项目目录` make vm install ` ,然后根据自己是linux还是mac运行` make devlinux ` 或者` make devmac `
31
32
32
33
## 特点
33
34
34
35
- 支持静态编译与JIT
36
+ - [ 高性能] ( ./performance.md )
35
37
- REPL
36
38
- 热重载
37
- - 极其方便的Rust互操作
39
+ - 极其方便的Rust/C互操作
38
40
- 支持debug
39
41
- 支持lsp,自带[ vsc插件] ( https://github.com/Pivot-Studio/pivot-lang-support ) ,能提供优秀的代码支持
40
42
- 有GC,自动管理内存
41
43
- 强大的类型推断,支持省略大部分类型标注
42
44
43
- ## 一些ShowCase
45
+ ## 一些ShowCases
46
+
47
+ ### [ Ray Tracing in One Weekend in Pivot Lang] ( https://github.com/Pivot-Studio/rtweekend-pl )
48
+
49
+ 使用Pivot Lang实现的简单光追
50
+
51
+ ![ example] ( imgs/2024-02-21-11-46-55.png )
52
+
53
+ ### 编辑器支持
54
+
55
+ ![ debug] ( imgs/2024-02-21-11-50-11.png )
56
+
57
+ ![ lsp] ( imgs/2024-02-21-11-50-25.png )
44
58
45
59
### Hello World
46
60
@@ -61,7 +75,7 @@ use core::panic::assert;
61
75
use core::eq::*;
62
76
63
77
fn main() i64 {
64
- let table = hashtable::new_hash_table<string|string> (10 as u64, 1 as u64);
78
+ let table = hashtable::new_hash_table(10 as u64, 1 as u64);
65
79
table.insert("hello","world");
66
80
table.insert("bye","bye");
67
81
assert(table.get("hello") is string);
@@ -101,7 +115,7 @@ fn fib(n: i64) i64 {
101
115
``` pivot
102
116
use core::panic;
103
117
pub fn main() i64 {
104
- let g = |f: |i64| => i64 , x: i64 | => i64 {
118
+ let g = |f, x| => {
105
119
if x == 0 {
106
120
return 1;
107
121
}
@@ -114,6 +128,7 @@ pub fn main() i64 {
114
128
return 0;
115
129
}
116
130
131
+
117
132
struct Func<A|F> {
118
133
f: |Func<A|F>, A| => F;
119
134
}
@@ -126,19 +141,17 @@ impl<A|F> Func<A|F> {
126
141
}
127
142
128
143
fn Y<A|R>(g: ||A| => R, A| => R) |A| => R {
129
- return |x: A| => R {
130
- let in = |f: Func<A|R>, x: A| => R {
144
+ // 下方代码的类型推断是一个很好的例子
145
+ return |x| => {
146
+ return |f, x| => {
131
147
return f.call(f, x);
132
- };
133
- let field = |f: Func<A|R>, x: A| => R {
134
- return g(|x: A| => R {
135
- return f.call(f, x);
136
- }, x);
137
- };
138
- let f = Func{
139
- f: field
140
- };
141
- return in(f, x);
148
+ }(Func{
149
+ f: |f, x| => {
150
+ return g(|x| => {
151
+ return f.call(f, x);
152
+ }, x);
153
+ }
154
+ }, x);
142
155
};
143
156
}
144
157
@@ -150,5 +163,4 @@ fn fact_recursion(x: i64) i64 {
150
163
}
151
164
152
165
153
-
154
166
```
0 commit comments