Building from Source
Prerequisites
- Rust toolchain (stable): rustup.rs
- System C compiler (
ccon macOS/Linux, MSVC on Windows)
Build
git clone https://github.com/skelpo/perry.git
cd perry
# Build all crates (release mode recommended)
cargo build --release
The binary is at target/release/perry.
Build Specific Crates
# Runtime only (must rebuild stdlib too!)
cargo build --release -p perry-runtime -p perry-stdlib
# Codegen only
cargo build --release -p perry-codegen
Important: When rebuilding
perry-runtime, you must also rebuildperry-stdlibbecauselibperry_stdlib.aembeds perry-runtime as a static dependency.
Run Tests
# All tests (exclude iOS crate on non-iOS host)
cargo test --workspace --exclude perry-ui-ios
# Specific crate
cargo test -p perry-hir
cargo test -p perry-codegen
Compile and Run TypeScript
# Compile a TypeScript file
cargo run --release -- hello.ts -o hello
./hello
# Debug: print HIR
cargo run --release -- hello.ts --print-hir
Development Workflow
- Make changes to the relevant crate
cargo build --releaseto buildcargo test --workspace --exclude perry-ui-iosto verify- Test with a real TypeScript file:
cargo run --release -- test.ts -o test && ./test
Project Structure
perry/
├── crates/
│ ├── perry/ # CLI driver
│ ├── perry-parser/ # SWC TypeScript parser
│ ├── perry-types/ # Type definitions
│ ├── perry-hir/ # HIR and lowering
│ ├── perry-transform/ # IR passes
│ ├── perry-codegen/ # Cranelift codegen
│ ├── perry-codegen-js/ # Web target codegen
│ ├── perry-codegen-swiftui/ # Widget codegen
│ ├── perry-runtime/ # Runtime library
│ ├── perry-stdlib/ # npm package implementations
│ ├── perry-ui/ # Shared UI types
│ ├── perry-ui-macos/ # macOS AppKit UI
│ ├── perry-ui-ios/ # iOS UIKit UI
│ └── perry-jsruntime/ # QuickJS integration
├── docs/ # This documentation (mdBook)
├── CLAUDE.md # Detailed implementation notes
└── CHANGELOG.md # Version history
Next Steps
- Architecture — Crate map and pipeline overview
- See
CLAUDE.mdfor detailed implementation notes and pitfalls