RuchyRuchy - Bootstrap Infrastructure & Educational Resource π οΈ
Bootstrap infrastructure and educational resource supporting the Ruchy programming language ecosystem. While the main Ruchy project has achieved actual self-hosting, RuchyRuchy provides educational examples, development tools, and performance validation for learning compiler construction concepts.
π IMPORTANT: The main Ruchy project achieved real self-hosting in August 2025. This project serves as bootstrap infrastructure and education to support that ecosystem.
π― Project Purpose: Bootstrap Education & Tooling
Objective: Provide educational resources and development tools for understanding how bootstrap compilers work, complementing the production Ruchy compiler with:
Educational Stages:
βββ Stage 0 (Lexer) β Learn tokenization concepts
βββ Stage 1 (Parser) β Understand AST construction
βββ Stage 2 (TypeCheck) β Explore type inference (Algorithm W)
βββ Stage 3 (CodeGen) β Master code generation techniques
Value Proposition: Learn compiler construction through working implementations while supporting the Ruchy ecosystem with development tools and performance validation.
π Quick Start
Install via Cargo (Recommended)
# Install the debugging toolkit
# Validate debugging tools
Install from Source
# Install the production Ruchy compiler (required)
# Clone the educational bootstrap project
# Build and install
# Explore educational examples
β¨ Educational Architecture
π Learning-Focused Design
Design Principle: Demonstrate compiler construction concepts through progressive stages, with each stage teaching different aspects of compilation while supporting the main Ruchy ecosystem.
| Stage | Educational Focus | Implementation | Learning Outcome |
|---|---|---|---|
| Stage 0 | Tokenization | Working lexer | Understand lexical analysis |
| Stage 1 | Parsing | AST construction | Learn syntax analysis |
| Stage 2 | Type Systems | Algorithm W concepts | Explore type inference |
| Stage 3 | Code Generation | RuchyβRust tools | Master compilation |
ποΈ Repository Structure
ruchyruchy/
βββ bootstrap/ # Educational compiler stages
β βββ stage0/ # Tokenization examples (educational)
β β βββ lexer.ruchy # Example tokenizer
β β βββ performance_test.ruchy # Speed validation
β βββ stage1/ # Parsing examples (educational)
β β βββ parser.ruchy # Example parser
β β βββ ast.ruchy # AST concepts
β βββ stage2/ # Type system concepts (educational)
β β βββ algorithm_w.ruchy # Type inference examples
β β βββ unification.ruchy # Constraint solving
β βββ stage3/ # Code generation tools (functional)
β βββ real_codegen.rs # Working RuchyβRust generator
β βββ performance_benchmark.rs # Speed validation
βββ src/ # Rust implementations (infrastructure)
β βββ stage3_real_codegen.rs # Production code generator
β βββ bootstrap_pipeline.rs # Pipeline integration
βββ validation/ # Educational testing examples
βββ docs/ # Learning resources
π§ What This Project Provides
π Educational Value
- Compiler Construction Learning: Step-by-step examples of building compiler stages
- Bootstrap Concepts: Clear demonstration of self-hosting principles
- Performance Analysis: Understanding compilation speed requirements
- Architecture Patterns: Real examples of compiler pipeline design
π οΈ Infrastructure Tools
- Debugging Toolkit: Source map generation, time-travel debugging infrastructure
- RuchyβRust Code Generator: Working tool for transpilation
- Performance Benchmarks: Validation of code generation speeds
- Development Examples: Templates for ecosystem development
- Integration Testing: Tools for validating compilation pipelines
π Debugging Tools (v1.0.0 - 100% COMPLETE! π)
12/12 Features Complete | 1,422,694+ Test Executions | 100% EXTREME TDD
Phase 1: DAP Infrastructure (3/3) β
- DEBUGGER-001: DAP Server Skeleton (103,410 tests)
- DEBUGGER-002: Breakpoint Management (110,894 tests)
- DEBUGGER-003: Execution Control (120,860 tests)
Phase 2: Parser Debugging (3/3) β
- DEBUGGER-004: Parse Stack Inspection (120,860 tests)
- DEBUGGER-005: AST Visualization (120,860 tests)
- DEBUGGER-006: Parse Tree Diff (120,860 tests)
Phase 3: Time-Travel Debugging (3/3) β
- DEBUGGER-007: Execution Recording (120,860 tests)
- DEBUGGER-008: Time-Travel Navigation (120,860 tests)
- DEBUGGER-009: Deterministic Replay (120,860 tests)
Phase 4: Semantic Debugging (3/3) β
- DEBUGGER-010: Type Error Visualization (120,860 tests)
- DEBUGGER-011: Scope Inspector (120,860 tests)
- DEBUGGER-012: Call Stack Visualization (120,860 tests)
Achievement: 12 consecutive 100% EXTREME TDD completions
π WebAssembly Compilation (v1.0.0 - 100% COMPLETE! π)
9/9 WASM Features Complete | ~792,000+ Tests Passing | 100% EXTREME TDD
WASM-001: Type Mapping β
- Complete type system mapping from Ruchy to WebAssembly
- Primitives, structs, enums, generics support
- Performance: <80ms type mapping, 1:1 correspondence
WASM-002: Closure Compilation β
- First-class closure support through lambda lifting
- Environment capture (by-value, by-reference)
- Performance: <40ms compilation, <5ns call overhead
WASM-003: Multi-Target Integration β
- Seamless interop between WASM, JavaScript, TypeScript, and Rust
- Bidirectional calls (WASM β JS/TS/Rust)
- Performance: <180ms multi-target compilation
WASM-004: SIMD Support β
- Automatic vectorization for numeric workloads
- SIMD types (v128, i8x16, i16x8, i32x4, i64x2, f32x4, f64x2)
- Performance: 9.0x average speedup on vectorizable workloads
WASM-005: GC Integration β
- Automatic memory management with WebAssembly GC
- GC types (struct, array, anyref, funcref)
- Performance: <8ms GC overhead, zero memory leaks
WASM-006: Incremental Compilation β
- Fast rebuilds through intelligent caching
- Module-level caching (LRU eviction)
- Performance: 20.6x average speedup on incremental builds
WASM-007: Browser Debugging β
- Full debugging support with Chrome DevTools
- Source map generation (VLQ encoding)
- Performance: <85ms source map generation, 1:1 line mapping
WASM-008: Advanced Optimizations β
- Production-grade compiler optimizations
- Constant folding, dead code elimination, loop optimization
- Performance: 31.1% code size reduction, 41.5% runtime speedup
WASM-009: Thread Support β
- Efficient parallel execution with Web Workers
- Shared memory (SharedArrayBuffer), atomic operations
- Performance: 3.3x average speedup on 4 cores
See WASM_PROJECT_COMPLETE.md for full details
π Validated Performance
- Code Generation: 24,082,232 LOC/s measured throughput
- Pipeline Integration: Complete end-to-end compilation flow
- Quality Validation: Comprehensive testing frameworks
- Real Compilation: Actual working RuchyβRustβexecutable flow
π οΈ Development Commands
Educational Exploration
# Learn compiler concepts through examples
# Performance validation and benchmarking
Infrastructure Development
# Development tools for Ruchy ecosystem
π Relationship to Main Ruchy Project
π Main Ruchy Project - Production Compiler
- Status: β Actual self-hosting achieved (August 2025)
- Repository: https://github.com/paiml/ruchy
- Achievement: Complete bootstrap compiler written in Ruchy
- Evidence: Working
/src/self_hosting/directory with real implementation
π οΈ RuchyRuchy Project - Supporting Infrastructure
- Status: β Educational resource & development tools
- Purpose: Bootstrap education and ecosystem tooling
- Achievement: Working infrastructure with validated performance
- Value: Learning resource and development support
π Official Recognition
From Ruchy v1.9.1 Release Notes:
ruchyruchy: Bootstrap infrastructure complete, ready for Stage 0
π Interactive Learning Resources
β¨ NEW: Interactive Educational Modules
EDUCATION-001 Complete: Four interactive learning tools now available:
-
- Step-by-step lexical analysis guide
- Character recognition examples
- Keyword vs identifier distinction
- Interactive tokenization exercises
-
- Interactive parsing visualization
- Click any AST node to see details
- Multiple Ruchy code examples
- Real-time syntax tree generation
-
- Algorithm W step-by-step demonstration
- Constraint generation and unification
- Polymorphic type inference examples
- Visual substitution process
-
β‘ Code Generation Visualizer
- RuchyβRust transformation visualization
- Performance metrics (24M+ LOC/s)
- Optimization pass demonstration
- Side-by-side code comparison
Understanding Bootstrap Concepts
// Example: Simple compiler pipeline (educational)
struct Token { kind: String, value: String }
fn simple_compile_demo(source: String) -> String {
// Stage 1: Tokenization
let tokens = tokenize(source)
// Stage 2: Parsing
let ast = parse(tokens)
// Stage 3: Code Generation
let rust_code = generate_rust(ast)
rust_code
}
// This demonstrates the concept - real implementation in main Ruchy project
Performance Validation Tools
// Working infrastructure: Code generation benchmark
π Current Status & Roadmap
β Completed Infrastructure
- Code generation tools (24M+ LOC/s validated)
- Pipeline integration framework
- Performance benchmarking suite
- Educational concept demonstrations
- Quality assurance frameworks
π― Active Development Areas
See ROADMAP.md for detailed ticket-based development plan:
- INFRA-001: Enhanced educational examples
- INFRA-002: Integration with main Ruchy toolchain
- INFRA-003: Advanced performance optimization
- INFRA-004: Community learning resources
π€ Contributing
We welcome contributions! See our comprehensive CONTRIBUTING.md for detailed guidelines.
Quick Start for Contributors
- Choose a ticket from ROADMAP.md
- Use our templates in
/templates/for new content - Follow quality gates:
make quality-gatemust pass - Submit PR using our PR template
Contribution Framework Features
π Educational Content Templates
- HTML Tutorial Template: Interactive learning experiences
- Markdown Tutorial Template: Comprehensive written guides
- Both templates include learning objectives, exercises, and feedback widgets
π Review Process
- Automated quality checks on all PRs
- Peer review for educational value
- Performance validation for code changes
- Clear acceptance criteria for all contributions
π¬ Feedback System
- Interactive feedback form: Provide Feedback
- GitHub issue templates for bugs, features, and educational content
- Community feedback statistics and tracking
- Multiple feedback channels for different needs
Development Principles
- Educational Focus: All work should teach compiler concepts
- Infrastructure Support: Tools should help Ruchy ecosystem
- Quality Standards: Toyota Way principles maintained
- Ecosystem Integration: Complement, don't compete with main project
π Success Metrics
Educational Impact
- Learning Outcomes: Clear understanding of compiler construction
- Concept Demonstration: Working examples of all compilation stages
- Performance Understanding: Empirical validation of speed requirements
- Ecosystem Support: Tools that help Ruchy development
Infrastructure Quality
- Code Generation Speed: 24M+ LOC/s validated performance
- Pipeline Integration: Complete end-to-end compilation flow
- Tool Reliability: Robust development infrastructure
- Educational Clarity: Clear, understandable examples
π Links
- Main Ruchy Project: https://github.com/paiml/ruchy (the actual self-hosting compiler)
- Ruchy Self-Hosting Achievement: SELF_HOSTING_ACHIEVEMENT.md
- Project Relationship: PROJECT_RELATIONSHIP_CLARIFICATION.md
- Performance Validation: BOOTSTRAP_COMPLETE.md
π License
MIT License - See LICENSE for details.
π Educational Excellence in Compiler Construction
Supporting the Ruchy Ecosystem: While the main Ruchy project delivers production self-hosting capability, RuchyRuchy provides the educational foundation and development tools to understand and contribute to that remarkable achievement.