PazeE 编译器(.NET 8/C# 实现),直接生成原生 x64/ARM64 机器码,无需 gcc/clang/nasm。 主要特性: - 词法/语法/语义分析、AST 生成、代码生成 - 目标平台:Windows (PE32+)、Linux (ELF64)、macOS (Mach-O 64)、Los4 - 架构:AMD64 与 ARM64 独立后端 - C 语法特性:匿名结构体/联合、位域、灵活数组成员、语句表达式+typeof - printf 颜色格式化、time.get.utc 时区支持 - GUI 支持:Windows (Win11 API)、Los4、Linux (X11)、macOS (ObjC) - Windows GUI 程序无控制台窗口(PE 子系统自动检测) - WiX Bundle 安装器(仅输出 .exe,MSI 作为中间产物内嵌)
33 行
738 B
Plaintext
33 行
738 B
Plaintext
// features.pe — 测试 malloc、字符串函数、各种 PazeE 语法
|
|
int main(void)
|
|
{
|
|
// 1. malloc + 字符串操作
|
|
char *s = malloc(32);
|
|
strcpy(s, "Hello");
|
|
printf("s = %s\n", s);
|
|
printf("strlen(s) = %d\n", strlen(s));
|
|
|
|
// 2. strcat
|
|
char *t = malloc(32);
|
|
strcpy(t, ", LeonOS 4!");
|
|
strcat(s, t);
|
|
printf("s+t = %s\n", s);
|
|
printf("strlen = %d\n", strlen(s));
|
|
|
|
// 3. strcmp
|
|
printf("strcmp(s,t) = %d\n", strcmp(s, t));
|
|
|
|
// 4. 数字格式化
|
|
printf("int: %d\n", 42);
|
|
printf("neg: %d\n", -17);
|
|
printf("hex: %x\n", 255);
|
|
printf("char: %c%c%c\n", 'Y', 'e', 's');
|
|
printf("multi: %d + %d = %d\n", 3, 4, 7);
|
|
|
|
// 5. free
|
|
free(s);
|
|
free(t);
|
|
|
|
return 0;
|
|
}
|