Ruchy - Self-Hosting Programming Language
Ruchy is a self-hosting programming language with comprehensive tooling and quality engineering practices based on Toyota Way principles.
Quick Start
# Install from crates.io
# Run a one-liner
# Start the REPL
# Run a script
# Check syntax
# Format code
# Lint code
Key Features
Self-Hosting Capability
- Bootstrap compiler written in Ruchy
- Transpiles to Rust for compilation
- Type inference with Algorithm W
- Complete language features for compiler development
Language Features
- Pipeline Operator:
data |> transform |> filter - Pattern Matching: With guards:
x if x > 0 => "positive" - Lambda Syntax: Both
|x| x + 1andx => x + 1 - Module System:
use,mod, and::path resolution - Error Handling: Result/Option types with
?operator - Collections: HashMap, HashSet with standard methods
- String/Array Methods: Comprehensive built-in methods
CLI Commands
| Command | Purpose |
|---|---|
ruchy check |
Syntax validation |
ruchy fmt |
Code formatting |
ruchy lint |
Quality analysis |
ruchy test |
Test execution |
ruchy ast |
AST visualization |
ruchy run |
Script execution |
ruchy repl |
Interactive environment |
ruchy transpile |
Convert to Rust |
REPL Features
- Tab completion with context awareness
- Syntax highlighting
- Persistent history across sessions
- Multiline editing
- Magic commands (
:help,:load,:save) - Resource limits (memory, timeout, stack depth)
Example Code
// Function definition
fun parse_expr
// Pipeline operator
|> map
|> filter
|> sum
// Pattern matching with guards
match user_input
// Collections
let mut map = HashMap
map.insert
map.get.unwrap
Quality Engineering
Code Quality Standards
- Complexity Limits: Functions must have cyclomatic complexity ≤10
- Zero SATD Policy: No TODO/FIXME/HACK comments allowed
- Lint Compliance: All clippy warnings treated as errors
- Pre-commit Hooks: Automated quality gates prevent regressions
Testing
- Unit tests for core functionality
- Integration tests for CLI commands
- Property-based testing for mathematical invariants
- Fuzz testing for edge case discovery
Quality Gate Script
# Run quality checks
# Checks performed:
# - Function complexity ≤10
# - No technical debt comments
# - All tests passing
Development
# Clone repository
# Build
# Run tests
# Check quality
# Install locally
Documentation
Related Projects
- ruchy-book - Language documentation and examples
- rosetta-ruchy - Algorithm implementations
- ruchyruchy - Test suite
License
MIT OR Apache-2.0