HP(河马编程语言)是一门零运行时、静态类型、中英双语关键字的系统级语言。像 Python 一样好写,像 C 一样快。 HP (Hippo Programming Language) is a zero-runtime, statically-typed systems language with bilingual (中文/English) keywords — as ergonomic as Python, as fast as C.
先做减法,实现一个极致精简、零运行时开销的静态核心;再通过标准库做加法。HP 把现代系统语言的强项发挥到极致。Subtract first, add later. HP strips to a minimal zero-cost static core, then grows through its standard library.
编译期求值、所有权检查、泛型单态化全部在编译期完成,二进制里没有解释器或虚拟机。CTFE, borrow-checking and monomorphization happen at compile time — no interpreter or VM in the binary.
fn/函数、if/如果 完全等价,可中英文混写,Token 层统一映射。fn/函数, if/如果 are identical — mix freely, unified at the token layer.
NLL 借用检查在编译期确定内存的分配与释放,无需 GC、无需引用计数。NLL borrow-checking decides allocation & deallocation at compile time — no GC, no refcount.
-O3 + ThinLTO + SIMD,峰值性能比手写 C 高 5%–16x(向量化场景)。-O3 + ThinLTO + SIMD deliver 5%–16x over hand-written C on vectorized workloads.
值语义、标签联合、编译期分派的接口(trait),运算符可重载。Value semantics, tagged unions, compile-time dispatched interfaces, overloadable operators.
macro 与 @compileExec 在编译期展开代码、生成查找表、解析配置,零运行时开销。macro and @compileExec expand code, build lookup tables and parse config at compile time.
获取 hpc(Windows x64 / Linux / macOS),无需安装运行时。Grab hpc (Windows x64 / Linux / macOS) — no runtime to install.
用任意编辑器创建 hello.hp,语法像 Python 一样直白。Create hello.hp in any editor — the syntax is as direct as Python.
一条命令产出原生可执行文件,瞬间运行。One command produces a native executable that runs instantly.
module {
"<std.io>"
}
fn main() {
a: int = 1
b: int = 2
c: int = a + b
std.io.print("Hello HP!", c)
}
# 编译并运行
$ hpc -O3 -o hello.exe hello.hp
$ ./hello.exe
Hello HP! 3
| 能力Capability | HP | Python | Rust | C++ |
|---|---|---|---|---|
| 运行时开销Runtime overhead | 零 | 解释器 | 零 | 零 |
| 上手难度Learning curve | 低 | 低 | 高 | 高 |
| 中英双语关键字Bilingual keywords | ✓ | — | — | — |
| 所有权系统Ownership | ✓ (move) | — | ✓ | 手动 |
| 编译期求值CTFE | ✓ | — | ✓ | — |
| 峰值性能Peak perf | C 级 | 慢 | C 级 | C 级 |
完整语法书、编译器设计、示例库,全部开源。Full grammar, compiler design and example corpus — all open source.