Independent research project by TLabs · Built in Türkiye

MiniSwift

A lightweight, GPU-accelerated Swift compiler built for experimentation, speed, and research.

Why MiniSwift Exists

MiniSwift is not a replacement for the Apple Swift compiler.

It's a research platform designed to explore GPU-accelerated compilation techniques — pushing lexing, parsing, AST generation, and semantic analysis onto Metal compute shaders.

The goal is speed, determinism, and experimentation. We measure runtimes in microseconds, not milliseconds.

Features

GPU Lexing

Metal compute shaders tokenize Swift source code in parallel across thousands of GPU threads.

GPU Parsing

Abstract Syntax Tree generation executed on the GPU with parallel node construction.

Semantic Engine

Real-time type checking, symbol resolution, and scope analysis with GPU acceleration.

Extreme Speed

Lexing 10K lines in ~120μs. Parsing in ~340μs. Full pipeline under 1ms for typical files.

Modular Pipeline

Clean separation: Lexer → Parser → AST → Semantic passes. Each stage independently testable.

Developer Tools

Syntax highlighting engine, debugger hooks, and a clean API for tool integrations.

Architecture

Source Code .swift files
GPU Lexer Metal Compute Shaders
GPU Parser Parallel AST Construction
Abstract Syntax Tree Structured representation
GPU Semantic Engine Type checking & Symbol resolution
Compiler Output Analysis results & Diagnostics

Code Analysis

example.swift Input
struct Vector3D {
    var x: Float
    var y: Float
    var z: Float
    
    func magnitude() -> Float {
        return (x*x + y*y + z*z).squareRoot()
    }
}

let vec = Vector3D(x: 3.0, y: 4.0, z: 0.0)
print(vec.magnitude()) // 5.0
Token Stream ~120μs
// GPU Lexer Output
[0] KEYWORD     "struct"    0:0
[1] IDENTIFIER  "Vector3D"  0:7
[2] LBRACE      "{"         0:16
[3] KEYWORD     "var"       1:4
[4] IDENTIFIER  "x"         1:8
[5] COLON       ":"         1:9
[6] IDENTIFIER  "Float"     1:11
// ... 47 more tokens

Performance

Microsecond-level analysis for Swift files under 5MB.

~120μs
Lexing 10,000 lines
Metal GPU compute
~340μs
Parsing to AST
Parallel node construction
<1ms
Full pipeline
Typical Swift files

Benchmarks measured on Apple M2 Pro with 16GB unified memory. Performance scales with GPU compute units. Optimized for Apple Silicon architecture.

Installation

Private R&D

MiniSwift is currently in private research and development. Public builds, documentation, and source code will be released when the project reaches a stable milestone.

Watch on GitHub

About

MiniSwift is an independent research project created by TLabs and developed at TLabs in Türkiye.

The goal is to explore modern compiler design, GPU-accelerated parsing, and new execution models for Swift-like languages. This is pure research — no commercial agenda, no enterprise roadmap. Just engineering exploration.