df19777505
- Implemented XIC loader, VM, ops, and executor - Wired RUN_PROMPT directly to execute_gx() (no stubs) - Added demo compressed model and demo XIC program - Integrated XIC into glyph_runner.py with --xic flag and shell support - Added full validation suite and XIC_INTEGRATION_REPORT.md - Verified real GSZ3 decompression and execution pipeline This commit introduces a complete compressed-space execution engine with zero breaking changes and full backward compatibility.
31 lines
813 B
Python
31 lines
813 B
Python
from xic_loader import XICProgram
|
|
from xic_ops import XICContext, OP_TABLE
|
|
|
|
|
|
class XICRuntimeError(Exception):
|
|
pass
|
|
|
|
|
|
def run_xic_program(prog: XICProgram) -> XICContext:
|
|
"""Execute an XIC program.
|
|
|
|
Creates a context, iterates through instructions, dispatches
|
|
each operation to the handler in OP_TABLE, and returns the final context.
|
|
"""
|
|
ctx = XICContext()
|
|
|
|
for i, instr in enumerate(prog.instructions):
|
|
op_name = instr.op
|
|
|
|
if op_name not in OP_TABLE:
|
|
raise XICRuntimeError(f"Unknown operation at instruction {i}: {op_name}")
|
|
|
|
op_handler = OP_TABLE[op_name]
|
|
|
|
try:
|
|
op_handler(ctx, *instr.args)
|
|
except Exception as e:
|
|
raise XICRuntimeError(f"Operation {op_name} failed at instruction {i}: {e}")
|
|
|
|
return ctx
|