Mapanare Documentation
Learn Mapanare — the first AI-native compiled programming language. Agents, signals, streams, and tensors are first-class language primitives, not libraries.
What is Mapanare?
Mapanare is a compiled programming language where agents, signals, streams, and tensors are first-class language primitives — not libraries. It's designed for a world where AI writes and orchestrates code, not just humans. The language compiles two ways: to readable Python (accessing the full Python ecosystem) or to native binaries via LLVM for production performance up to 63x faster than Python. No OOP. No classes. No inheritance. Mapanare uses structs, enums, and pattern matching — algebraic data types that AI models generate more reliably.
Design Principles
- AI-native primitives — agents, signals, streams, tensors are language constructs
- Always compiled — transpiler to Python, LLVM for native
- Familiar syntax — draws from Rust, TypeScript, and Python
- Type-safe with inference — types where they clarify, inference elsewhere
- No OOP — structs, enums, and pattern matching instead
- Concurrency via agents — no raw threads, no shared mutable state
Topics
- Getting Started — Install and write your first program
- Variables — Bindings, mutability, and type inference
- Functions — Named functions, lambdas, and generics
- Control Flow — If/else, for loops, and pattern matching
- Structs & Enums — Algebraic data types with no classes
- Type System — Static types with inference
- Error Handling — Result, Option, and the ? operator
- Operators — Arithmetic, pipe, send, and matrix multiply
- Modules — File-based imports, exports, and visibility
- Traits — Generic abstractions and trait bounds
- Decorators — GPU dispatch and metadata annotations
- Agents — Concurrent actors with typed channels
- Signals — Reactive state with auto-propagation
- Streams — Async pipelines with pipe operator
- Tensors — Compile-time shape validation
- Pipes — Multi-agent pipeline composition
- CLI Reference — Build, run, and check commands
- Standard Library — Math, I/O, HTTP, time, text, logging
Mapanare source files use the .mn extension.