Compiler · Stdlib · Foundation · SwiftUI · Metal
Zero Dependencies

The Swift Compiler
in the Browser

A full Swift pipeline — Lexer · Parser · Sema · IR · WASM — wired to the complete SwiftUI runtime: 52 views, 75 modifiers, real @State, sheets, alerts, Path drawing — rendered to canvas through an identity-aware diff engine that surgically swaps only the subtrees that change. Foundation along for the ride. Metal shaders for the GPU too. All from scratch in C — no Apple runtime, no LLVM, no React, no shim.

Headline · the entire SwiftUI runtime in your tab

SwiftUI, compiled in your browser.

Plain Swift source — including @State, NavigationStack, Toggle, Path, the works. Hit a tab and our in-browser compiler tokenises, parses, type-checks, and lowers to UIIR — then the canvas renderer paints it onto a real iPhone frame. Tap a button → @State mutates → an identity-aware diff engine rebuilds only the affected subtree. No iframe, no JS shim, no native runtime — just Swift → C compiler → WASM → canvas pixels. The same pipeline you'd ship to a phone, running in your tab.

Counter.swift edit · live @State · button
swift → lexer → parser → sema → uiir → canvas
Live preview tap the buttons

Our compiler. Our UIIR. Our renderer. Our diff engine. All under one roof in 71K lines of C — no React, no Web Components, no proprietary runtime. The same pipeline you'd target a phone with, just landing on a canvas instead of CoreAnimation. Open the full playground →

Bonus · MSL → WGSL on the side

Metal, too.

Because once you have your own compiler infrastructure, why stop at Swift? libMetal tokenises Apple MSL, lowers to MIR, emits WGSL — WebGPU paints the fragment. Edit the shader, move the mouse, watch it react. Same C-only philosophy: no LLVM, no third-party transpiler.

Tunnel.metal edit · live polar coords
metal → lexer → parser → mir → wgsl → webgpu
WebGPU canvas atan2 + fract

The 177 KB libMetal WASM tokenises ~106 keywords, lowers to MIR with 90+ builtin rewrites, then emits WGSL plus a JSON pipeline-metadata sidecar — the same library you'd link against in C. Edit in the playground →

Plain Swift, Right Here

Edit, hit ▶ Run — compiler runs in your tab.

main.swift
Press Run or Cmd+Enter...

Open full playground for live diagnostics and hover tooltips.

71K
Lines of C
compiler · stdlib · foundation · swiftui · metal
52
SwiftUI Views
stacks · shapes · paths · canvas · maps
75
Modifiers
layout · style · gestures · sheets · alerts
0
Dependencies
no npm · no llvm · no clang

Everything You Need to Run Swift

Full Language Support

Structs, classes, enums, protocols, generics, closures, async/await, error handling, pattern matching — all compiled to WebAssembly.

Standard Library

Array, Dictionary, Set, String (Unicode 17.0), Optional, Result, Range — 290 runtime functions with 180+ inlined method handlers.

Foundation

Date / Calendar arithmetic + formatting, URL components & resolution, JSON encode/decode, UUID, UserDefaults, Unicode tables — 70+ runtime functions exposed via a JS bridge.

Metal Shaders

Compile MSL (Metal Shading Language) to WGSL right in the browser. vec3 / mat4 math, mesh primitives (cube · sphere · plane · grid), camera + location passthrough — runs on WebGPU.

WebAssembly Backend

Direct IR-to-WASM compilation. No LLVM, no clang, no Binaryen. Structured control flow, dead code elimination, constant folding.

Plugin Architecture

Modular design: compiler core knows zero about stdlib. Modules register type declarations, IR handlers, and WASM builtins via plugin API.

SwiftUI Runtime ★ headline

The whole declarative UI surface — 52 views, 75 modifiers, sheets, alerts, gestures, Path & Canvas drawing — rendered to canvas via our own UIIR JSON. Identity-aware diff engine surgically rebuilds just the affected subtree on every @State mutation. Same Swift code you'd ship to a phone, no edits.

751 Tests, 100% Pass

Comprehensive test suite covering collections, concurrency, generics, error handling, strings, numerics. Zero regressions policy.

Compiler Pipeline

.swift
Lexer
Parser
Sema
IR Gen
SSA
Optimizer
WASM
.wasm