xLang & ZAsm Official Specification
The direct evolutionary descendant of Terry A. Davis's HolyC compiler, re-engineered for 16-bit UCS-2 Hanzi parsing and sovereign register semantics at processor Ring 0.
1. Language Philosophy: Code as First-Class Text & Instant JIT
xLang dissolves the traditional boundaries between scripting languages, bytecode virtual machines (such as the JVM), and compiled binaries (ELF/PE). Every line entered into the xHunOS terminal is compiled in memory within 1 millisecond into native x86-64 machine code and executed instantly.
The shell IS the compiler, and the editor IS the runtime. In xLang, source code integrates seamlessly into the DolDoc hypertext system. Once declared, any function can be invoked across the single flat address space by any task via direct memory pointers, without dynamic library (DLL/.so) loading penalties.
> 常数 爻数 = 6;
> 函数 打印天命() {
终端输出("乾卦六爻已就绪\n");
}
> 打印天命();2. Native 16-Bit UCS-2 Fixed-Width Chinese Tokenizer
Mainstream compilers treat non-Latin text as variable-length UTF-8 sequences, requiring dynamic pointer slicing and string boundary validations. xLang is built natively on a fixed 16-bit UCS-2 character encoding.
During lexical tokenization, each Chinese ideograph aligns to a 2-byte machine word, achieving O(1) lexical parsing directly from raw source code into the AST without byte-slice overhead.
| 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 Register & Condition Flags
ZAsm is the sovereign machine assembly layer executing directly on x86-64 hardware. Rejecting western alphabetical mnemonics, it maps 64-bit general-purpose CPU registers to the Ten Heavenly Stems and binds condition flags to the Eight Trigrams.
By establishing autonomous register and instruction semantics, ZAsm-generated machine code is inherently immune to automated pattern recognition and vulnerability scanning by conventional decompilers (such as IDA Pro and Ghidra).
| Heavenly Stem | x86-64 Register | Hardware Architectural Convention |
|---|---|---|
| 甲 (Jia) | RAX | Primary accumulator · Primary return value register |
| 乙 (Yi) | RBX | Base register · Heap memory base physical pointer |
| 丙 (Bing) | RCX | Counter register · Shift and divination loop counter |
| 丁 (Ding) | RDX | Data register · Direct hardware I/O and entropy buffer |
| 戊 (Wu) | RSI | Source index register · DaoFS flash sector read pointer |
| 己 (Ji) | RDI | Destination index register · Framebuffer write pointer |
| 庚 (Geng) | RBP | Stack frame base pointer · Task stack anchor |
| 辛 (Xin) | RSP | Stack top physical pointer · Hardware push/pop pointer |
| Trigram Branch | Bound CPU Flag | Mathematical Branch Condition |
|---|---|---|
| 遇乾则跳 | CF (Carry Flag) | Pure Yang · Jump if unsigned addition carry or subtraction borrow occurs |
| 遇坤则跳 | ZF (Zero Flag) | Pure Yin · Jump if arithmetic result is zero or equality test matches |
| 遇震则跳 | SF (Sign Flag) | Thunder · Jump if most significant bit is 1 (negative polarity) |
| 遇坎则跳 | OF (Overflow Flag) | Water · Jump if signed integer arithmetic undergoes overflow |
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 -> Binary | ASCII / Variable UTF-8 slicing | RAX / RBX / RCX / RDX (Western naming) |
| HolyC (TempleOS) | JIT compiled into RAM · No linking phase | 8-Bit Extended ASCII (with graphics) | RAX / RBX / RCX / RDX bare-metal access |
| xLang (xHunOS) | Sub-millisecond JIT directly to machine code | Pure 16-Bit UCS-2 Native Hanzi Tokens | Ten Heavenly Stems + Eight Trigrams |