LANGUAGE & SOVEREIGN INSTRUCTION SPECIFICATION

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.

Core Architectural Insight:In xHunOS, all drivers, utilities, and cosmological routines exist as pure xLang source code on continuous QSPI flash sectors, JIT-compiled on invocation into native RV64 machine instructions.
// xLang interactive REPL live evaluation example:
> 常数 爻数 = 6;
> 函数 打印天命() {
    终端输出("乾卦六爻已就绪\n");
  }
> 打印天命();
[OK] JIT compiled in 0.0004s, direct to 640x480 framebuffer

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.

xLang Core Hanzi Keyword Reference
Keyword (Hanzi)HolyC / C EquivalentCompiler Behavior & Semantics
常数const / #defineCompile-time constant literal emitted directly as immediate operand
变量var / autoStack or global variable binding directly to general-purpose registers
函数U0 / fnExecutable function entry point, compiled to machine code in <1ms
若 / 否则if / elseHigh-speed conditional branching evaluated against BaGua CPU flags
循环for / whileZero-overhead loop primitive utilizing register 丙 (RCX)
返回returnPlaces result in register 甲 (RAX) and restores caller stack frame
结构class / structPacked, zero-padding contiguous memory struct definition
公用public / externExports 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.

Ten Heavenly Stems RV64 Register Alias Map
Heavenly StemRISC-V Register (RV64)Hardware Architectural Convention
甲 (Jia)a0 / x10Primary accumulator · Function return value register
乙 (Yi)a1 / x11Secondary accumulator · Heap physical base pointer
丙 (Bing)t0 / x5Temporary counter · Divination shift & loop index
丁 (Ding)t1 / x6Data register · Hardware I/O & entropy buffer
戊 (Wu)s1 / x9Source index pointer · DaoFS sector read pointer
己 (Ji)s2 / x18Destination pointer · Framebuffer direct write pointer
庚 (Geng)s0 / fp (x8)Frame pointer · Call stack anchor
辛 (Xin)sp / x2Stack pointer · Hardware push/pop pointer
BaGua Branch Instructions (RISC-V Native)
Trigram BranchRV64 Opcode EquivalentSilicon 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 DialectCompilation & Execution ModelCharacter StandardRegister Semantics
Standard C (C11/C23)Preprocess -> Compile -> Assemble -> Link -> ELF BinaryASCII / Variable-Width UTF-8x86 / ARM registers (Western naming)
HolyC (TempleOS)JIT compiled into RAM · No linking phase8-Bit Extended ASCIIx86-64 bare-metal registers
xLang (xHunOS)Sub-millisecond JIT directly to RV64 machine codeFixed-Width 16-Bit (BMP) Hanzi TokensTen Heavenly Stems + Eight Trigrams on Custom RISC-V