NeverSight/NeverC

GitHub: NeverSight/NeverC

NeverC 是一款基于 LLVM 的 C23 编译器,专为安全研究和 AI 友好的代码生成设计,集成了链接器、DynCode 管道和内置运行时。

Stars: 5 | Forks: 1

**语言**:[英语](README.md) | [简体中文](docs/i18n/README.zh-CN.md) | [繁體中文](docs/i18n/README.zh-TW.md) | [日本語](docs/i18n/README.ja.md) | [한국어](docs/i18n/README.ko.md) | [Français](docs/i18n/README.fr.md) | [Deutsch](docs/i18n/README.de.md) | [Español](docs/i18n/README.es.md) | [Italiano](docs/i18n/README.it.md) | [Русский](docs/i18n/README.ru.md) | [العربية](docs/i18n/README.ar.md)
NeverC # NeverC **专为安全研究打造的、对 AI 友好的 C23 编译器,基于 LLVM 构建** 集成链接器 · DynCode pipeline · 内置 runtime(`string` · `mimalloc` · `xorstr` · `strhash`) [![AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE) [![C23](https://img.shields.io/badge/Standard-C23-brightgreen.svg)](#features) ![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20Windows-informational.svg) [![Arch](https://img.shields.io/badge/Arch-x86__64%20%7C%20AArch64-orange.svg)](#features) [文档](docs/README.md) · [DynCode 指南](docs/dyncode-compiler/README.md) · [内置 Runtime](docs/builtins/README.md) · [Plugin API](docs/plugin-api/README.md) · [路线图](docs/roadmap/README.md)
## 概述 NeverC 可将标准 C 编译为托管二进制文件、独立可执行文件和位置无关的 dyncode —— 所有这些都通过单一工具链完成。它的目标架构是 **x86_64** 和 **AArch64**(仅限小端序)。未来的版本将增加 **EVM**(以太坊智能合约)和 **Solana eBPF**(链上程序)作为编译目标。 ## 为什么选择 NeverC? C 已经是最简单的系统编程语言。NeverC 让它变得更简单: - **纯 C23,别无他物** —— 没有 templates,没有 RAII,没有运算符重载,没有隐藏的控制流。所见即所运行。 - **内置 `string`** —— 具有值语义的字符串,支持 `+`、`==`、`.starts_with()` 以及自动清理 —— 无需 C++。 - **无异常** —— 错误处理保持显式。没有 stack unwinding,没有性能方面的意外。 - **单一二进制文件** —— 编译器 + 链接器 + runtime 作为一个可执行文件发布。无需设置任何外部依赖。 - **对 LLM 友好** —— 极简的语法和确定性的语义意味着,AI 生成的 NeverC 代码比 C++ 等替代方案更容易正确编译。 - **真正的交叉编译** —— 从 macOS 或 Linux 构建 Windows PE、Linux ELF、macOS Mach-O、Android ELF 和 dyncode —— 无需 VM,无需双系统启动,无需四处寻找 SDK。平台 SDK 内置于编译器中。 - **零摩擦扩展** —— 只需一个 C 头文件和 130 个命名的编译器阶段,你就能获得一个可以拦截任何阶段(从 IR 优化到最终二进制输出)的[编译器插件](docs/plugin-api/README.md) —— 无需 LLVM 知识。 - **内置安全研究** —— DynCode 编译、编译期字符串加密和跨平台 PE 生成是该工具链的原生功能 —— 而不是事后通过外部脚本硬加上去的。 ## 功能 ## 快速示例 ``` #include typedef struct { string user; string pass; } creds; int main(void) { string msg = "Hello " + "NeverC!"; printf("%s\n", msg.c_str()); // Compile-time encryption — `strings ./bin` cannot find these literals creds login = {.user = "admin".encrypt(), .pass = "s3cret".encrypt()}; string paths[] = {"/api/v1".encrypt(), "/api/v2".encrypt()}; // Zero-allocation decrypt-and-compare (plaintext never fully in memory) if (login.user == "admin".encrypt() && login.pass == "s3cret".encrypt()) { for (int i = 0; i < 2; i++) if (msg.starts_with(paths[i])) printf("route matched: %s\n", paths[i].c_str()); } return 0; } ``` ``` # macOS arm64 / x86_64 neverc -fdyncode -target arm64-apple-macos hello.c -o hello.bin neverc -fdyncode -target x86_64-apple-macos hello.c -o hello.bin # iOS arm64 neverc -fdyncode -target arm64-apple-ios hello.c -o hello.bin # Linux x86_64 / arm64 neverc -fdyncode -target x86_64-linux-gnu hello.c -o hello.bin neverc -fdyncode -target aarch64-linux-gnu hello.c -o hello.bin # Android arm64 / x86_64 neverc -fdyncode -target aarch64-linux-android hello.c -o hello.bin neverc -fdyncode -target x86_64-linux-android hello.c -o hello.bin # Windows x86_64 / arm64 neverc -fdyncode -target x86_64-pc-windows-msvc hello.c -o hello.bin neverc -fdyncode -target aarch64-pc-windows-msvc hello.c -o hello.bin ``` 请参阅**[文档索引](docs/README.md)**以获取详细的设计说明、平台矩阵、CLI 参考和示例。如需完整的可构建示例,请参阅 **[examples](docs/examples/README.md)** 目录。 ## 构建 有关构建要求、构建命令、预构建的 macOS 二进制文件、交叉编译到 Windows、PATH 设置和环境配置,请参阅**[本地开发](docs/local-dev/README.md)**。 ## 许可证 [AGPL-3.0](LICENSE) LLVM 组件保留其 [Apache-2.0 WITH LLVM-exception](llvm/LICENSE.TXT) 许可证。
标签:DNS 反向解析, LLVM, SOC Prime, 二进制构建, 客户端加密, 开发工具, 编译器