Princi v0.2Windows x86-64

Structure when needed.
Simplicity by default.

PrinciPL is a statically typed, compiled programming language. The v0.2 compiler turns concise, structured source into native Windows executables.

.prnc and .princi are equivalentOne language, two source suffixes

Factorial and main

factorial.prnc

fn factorial(n: Int) -> Int {
    if n <= 1 {
        return 1
    }

    return n * factorial(n - 1)
}

fn main() {
    let result = factorial(5)
    println(result)
}
Buildprinci build factorial.prncfactorial.exe

Small programs stay direct. Larger ones have structure.

Princi combines explicit blocks and static types with local inference and a single native build command.

SYNTAX

Concise syntax

Typed function signatures, inferred local values, and optional semicolons keep everyday code compact.

CHECKING

Static checks

Names, types, calls, members, and control-flow conditions are checked before native code is emitted.

DATA

Two data shapes

Classes share managed references; structs copy their fields by value. Both fit ordinary structured programs.

TARGET

Native compilation

The current compiler lowers supported programs through LLVM and links Windows x86-64 executables.

Language at a glance.

These examples use syntax supported by the v0.2 compiler and its Windows target.

Bindings

values.prnc

fn main() {
    let pi: Float = 3.14159
    var count = 2
    count += 1
    println(count)
}

Functions and calls

functions.prnc

fn add(a: Int, b: Int) -> Int {
    return a + b
}

fn main() {
    println(add(20, 22))
}

Conditions and loops

control.prnc

fn main() {
    var count = 0

    if count == 0 {
        println("starting")
    } else {
        println("already running")
    }

    while count < 2 {
        count += 1
    }

    for index in 0..3 {
        println(index)
    }
}

Classes

user.prnc

class User {
    name: String
    age: Int

    init(name: String, age: Int) {
        self.name = name
        self.age = age
    }

    fn birthday() {
        self.age += 1
    }
}

fn main() {
    var user = User("Alice", 24)
    user.birthday()
    println(user.age)
}

Struct values

point.prnc

struct Point {
    x: Float
    y: Float
}

fn main() {
    var point = Point(3.0, 4.0)
    let snapshot = point
    point.x = 5.0
    println(snapshot.x)
    println(point.x)
}

List<T>

numbers.prnc

fn main() {
    var numbers: List<Int> = [1, 2, 3]
    numbers[1] = 7
    numbers.add(9)

    println(numbers.length)
    println(numbers[1])
}

From source to a Windows executable.

Both source extensions enter the same compiler pipeline and produce the same target format.

  1. 01

    Source

    .prnc / .princi

  2. 02

    Lexer

    Tokens with source spans

  3. 03

    Parser + AST

    Structured syntax tree

  4. 04

    Module resolution

    Built-in registry

  5. 05

    Semantic analysis

    Typed representation

  6. 06

    LLVM IR

    Verified module

  7. 07

    Windows object

    x86-64 COFF

  8. 08

    Native link

    MinGW-w64 runtime

  9. 09

    .exe

    Windows x86-64

Clang verifies LLVM IR and emits the Windows COFF object; MinGW-w64 GCC links the executable and Windows C runtime.

Compiler architecture

Objects for identity. Structs for values.

Classes are references, while structs copy their fields. Generic declarations can specialize either representation.

Class · reference

User

Assigning a class value shares the same heap object. Instance methods use static dispatch.

Class instance

user.prnc

class User {
    name: String
    age: Int

    init(name: String, age: Int) {
        self.name = name
        self.age = age
    }

    fn birthday() {
        self.age += 1
    }
}

fn main() {
    var user = User("Alice", 24)
    user.birthday()
    println(user.age)
}

No inheritance, virtual class methods, or method overloading in v0.2.

Struct · value

Point

Assignment, parameters, and returns copy struct fields. A mutable var can update its fields.

Struct copy

point.prnc

struct Point {
    x: Float
    y: Float
}

fn main() {
    var point = Point(3.0, 4.0)
    let snapshot = point
    point.x = 5.0
    println(snapshot.x)
    println(point.x)
}

Structs are value types; they can implement traits. Custom layouts are not supported.

Read the language guide

What v0.2 actually supports.

A deliberately bounded native compiler, with v0.2 generics, contracts, enums, and documented limitations.

Implemented

Typed program core

Int, Float, Bool, String, local inference, functions, recursion, assignments, and checked expressions.

Implemented

Control flow and data

if/else, while, integer ranges, classes, value-oriented structs, List<T>, enums, and exhaustive matching.

Implemented

Generics and behavior

Monomorphized generic functions and types, bounds, interfaces with dynamic dispatch, traits with defaults, and Result-based propagation.

Implemented

Native build and runtime

print/println, a limited C ABI, verified LLVM IR, and Windows x86-64 executable linking.

The compiler also recognizes the built-in io and math import names;math currently exports nothing. C FFI is limited toInt32, Int64, Float64, and Void signatures.

Future direction, clearly marked.

These are possible areas beyond v0.2, not features available in the compiler today. No delivery dates are promised.

Roadmap

Richer memory model

Tracing collection is a future possibility. v0.2 keeps managed allocations until main returns; it does not collect during execution.

Roadmap

Ownership and raw memory

Ownership, borrowing, raw pointers, and unsafe blocks are not part of the current language.

Roadmap

More targets and language tools

Linux, macOS, WebAssembly, package management, async, inheritance, and lower-level memory control remain outside v0.2.

See the v0.2 scope and current boundary
Get started

One file. One build command.

Save the program as hello.prnc or hello.princi; the compiler treats them identically.

Windows installation guide
PowerShellprinci build hello.prnchello.exeUse -o app.exe to choose another output path.

Open source. Built in the open.

Read the compiler, inspect the examples, and track the documented language boundary in the repository.

Explore PrinciPL on GitHub