Skip to content

[EPIC] Full Self-Hosting: 95%+ in Gradient with Minimal Rust Kernel #116

@graydeon

Description

@graydeon

Summary

Achieve full self-hosting: 95%+ of the Gradient compiler written in Gradient, with a minimal Rust kernel providing only critical primitives.

Vision

┌─────────────────────────────────────┐
│ RUST KERNEL (~2,000 lines)           │
│ - String primitives                 │
│ - File I/O                          │
│ - Memory allocation                 │
│ - Codegen backend                   │
└─────────────────────────────────────┘
           ↓ FFI
┌─────────────────────────────────────┐
│ GRADIENT COMPILER (~15,000 lines)   │
│ - Lexer                             │
│ - Parser                            │
│ - Type Checker                      │
│ - Queryable API                     │
│ - LSP Server                        │
│ - IR Builder                        │
│ - Codegen orchestration             │
└─────────────────────────────────────┘

Why This Matters

  1. Dogfooding: Agents develop Gradient in Gradient
  2. Agent-optimized: Queryable API written in agent-friendly language
  3. Virtuous cycle: Better tools → faster development → better tools
  4. Portability: Minimal kernel = easy to port to new platforms

Phases

Phase Issue Description Effort Status
0 #118 String Primitives (CRITICAL) 1 day 🔴 Not started
1 #119 Lexer 3 days ⏳ Blocked on #118
2 #120 Parser 5 days ⏳ Blocked on #119
3 #121 Type Checker 7 days ⏳ Blocked on #120
4 #122 Queryable API in Gradient 5 days ⏳ Blocked on #121
5 #123 LSP in Gradient 7 days ⏳ Blocked on #122
6 #124 IR Builder 5 days ⏳ Blocked on #123
7 #125 Codegen 5 days ⏳ Blocked on #124
Total 38 days

Current State

Phase 3 COMPLETE: Type definitions and API signatures in self-hosted code (~4,077 lines)

Ready to start: Phase 0 (String primitives in Rust kernel)

Critical Path

The phases MUST be completed in order. Each phase blocks the next.

Definition of Done

  • All phases complete
  • Compiler can compile itself
  • Rust kernel ≤2,000 lines
  • Gradient compiler ≥15,000 lines
  • All tests passing
  • LSP working
  • Queryable API working

Resources

  • Design doc: SELF_HOSTING_STRATEGY.md
  • Phase 3 complete: 10 compiler modules type-check

Labels

epic, self-hosting, roadmap


This is the primary strategic initiative for the Gradient project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions