ZEN CCommunity Edition
現代工程學。
零開銷。
純粹的 C。
帶有模式匹配的系統語言。
$ git clone https://github.com/zenc-lang-ce/zenc.git
echo_server.zc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import "std/net/tcp.zc"
fn main() {
"迴聲伺服器監聽埠 :8080";
let listener = TcpListener::bind("127.0.0.1", 8080).unwrap();
loop {
// 接受新連接
let stream = listener.accept().unwrap();
let buf: char[1024];
while true {
let n = stream.read(&buf[0], 1024).unwrap();
if n == 0 { break; }
stream.write(&buf[0], n);
}
}
}
專為以下領域設計:
遊戲
•
高效能軟體
•
嵌入式系統
•
核心開發
編譯
複製
git clone https://github.com/zenc-lang-ce/zenc.git
建構
make
安裝
sudo make install
支援 GCC/Clang!
最大控制。
體驗 C 的透明度。
真的有人看嗎.zc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
struct Features {
transparent_compilation: bool;
native_c_abi: bool;
resource_management: bool;
monomorphization: bool;
pattern_matching: bool;
async_await: bool;
}
impl Features {
// 建構子。所有特性均已開啟!
fn new() -> Self {
return Features{
transparent_compilation: true,
native_c_abi: true,
resource_management: true,
monomorphization: true,
pattern_matching: true,
async_await: true,
};
}
// 一行描述語言
fn describe(self) {
println "現代工程學。零開銷。純粹的 C。";
}
}
fn main() {
let zc = Features::new();
zc.describe();
}
transparent_compilation
純 C11。
native_c_abi
零 FFI。
resource_management
無 GC。
monomorphization
零開銷泛型。
async_await
非同步 I/O。
pattern_matching
模式匹配。
zero_cost_generics
無虛分派。
互通
適應生態。
CUDA
--cudaGPU.
@global
fn add(a: float*, b: float*) {
let i = thread_id();
a[i] += b[i];
}
C++
--cppC++.
raw {
std::vector<int> get_vec() {
return {1, 2, 3};
}
}
Objective-C
--objcmacOS.
raw {
id pool = [[NSPool alloc] init];
[pool drain];
}
社區影片
觀看教學。
路線圖
我們的願景。
0x00
當前
核心語言
- C 轉譯
- C++ 互通
- RAII
- 泛型
- LSP
0x10
下一步
生態
- 套件管理
- Wasm
- LSP增強
- 擴充 std
0x20
展望
語意
- async
- comptime
- 外掛
- 自舉編譯器
0x30
終點
1.0
- 語言規範
- API 凍結
- ABI 穩定
- 核心案例