#hir #transpiler #compiler

spydecy-hir

High-level Intermediate Representation (HIR) for Spydecy transpiler

3 releases (breaking)

0.3.0 Oct 23, 2025
0.2.0 Oct 22, 2025
0.1.0 Oct 22, 2025

#1902 in Programming languages

Download history 126/week @ 2025-11-05 335/week @ 2025-11-12 1/week @ 2025-11-19 207/week @ 2025-11-26 9/week @ 2025-12-03 3/week @ 2025-12-17 34/week @ 2026-01-07 403/week @ 2026-01-21 16/week @ 2026-01-28 812/week @ 2026-02-04 478/week @ 2026-02-11

1,709 downloads per month
Used in 7 crates (6 directly)

MIT/Apache

90KB
2K SLoC

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.

Dependencies

~2.2–5.5MB
~95K SLoC