The Mochi Manual
The Mochi Manual is the end-to-end guide to the language. It moves from a first
print statement to reactive agents that call language models, with each page
focused on a single concept.
To suggest a change, open an issue or send a pull request.
Get started
Quickstart
Install Mochi and tour the syntax in under fifteen minutes.
Tutorial
Build a complete Mochi program: types, functions, tests, and a CLI entry point.
System requirements
Supported operating systems, architectures, and what you need before you install.
If you know Python, Go, or TypeScript, the language basics page condenses the syntax into a single tour. The reference is a terser, concept-by-concept index.
Language basics
Variables, functions, types, and the constructs every program uses.
Basics overview
A single-page tour of the syntax: variables, functions, types, control flow, and collections.
Variables
Immutable let bindings, mutable var bindings, scoping, and destructuring.
Functions
Top-level functions, closures, default arguments, varargs, and function values.
Types
Primitive types, type declarations, union types, type aliases, and type inference rules.
Operators
Arithmetic, comparison, logical, membership, and set operators with precedence rules.
Control flow
if/else expressions, for and while loops, match expressions, break, and continue.
Errors
Mochi's explicit error model: optional values, error types, expect, and panic.
Packages
Organize larger programs with package, export, and import.
Agents and streams
Agents hold state and react to events. Streams give those events a typed shape.
Agents
Stateful blocks that react to events with on handlers and expose intents.
Streams
Typed event definitions that flow through emit, on, and pipelines.
Generative AI
The generate block, model declaration, and structured output are part of
the language. A call to a language model uses the same syntax as any other
function call.
Working with data
Load files, query lists like a database, and save the results.
Standard library and built-ins
Built-in functions
The full index of built-in functions: print, len, map, filter, reduce, and the rest.
Keywords
Every reserved keyword in Mochi, what it does, and where it appears.
Operators reference
The complete operator table with precedence and semantics.
Beyond the manual
Roadmap
What's done, what's in progress, and what's planned on the road to v1.0.
Vision
The motivations and design principles behind the language.
FAQ
Answers to the questions asked most often about Mochi.
Examples on GitHub
Hundreds of small, runnable programs covering algorithms, agents, datasets, and AI.