v1.0 · 零运行时 · LLVM 原生v1.0 · Zero-Runtime · LLVM Native

HP 编写
下一代人机契约
Write the Next Contract
in HP

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.

0
运行时开销Runtime Cost
C
级性能Class Perf
2
语言关键字Keyword Sets
9
编译器阶段Compiler Stages
SCROLL ↓
CORE FEATURES

为什么选择 HPWhy HP

先做减法,实现一个极致精简、零运行时开销的静态核心;再通过标准库做加法。HP 把现代系统语言的强项发挥到极致。Subtract first, add later. HP strips to a minimal zero-cost static core, then grows through its standard library.

零运行时核心Zero-Runtime Core

编译期求值、所有权检查、泛型单态化全部在编译期完成,二进制里没有解释器或虚拟机。CTFE, borrow-checking and monomorphization happen at compile time — no interpreter or VM in the binary.

# zero-cost
🌐

中英双语关键字Bilingual Keywords

fn/函数if/如果 完全等价,可中英文混写,Token 层统一映射。fn/函数, if/如果 are identical — mix freely, unified at the token layer.

# bilingual
🛡️

所有权与借用Ownership & Borrow

NLL 借用检查在编译期确定内存的分配与释放,无需 GC、无需引用计数。NLL borrow-checking decides allocation & deallocation at compile time — no GC, no refcount.

# safe
🚀

LLVM 原生性能LLVM-Native Speed

-O3 + ThinLTO + SIMD,峰值性能比手写 C 高 5%–16x(向量化场景)。-O3 + ThinLTO + SIMD deliver 5%–16x over hand-written C on vectorized workloads.

# fast
🧩

结构体 / 枚举 / 接口Struct / Enum / Trait

值语义、标签联合、编译期分派的接口(trait),运算符可重载。Value semantics, tagged unions, compile-time dispatched interfaces, overloadable operators.

# expressive
🪄

宏 / 编译期执行Macro / CTFE

macro@compileExec 在编译期展开代码、生成查找表、解析配置,零运行时开销。macro and @compileExec expand code, build lookup tables and parse config at compile time.

# metaprogramming
QUICK START

三步跑起来Three Steps to Run

1

下载编译器Get the Compiler

获取 hpc(Windows x64 / Linux / macOS),无需安装运行时。Grab hpc (Windows x64 / Linux / macOS) — no runtime to install.

2

写一段 HPWrite HP

用任意编辑器创建 hello.hp,语法像 Python 一样直白。Create hello.hp in any editor — the syntax is as direct as Python.

3

编译运行Build & Run

一条命令产出原生可执行文件,瞬间运行。One command produces a native executable that runs instantly.

hello.hp
module {
    "<std.io>"
}

fn main() {
    a: int = 1
    b: int = 2
    c: int = a + b
    std.io.print("Hello HP!", c)
}
terminal
# 编译并运行
$ hpc -O3 -o hello.exe hello.hp
$ ./hello.exe
Hello HP! 3
THE TRADE-OFF

HP 站在哪里Where HP Stands

能力CapabilityHPPythonRustC++
运行时开销Runtime overhead解释器
上手难度Learning curve
中英双语关键字Bilingual keywords
所有权系统Ownership✓ (move)手动
编译期求值CTFE
峰值性能Peak perfC 级C 级C 级
设计哲学:Design ethos: 任何运行时开销都必须在代码中有迹可循,且是程序员的显式选择。HP = 比 C 更安全、比 Zig 表达力更强、性能媲美手写 C。 Any runtime cost must be explicit and traceable in code. HP = safer than C, more expressive than Zig, as fast as hand-written C.

开始用 HP 构建Start Building in HP

完整语法书、编译器设计、示例库,全部开源。Full grammar, compiler design and example corpus — all open source.