xLang & ZAsm Official Specification
The direct evolutionary descendant of HolyC, re-engineered for custom 64-bit RISC-V (RV64) silicon, fixed-width 16-bit Hanzi parsing, and sovereign TianGan registers.
1. Language Philosophy: Code as First-Class Text & Instant JIT
xLang eliminates compilers as external tools. Every line entered into the xHunOS terminal is compiled directly in RAM into native 64-bit RISC-V machine instructions in less than 1 millisecond and executed immediately in Machine-Mode.
The shell IS the compiler, and the editor IS the runtime. Functions are invoked across the flat physical memory space without dynamic linker overhead or ABI wrappers.
> 常数 爻数 = 6;
> 函数 打印天命() {
终端输出("乾卦六爻已就绪\n");
}
> 打印天命();2. Native Fixed-Width 16-Bit Chinese Tokenizer
Mainstream compilers treat CJK text as variable-length UTF-8, requiring pointer slicing and boundary validation at every step. xLang stores source text as fixed 16-bit code units — the Basic Multilingual Plane — one code unit per array slot.
During tokenisation each Chinese ideograph occupies exactly one 2-byte word, so character n is at offset 2n and the lexer performs no slice arithmetic. This is O(1) character indexing, not O(1) parsing: the scanner still visits every token once. Scope is explicit — the BMP covers 65,536 code points, which excludes emoji, rare name characters and CJK Extension B.
| Keyword (Hanzi) | HolyC / C Equivalent | Compiler Behavior & Semantics |
|---|---|---|
| 常数 | const / #define | Compile-time constant literal emitted directly as immediate operand |
| 变量 | var / auto | Stack or global variable binding directly to general-purpose registers |
| 函数 | U0 / fn | Executable function entry point, compiled to machine code in <1ms |
| 若 / 否则 | if / else | High-speed conditional branching evaluated against BaGua CPU flags |
| 循环 | for / while | Zero-overhead loop primitive utilizing register 丙 (RCX) |
| 返回 | return | Places result in register 甲 (RAX) and restores caller stack frame |
| 结构 | class / struct | Packed, zero-padding contiguous memory struct definition |
| 公用 | public / extern | Exports symbol globally into TaiChu's root symbol table |
3. ZAsm: 64-Bit Sovereign RISC-V Register & BaGua Branch Semantics
ZAsm is the sovereign machine assembly dialect designed for our custom 64-bit RISC-V core. It maps the standard RV64 general-purpose registers (x0–x31) to the Ten Heavenly Stems and binds conditional branching to the Eight Trigrams.
Rather than relying on status register condition flags (like x86 EFLAGS), the custom RISC-V core executes direct compare-and-branch instructions, matching BaGua polarities natively in silicon.
| Heavenly Stem | RISC-V Register (RV64) | Hardware Architectural Convention |
|---|---|---|
| 甲 (Jia) | a0 / x10 | Primary accumulator · Function return value register |
| 乙 (Yi) | a1 / x11 | Secondary accumulator · Heap physical base pointer |
| 丙 (Bing) | t0 / x5 | Temporary counter · Divination shift & loop index |
| 丁 (Ding) | t1 / x6 | Data register · Hardware I/O & entropy buffer |
| 戊 (Wu) | s1 / x9 | Source index pointer · DaoFS sector read pointer |
| 己 (Ji) | s2 / x18 | Destination pointer · Framebuffer direct write pointer |
| 庚 (Geng) | s0 / fp (x8) | Frame pointer · Call stack anchor |
| 辛 (Xin) | sp / x2 | Stack pointer · Hardware push/pop pointer |
| Trigram Branch | RV64 Opcode Equivalent | Silicon Branch Condition |
|---|---|---|
| 遇乾则跳 | bnez (Branch if Non-Zero) | Pure Yang · Jump if register value is non-zero (active energy) |
| 遇坤则跳 | beqz (Branch if Zero) | Pure Yin · Jump if register value is zero (quiescent stillness) |
| 遇震则跳 | bltz (Branch if Less than Zero) | Thunder · Jump if value is negative (sign bit set) |
| 遇坎则跳 | bgez (Branch if Greater or Equal) | Water · Jump if value is positive or zero |
4. Comparative Language Evolution: Standard C vs. HolyC vs. xLang
| Language Dialect | Compilation & Execution Model | Character Standard | Register Semantics |
|---|---|---|---|
| Standard C (C11/C23) | Preprocess -> Compile -> Assemble -> Link -> ELF Binary | ASCII / Variable-Width UTF-8 | x86 / ARM registers (Western naming) |
| HolyC (TempleOS) | JIT compiled into RAM · No linking phase | 8-Bit Extended ASCII | x86-64 bare-metal registers |
| xLang (xHunOS) | Sub-millisecond JIT directly to RV64 machine code | Fixed-Width 16-Bit (BMP) Hanzi Tokens | Ten Heavenly Stems + Eight Trigrams on Custom RISC-V |