Mighty is an agent-first systems programming language. It is
statically typed, ownership-based, and treats agents, protocols,
capabilities, effects, arenas, and budgets as first-class
concepts. The toolchain targets both native code (Cranelift JIT + AOT;
LLVM behind --features llvm) and WebAssembly (Component Model by
default; bare core modules via --no-component).
The compiler, runtime, formatter, package manager, doc generator, LSP
server, and stdlib are all in one Rust workspace and one mty binary.
Status: pre-alpha. The v1.0 language spec is at v1.0-RC3 (operator precedence promoted to normative §11.1.1; full 63-reserved-keyword set enumerated). The toolchain is exercised by 1051 Rust tests across 20 crates plus a second independent Python front-end at
impl-py/(137 tests) and a third source-only Go front-end atimpl-go/(4848 LOC, cross-validation pending Go toolchain). All six CI jobs are required gates. End-to-end self-hosting is now complete for the slice-1 subset: lexer → parser → HIR → typeck → MtyIR → wasm codegen, all written in Mighty. A1.0GA tag still awaits the completion of the 2nd-impl through type-check, the 3rd-impl cross-validation, eight RFC comment-window closures (RFC-001..006 plus the v0.13 RFC-008 + RFC-009 drafts), and the normative conformance suite (currently 89 cases / 16 categories). See Status below.
A versioned release is not yet published. Build the toolchain from source:
git clone https://github.com/hassard0/Mighty
cd Mighty
cargo install --path crates/mty-cliThis installs the mty binary. MSRV: Rust 1.85.
mty new hello
cd hello
mty check src/main.mty
mty run src/main.mty
# → hello, Mightymty new produces:
fn main() {
log("hello, Mighty")
}
Then:
| Command | What it does |
|---|---|
mty check |
lex, parse, lower, type-check, borrow-check |
mty run |
JIT via Cranelift (interpreter fallback on unsupported shapes) |
mty build |
native object + linker, or --target wasm32-wasi for Wasm |
mty fmt |
canonical Wadler/Lindig formatter |
mty dump --sir |
inspect the mid-level IR |
mty explain MTxxxx |
one-paragraph explanation of any diagnostic code |
Type system
- Hindley–Milner inference with bidirectional checking
- Generics with monomorphization, trait dispatch,
dyn Traitfat pointers ?propagation forResult- Ownership + move + borrow + affine + arena tracking
- Field-level borrow Places with NLL last-use deactivation
- Effect system + capabilities (
fs,net,time,rand,model) - Formal
Sendabletrait — cross-agent message-arg soundness
Concurrency
- Tokio-backed concurrent runtime with mailboxes, supervisors, deadline timers
- Multi-core scheduler — per-worker tokio runtimes + crossbeam-deque work-stealing + affinity hints
- Cooperative mid-turn cancellation, deterministic-execution mode
- Per-handler memory budget + tick budget with auto-charge on alloc
Codegen
- Cranelift JIT + AOT object emission (default)
- LLVM backend (
--features llvm) - Wasm core module + Component Model (
wit-component) emission - DWARF v4 debug info + Wasm source maps +
namesection
Tooling
mty lsp— LSP 3.17 server (diagnostics, hover, completion, go-to-def, semantic tokens, rename, inlay hints, code actions, signature help, workspace folders)mty pkg— package manager: resolver, lockfile, GitHub-Releases-backed registry,.tar.gzbundles, signed sidecarsmty doc— markdown / HTML doc generator with search indexmty fmt— canonical formatter (idempotent under fuzz)- Stdlib:
std.json,std.tls,std.http,std.fs,std.time,std.test,std.io— backed byrustls/hyper/serde_json/tokio - Diagnostics:
MT0001–MT8010, each withmty explain
Self-hosting (full pipeline)
- Lexer (full), parser (~1.9 KLOC subset), HIR lowering, minimal typeck, MtyIR lowering, and Wasm core-module codegen are all written in Mighty itself and exercised end-to-end against examples 01-05 and an arithmetic fixture.
- 46 self-host tests passing (6 codegen + 9 IR + 7 typeck + 7 HIR + 13 parser + 4 lexer; 1 codegen ignored — example 03 generic
Option[T]is v0.14). - v0.13 closed the front-end-through-back-end self-host chain for the slice-1 subset.
Independent implementations
- Rust reference compiler (this repo,
crates/mty-*). - Python 2nd-impl front-end at
impl-py/— pure-Python lexer + parser built from the v1.0-RC2 spec prose alone. 137 tests, 21/21 examples lex+parse (v0.13 picked up the new21_wasi_preview2.mtycleanly with no impl changes). - Go 3rd-impl front-end at
impl-go/— Go 1.22+ lexer + parser + CLI built from the v1.0-RC3 spec prose alone. 4848 LOC; cross-validation (go test ./..., example sweep) pending Go toolchain on the build host.
Live docs site: https://hassard0.github.io/Mighty/
- Getting started
- Tour — walk through the canonical examples
- Language spec v1.0-RC3 (frozen for v1.0)
- Spec v0.1 + amendment log
- Reference — CLI, manifest, registry, diagnostics
- Internals — compiler architecture, crate-by-crate
- FAQ
- Contributing
The compiler is a Rust workspace of twenty crates:
| Crate | Responsibility |
|---|---|
mty-syntax |
lexer (logos), CST (rowan), parser |
mty-ast |
typed AST view over the CST |
mty-diagnostics |
diagnostic types, MT-coded labels, ariadne rendering |
mty-hir |
name-resolved HIR with arena storage; macro preprocessor hook |
mty-types |
resolved Ty, HM inference, bidirectional type checker, effects + capabilities, Sendable |
mty-borrow |
ownership / move / borrow / affine / arena analysis (field-level Places + NLL last-use) |
mty-sir |
mid-level IR + tree-walking interpreter |
mty-runtime |
concurrent tokio runtime: agents, mailboxes, supervisors, budgets |
mty-codegen-cranelift |
native backend — JIT + AOT object |
mty-codegen-wasm |
wasm32-wasi / wasm32-web core module + Component Model emitter |
mty-codegen-llvm |
LLVM backend (real lowering behind --features llvm) |
mty-debuginfo |
DWARF v4 builder + wasm source-map + name section |
mty-fmt |
canonical formatter (Wadler/Lindig pretty-printer) |
mty-driver |
compilation pipeline and mighty.toml manifest loader |
mty-pkg |
package manager: resolver, lockfile, fetchers, publisher |
mty-lsp |
LSP 3.17 server over stdio |
mty-doc |
doc generator (extract + render markdown/HTML) |
mty-stdlib |
real std.json / tls / http / fs / time / test |
mty-macros |
declarative-macro registry + expander + hygiene |
mty-cli |
the mty binary |
Adjacent trees: examples/ (canonical programs), demos/
(end-to-end runnable apps with smoke.sh), benches/ (criterion +
the mty-bench runner), selfhost/ (the bootstrap compiler written
in Mighty), tests/conformance/ (cross-crate behavioural specs),
editor/vscode/ (VS Code extension).
The v1.0 spec is feature-complete at v1.0-RC2 (docs/spec/v1.0-rc.md).
Proposed freeze date: 2026-09-01. Blockers:
- A second independent compiler implementation (RFC-007).
- The six RFC 30-day comment windows (RFC-001 .. RFC-006).
- A published normative conformance suite.
- Lossless live agent migration; per-message work-stealing.
- Polonius-style borrows; real cap-name resolution wiring.
- DWARF v5 + per-instruction line program.
- Distributed agents; PGO / ThinLTO.
- WASI Preview 2 + user-supplied WIT — v0.13 (
--wasi=p2,--world,[wit]section). - Effect-row polymorphism infrastructure — v0.13 (RFC-008,
mty-types::effects::row). - Set-of-scopes macro hygiene infrastructure — v0.13 (RFC-009,
mty-macros::scopes+hygiene). - End-to-end self-hosting through Wasm codegen — v0.13.
For the full per-version history of what shipped on the road to v1.0,
see CHANGELOG.md.
Mighty is pre-alpha. Internal milestones have been tagged through
v0.13. The v1.0 language spec is at v1.0-RC3 — see
docs/spec/v1.0-rc.md. There are 1051 Rust tests across the workspace
(plus 137 Python tests in the impl-py/ 2nd-impl, 89
normative conformance cases, and 46 self-host tests = 1323
combined), 0 clippy warnings under the strict pedantic gate
(a required CI job, not advisory), and 4/4 demos pass smoke.sh.
The cargo-fuzz harness covers four targets (parser / typeck / fmt /
codegen), and the normative conformance corpus stands at 89 cases
across 16 categories (3 ignored: 2 carried over from v0.11, 1
red-shirt carried over from v0.12). v0.13 reached the
end-to-end self-host milestone (lexer → parser → HIR → typeck →
MtyIR → wasm codegen, all in Mighty) and added a WASI Preview 2
backend (--wasi=p2) plus two RFC drafts with usable infrastructure
(RFC-008 effect-row polymorphism, RFC-009 set-of-scopes macro hygiene).
There is no released binary yet. Build from source, treat the language as unstable, and please file issues for everything that surprises you.
Issues are welcome. Pull requests must rebase on main, include
tests, and pass cargo fmt --all -- --check,
cargo clippy --workspace --all-targets -- -D warnings, and
cargo test --workspace. See CONTRIBUTING.md
for the short form and docs/contributing.md
for the full workflow. The community standards live in
CODE_OF_CONDUCT.md.
- File bug reports, feature requests, and language questions in GitHub Issues.
- Open-ended design discussions go in GitHub Discussions.
- There is no Discord / Slack / matrix room yet.
Mighty is released under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work shall be MIT-licensed as above, without any additional terms or conditions.