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 稳定
- 内核案例