Skip to main content

Crate spydecy_hir

Crate spydecy_hir 

Source
Expand description

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() + C list_length() → Unified HIR → Rust Vec::len()
  • 8/8 tests passing ✅
  • Zero FFI, zero unsafe ✅

This production version extends that success to handle real code.

Modules§

c
C-specific HIR nodes
error
Error types for Spydecy HIR operations
metadata
Metadata tracking for HIR nodes
python
Python-specific HIR nodes
types
Type system for Unified HIR
unified
Unified HIR - The Core Innovation

Structs§

NodeId
Unique identifier for HIR nodes (for cross-referencing)
SourceLocation
Source location for error reporting and debugging

Enums§

Language
Programming language source
Visibility
Visibility modifier