超进化版C语言
一种现代系统编程语言,结合C3和Zig的优点
快速入门 | 当前状态 | 模块系统 | 现代化特性
语言对比: AZ vs C3 | AZ vs Zig
AZ语言的一大创新是提供了两种内存管理方式,开发者可以根据需求选择:
使用大括号语法表示需要显式管理内存的代码:
// 显式内存管理 - 类似Zig pub struct ArrayList<T> { vec: Vec<T> } impl ArrayList<T> { /// 释放ArrayList的内存(显式内存管理) pub fn drop(self: *ArrayList<T>) void { self.vec.drop(); } }
使用Python缩进风格表示由垃圾收集器自动管理内存的代码:
// 自动垃圾回收 - 类似ZGC pub struct ArrayList<T>: vec: Vec<T> impl ArrayList<T>: /// 在GC管理模式下,无需手动释放内存 # 内存由垃圾收集器自动管理
AZ语言实现了基于Microsoft Orleans的Virtual Actor模型,提供了简单而强大的并发编程模型:
// 定义消息类型 struct IncrementMessage {} struct GetCountMessage {} impl Message for IncrementMessage {} impl Message for GetCountMessage {} // 定义Actor struct CounterActor { id: ActorId, count: int } impl Actor for CounterActor { fn handle_message(self: *Self, message: *Message) Result<void, Error> { match message { case IncrementMessage => self.count = self.count + 1; case GetCountMessage => // 返回当前计数 } return Result.Ok(void); } fn get_id(self: *Self) ActorId { return self.id; } fn on_activate(self: *Self) Result<void, Error> { self.count = 0; return Result.Ok(void); } fn on_deactivate(self: *Self) Result<void, Error> { return Result.Ok(void); } } // 创建Actor系统 let system = actor.create_system(); // 创建Actor引用 let actor_id = actor.new_actor_id("counter1"); let actor_ref = actor.actor_of<CounterActor>(&system, actor_id); // 发送消息 let message = IncrementMessage{}; actor.send(&system, actor_ref, &message);
AZ语言的一大特色是支持中英文混合编程,开发者可以自由选择使用中文或英文标识符:
// 英文命名 let userName = "张三"; fn calculateSum(a: int, b: int) int { return a + b; } // 中文命名 let 用户名称 = "张三"; fn 计算总和(甲: int, 乙: int) int { return 甲 + 乙; }
创建 hello.az 文件:
hello.az
import std.io; fn main() int { println("Hello, AZ!"); return 0; }
运行程序:
# 编译并运行 az cl compile hello.az -o hello ./hello
std.io
std.string
std.math
std.fs
std.collections
std.net
std.async
std.actor
az mod是AZ语言的官方包管理器,提供高效的依赖管理和workspace支持:
# 创建新项目 az mod init my-project # 添加依赖 az mod add std@1.0.0 # 安装依赖 az mod install # 构建项目 az mod build
欢迎贡献代码、报告问题或提出建议!
git checkout -b feature/AmazingFeature
git commit -m 'Add some AmazingFeature'
git push origin feature/AmazingFeature
本项目采用木兰宽松许可证2.0(Mulan Permissive License,Version 2)。详见 LICENSE 文件。
用AZ,写出更安全、更高效的系统代码
Made with ❤️ by JuSanSuiYuan
⭐ Star | 🐛 Report Bug | 💡 Request Feature
Az是一门现代化系统编程语言,融合了C3的模块化设计、Zig的编译时执行(comptime)和反射机制、Python式简洁语法
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
AZ编程语言
一种现代系统编程语言,结合C3和Zig的优点
快速入门 | 当前状态 | 模块系统 | 现代化特性
语言对比: AZ vs C3 | AZ vs Zig
✨ 核心特性
🧠 双内存管理模型
AZ语言的一大创新是提供了两种内存管理方式,开发者可以根据需求选择:
显式内存管理(Zig风格)
使用大括号语法表示需要显式管理内存的代码:
自动垃圾回收(ZGC风格)
使用Python缩进风格表示由垃圾收集器自动管理内存的代码:
🎭 Actor并发模型
AZ语言实现了基于Microsoft Orleans的Virtual Actor模型,提供了简单而强大的并发编程模型:
🌍 中英文混合编程
AZ语言的一大特色是支持中英文混合编程,开发者可以自由选择使用中文或英文标识符:
🚀 快速开始
Hello World
创建
hello.az文件:运行程序:
📊 当前状态
✅ v0.1.0 - Bootstrap版本(已完成)
✅ v0.2.5 - C++前端(已完成)
✅ v0.3.0 - MLIR后端(已完成)
✅ v0.4.0 - 工具链完善(已完成)
✅ v0.5.0 - 完整实现(已完成)
📦 核心模块
标准库模块
std.io- 输入输出std.string- 字符串处理std.math- 数学运算std.fs- 文件系统操作std.collections- 集合类型std.net- 网络编程std.async- 异步编程std.actor- Actor模型az mod包管理器
az mod是AZ语言的官方包管理器,提供高效的依赖管理和workspace支持:
📖 文档
🤝 贡献
欢迎贡献代码、报告问题或提出建议!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)📝 许可证
本项目采用木兰宽松许可证2.0(Mulan Permissive License,Version 2)。详见 LICENSE 文件。
用AZ,写出更安全、更高效的系统代码
Made with ❤️ by JuSanSuiYuan
⭐ Star | 🐛 Report Bug | 💡 Request Feature