Mobius is a type-inferred scripting language designed to be embedded in C and
C++ applications. Variables are type-locked — a variable's type is inferred
from its first non-nil assignment and cannot change — which lets the bytecode VM
emit type-specialized opcodes and skip runtime type checks on the hot path.
Mobius takes inspiration from Lua and adds type locking, enums, a rich switch
with pattern matching, fibers with channels, and a familiar C-style syntax.
Source files use the .mob extension.
enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }
func describe(card) {
switch (card.rank) {
case 1: return "Ace"
case 11..13: return "Face card"
default: return str(card.rank)
}
}
var card = { rank: 12, suit: Suit.HEARTS }
print(describe(card)) // "Face card"
| If you want to… | Read |
|---|---|
| Build Mobius and run your first script | Getting Started |
| See the whole language in one page | Language Tour |
| Learn the language in depth | The Guide pages below |
| Look up a built-in function | Standard Library |
Use a bundled module (json, os, http, …) |
Module Reference |
| Embed Mobius in a C/C++ program | Embedding Guide |
| Write a native plugin module | Plugin Guide |
| Read the exact grammar | Grammar (BNF) |
A progressive tour of the language. Each page builds on the last, but they also stand alone as references for a single topic.
- Getting Started — build, run, the REPL, the CLI, and your first program
- Language Tour — a fast, example-driven overview of everything
- Values and Types — type locking, annotations, literals, conversions
- Control Flow —
if/while/forand the pattern-matchingswitch - Functions — declarations, annotations, first-class values, closures
- Error Handling —
throw,try/catch/finally - Collections — arrays, tables, metatables, OOP patterns, enums
- Binary Data — buffers and
structviews over raw memory - Concurrency — fibers,
spawn/await,shared,atomic, channels - Modules and Packages —
import,load, and installable packages
- Standard Library — built-in globals available without
import - Module Reference — the bundled importable modules
- Grammar (BNF) — the canonical formal grammar
- Embedding Guide — run Mobius from C/C++, exchange values, register functions
- Plugin Guide — author native
.so/.dllmodules - Packaging —
module.yamland the.mzpackage format
See the roadmap for proposed work that hasn't landed yet: file watching, a CSV module, bundles without extraction, TLS and a data package.
Mobius is at version 0.2.3. The language, VM, standard library, fiber
runtime, embedding API, and the bundled modules are usable today. The package
manager (.mz archives) and several modules (http, socket, websocket) are
explicitly plain-transport-only for now — TLS is not yet included.