Introduction
Puddi is a statically typed, expression-oriented language that compiles to WebAssembly. One source language targets the browser, WASI runtimes (servers, edge functions, command-line tools) and plugin hosts. Programs use the WebAssembly engine’s garbage collector (WasmGC) and talk to their host through the Component Model.
@derive(Eq, Show)
struct Todo {
title: Str
var done: Bool
}
fn main() {
let todos = [Todo { title: "spec", done: true }, Todo { title: "compiler", done: false }]
let pending = todos.filter(|t| !t.done)
print("{pending.len()} of {todos.len()} left")
}
1 of 2 left
At a glance
| Topic | Puddi |
|---|---|
| Output | WebAssembly only; JavaScript appears only as loader glue |
| Hosts | browser, wasi (WASI 0.3), plugin (any Component Model host) |
| Memory | WasmGC, no manual memory management |
| Types | static, with local type inference |
| Polymorphism | generics, nominal traits, dyn Trait |
| Missing values and errors | no null: Option, Result, ?, AnyErr; panics trap |
| Mutability | let and var bindings, mutability declared per field |
| Numbers | Int is 32-bit and overflow traps; lossless widening is implicit |
| Concurrency | async fn, .await, structured task scopes, isolated workers |
| Toolchain | one pud command, a pud.toml manifest, git-based packages |
How this book is organized
- Getting started installs
pudand walks through a first program and a first package. - Language guide introduces the language one topic at a time. Every complete example in it is compiled, and the ones with output are run, against the released toolchain.
- Toolchain and Host interop cover building for each target and talking to hosts.
- Standard library lists the prelude and the
stdmodules. - Reference holds the language specification, which is the normative definition of Puddi, and the conformance suite that checks the toolchain against it.
This book documents Puddi 0.1, the first release. The language is a draft and may still change between 0.x releases; the changelog records what changed.
Choose a path
| I want to | Start here |
|---|---|
| Run a command-line program | Hello, Puddi and the bundled examples |
| Put a program on a web page | The browser |
| Write a plugin for an existing host | Plugins and WIT imports |
| Understand a compiler error | Troubleshooting and the implementation status |
| Work on the compiler | Compiler development and contributing |
Getting help
- Questions and ideas: Puddi Discussions
- Compiler and toolchain bugs: Puddi issues
- Mistakes in this book: puddi-docs issues, or the edit button at the top of each page