Spydecy Unified High-Level Intermediate Representation (HIR)
This module defines the core data structures for Spydecy's Unified HIR. The HIR is the central innovation that enables cross-layer optimization by unifying Python and C representations.
Architecture
┌──────────┐ ┌──────────┐
│ Python │ │ C │
│ AST │ │ AST │
└────┬─────┘ └────┬─────┘
│ │
▼ ▼
┌──────────┐ ┌──────────┐
│ Python │ │ C │
│ HIR │ │ HIR │
└────┬─────┘ └────┬─────┘
│ │
└────────┬─────────┘
▼
┌──────────────┐
│ Unified HIR │ ⭐ Core Innovation
└──────┬───────┘
▼
┌──────────────┐
│ Optimizer │
└──────┬───────┘
▼
┌──────────────┐
│ Codegen │
└──────┬───────┘
▼
Rust Code
Sprint 0 Validation
Sprint 0 validated this architecture with a minimal implementation:
- Python
len()+ Clist_length()→ Unified HIR → RustVec::len() - 8/8 tests passing ✅
- Zero FFI, zero unsafe ✅
This production version extends that success to handle real code.