Developer Preview • In Active Development
Puffin Mascot Logo

Puffin Programming Language

Puffins are auks with colorful features — Puffin is AWK with colorful features. A structured, modular language engineered for lexical scoping, first-class namespaces, actor-model concurrency, domain standard libraries, and native AOT compilation.

telemetry_actor.pfn Puffin Syntax
# Puffin: Lexical scoping, domain stdlib, typed collections & actor concurrency
:>inc "std/text/strings.pfn"

struct Metric { name: str, value: f64 }

namespace Telemetry {
    HATCH {
        static active_events = 0
    }

    export function record(name, val) {
        active_events++
        let tag = std.text.strings.upper(name)

        # Typed collections (@Dict / @List) & variant constructors
        return Ok(@Dict[
            "id": active_events,
            "metric": Metric(tag, val),
            "tags": @List["production", "telemetry"],
            "verified": true
        ])
    }
}

BEGIN {
    # Cooperative actor spawning over isolated message channels
    let worker = hatch coop Telemetry()

    # Functional pipelines with first-class arrow lambdas
    let raw = @List["cpu_load", "mem_peak", "io_wait"]
    let metrics = raw
        |> map(x -> std.text.strings.lower(x))
        |> filter(x -> Length(x) > 0)

    # Typed non-blocking RPC with Result variant matching
    case await worker.record("node_health", 99.8) {
        Ok(report): {
            print "Worker Ready -> Event ID:", report["id"]
            for k, v in report {
                print "  ", k, "=>", v
            }
        }
        Err(err): {
            print "Worker Error:", err
        }
    }
}
🧩

Lexical Scoping & State

Block-level scoping with let, persistent function-lifetime memory with static, assign-once final, deep immutability with freeze, and loop-scoped bindings (for (let i = 0; ...)).

📦

Namespaces & Modules

Modular encapsulation via namespace, explicit symbol boundaries (export), private member protection (_prefix), and deterministic multi-file inclusion (:>inc).

🗂️

Typed Collections & Lambdas

First-class literal syntax for @List, @Dict, @Set, @Queue, and @Deque. Anonymous arrow lambdas (x -> expr), higher-order combinators, and functional pipelines (|>).

Actor Concurrency & RPC

Isolated concurrency with hatch coop (coroutines) and hatch detached (processes). Thread-safe mailboxes (send/recv), typed channels, and async actor RPC (await).

📚

Domain Standard Library

150+ modules organized across 16 domain namespaces: std/text, std/encoding, std/crypto, std/net, std/sys, std/math, std/flow, std/archive, and more.

🚀

Native AOT & Tooling Suite

Transpile to native binaries with puffin build (via Nim/C), enforce style and semantic invariants with puffin lint, explore in puffin repl, or run POSIX AWK via pcawk.

🛠️ Shipped Tooling & Architecture
puffin build -o bin/service main.pfn AOT native compilation
puffin lint src/ Strict semantic & style analysis
puffin repl Interactive execution environment
pcawk -F: '{ print $1 }' /etc/passwd Drop-in POSIX AWK compatibility
puffin-lang.org www.puffin-lang.org puffinlang.org puffin-lang.com puffinlang.com