PeaLang
A production-grade, readable language for rules, data engineering, AI orchestration, enterprise automation and backend interoperability. PeaLang runs on a tree-walking interpreter or a portable bytecode VM, carries an optional static type system, and works alongside Python, Java, Rust, TypeScript and Go rather than replacing them.
Readable by design
let, const, function, comprehensions, destructuring, optional chaining, ??, match and string interpolation. Tiny syntax surface, large payload.
One readable layer across the whole stack
Enterprise logic is usually scattered across YAML policies, Python glue scripts, Java services, TypeScript clients and shell automation. PeaLang gives teams one reviewable scripting layer that can be embedded in a host application, executed in a capability sandbox, compiled to .peac bytecode, or exposed to other languages over a generated RPC client. It complements existing systems: keep your data platform, model runtime and service mesh, and put the decision logic in a language domain experts can read.
Data & analytics
Comprehensions, group_by, CSV/JSON IO, SQL over records and quality gates via std.analysis.
AI & LLM workflows
Reviewable prompt pipelines, tool permissioning, eval gates and deterministic retries for agent steps.
FinTech & risk
Structured errors with codes and context, precise numeric helpers and auditable rule functions.
Enterprise backend
web.app() routing, JSON responses, OpenAPI generation and service orchestration.
DevOps & CLI
File, path, regex, env and command helpers for local-first automation and log processing.
Systems interoperability
Native library calls, WASM artifacts, Python bridge stubs and generated host SDKs.
v3.1.36 at a glance
| Capability | What ships in the release line | Where to go deeper |
|---|---|---|
| Structured errors v2 | Typed error(kind, message, code, cause, context), typed catch, trace frames and a stable error value schema. | Production patterns |
| Generics v2 & protocols | Static <T: Printable> bounds, inference, structural protocols and marker traits, erased before runtime. | Type system |
| Iterators & async v2 | Explicit iter/next/has_next/peek, async function, await, concurrency.gather/timeout and structured task groups. | Async & concurrency |
| Modules v2 & resource scopes | Quoted module imports with aliases, using name = resource { ... } and bounded child scopes via scopes.*. | Release notes |
| Safe metaprogramming | Validated safe macros expanded before bytecode compilation; no arbitrary code generation at runtime. | CLI & projects |
| Packaging & workspaces | pea.toml, pea.lock, signed packages, registries, namespaces and multi-package pea.workspace.toml. | Project structure |
Version note: this product page documents the tagged v3.1.36 release line (Phase 68, resource scopes). The local repository now also carries tagged v3.1.39 (Phase 72, fast interpreter); the release notes record the full milestone history. The language specification version is tracked separately and need not match the product number.
A ten-line service
let app = web.app()
function home(req) {
return web.json({"message": "Hello from PeaLang", "path": req["path"]})
}
function health(req) { return web.json({"status": "ok"}) }
app.get("/", home)
app.get("/health", health)
app.serve("127.0.0.1", 8080)
Run with pea run app.pea. Validate first with pea check app.pea; compile a portable artifact with pea compile app.pea.
Your entry points
Interop, precisely
PeaLang does not claim source-to-source translation of Python, Java, Rust or TypeScript into PeaLang. Interop is delivered through embedding, native calls, HTTP/RPC and generated clients/SDKs. This distinction matters when you design a production boundary.
| Ecosystem | Supported direction | Mechanism |
|---|---|---|
| Python | PeaLang → Python calls; Python host → PeaLang runtime | interop.call_python, import_python, bridge stubs, PeaRuntime |
| Java | HTTP service → generated Java client; Java host → runtime | interop.generate_java, generated SDK sidecar |
| Rust | PeaLang functions → generated Rust SDK; native FFI available | pea sdk generate rust, interop.load_library/call_native |
| TypeScript / Node / browser | PeaLang functions → typed TypeScript client; browser host via WASM | interop.generate_typescript, generated SDK, browser SDK |
| Go | HTTP service → generated Go client; go_run from PeaLang | interop.generate_go, interop.go_run |
| Bytecode / WASM | PeaLang source → .peac → PEAWASM artifact | pea compile, pea wasm-build |