JAPL

A typed actor language for reliable
distributed systems and AI agents.

Compiles to WASM. Rust runtime. Real processes, supervision, and LLM effects.

-- A typed web server with process-based concurrency

type Request =
  | Get(String)
  | Post(String, Body)

type Response =
  | Ok(Body)
  | NotFound
  | Error(String)

fn handle(req: Request) -> Response = match req with
  | Get("/health")    -> Ok("ok")
  | Get(path)         -> lookup(path)
  | Post(path, body)  -> store(path, body)

fn counter(count: Int) -> Int = receive
  | Increment(n) -> counter(count + n)
  | GetCount     -> count
  | Shutdown     -> count

fn main() -> Result[Unit, Error] =
  let pid = spawn(counter, 0)
  let server = listen(8080, handle)
  supervise([pid, server], OneForOne)

Core Principles

Typed Actors

Erlang-style lightweight processes with typed message passing. Each process is an isolated WASM instance with its own mailbox.

WASM Target

Compiles to WebAssembly, runs on a Rust runtime with wasmtime. No garbage collector — ownership and linear types manage memory.

LLM Effects

LLM calls are tracked effects, not hidden side effects. The type system knows which functions touch AI. Budgets are linear resources.

Ownership

Rust-style affine types without a borrow checker. Move semantics prevent data races at compile time.

Supervision

OneForOne, AllForOne, RestForOne restart strategies. Agents are supervised processes with typed failure recovery.

Distribution

Location-transparent PIDs. Same syntax for local and remote processes. Built-in node clustering with typed serialization.

Simple Syntax

Go-level readability with ML-level power. Pipe-forward, pattern matching, expression-oriented. No ceremony.

Language DNA

JAPL combines the best ideas from four language families into one coherent design.

ML / Haskell

Type System

Hindley-Milner inference, algebraic data types, pattern matching, effect tracking.

Rust

Ownership

Affine types, move semantics, WASM compilation, Rust runtime.

Erlang / Elixir

Concurrency

Typed actors, message passing, supervision trees, fault tolerance.

Go

Simplicity

Minimal syntax, fast compilation, single-binary deployment.

Compiler Architecture

Rust compiler emits WASM bytecode, executed on a Rust runtime with wasmtime.

1

Lexer

Tokenizes JAPL source into a typed token stream

2

Parser

Builds an abstract syntax tree with full span tracking

3

Type Checker

Hindley-Milner inference with effect and ownership analysis

4

Codegen

Emits WASM bytecode for the Rust runtime