# midad > midad is a programming language whose source files are Markdown: a .md file with a midad: header is a program, the prose is its documentation, and the fenced blocks are the code. midad 0.2.1 is a single binary with no runtime to install. A program is type-checked by `midad check`, runs in the interpreter with `midad run`, serves HTTP when it has `route:` blocks, and compiles ahead of time to a native executable with `midad build --native-all`, through a C backend or a Cranelift backend. Permissions are declared in the file's frontmatter. MIT licensed. Version 0.2.1. Repository: https://github.com/mdexec/midad. Documentation: https://midad.dev/docs/. License: MIT. Every code example on these pages is executed by the build that produced them, and the output printed next to it is what it produced. ## Start - [Overview](https://midad.dev/docs/): The documentation for midad, a programming language whose source files are Markdown. Install it, learn the language, and read the reference generated from the compiler. - [Install](https://midad.dev/docs/getting-started/install/): Install the midad compiler from a prebuilt archive, cargo, Homebrew, or a source checkout, and check that it works. - [Your first program](https://midad.dev/docs/getting-started/first-program/): Write a midad program in one Markdown file, run it, check it, format it, and turn it into an executable. - [A project](https://midad.dev/docs/getting-started/project/): How a midad project is laid out, how imports and module names work, and what midad check enforces about the shape of the directory. - [FAQ](https://midad.dev/docs/faq/): The questions people ask about midad, answered in one paragraph each from the repository, the compiler and the benchmarks. - [Upgrading from 0.1.x](https://midad.dev/docs/upgrading/): Every breaking change from 0.1.0 to 0.2.1, with the code before and after, the error that finds it, and what to do about it. ## Language tour - [One program, start to finish](https://midad.dev/docs/tour/): A guided tour of midad: values, functions, collections, errors, files, commands and an HTTP server, one step at a time, with the real output of every step. ## Handbook - [Types and values](https://midad.dev/docs/handbook/types/): The nine type names, how number and float differ, how conversions work, and what lists, maps, option and result actually hold in midad 0.1. - [Control flow](https://midad.dev/docs/handbook/control-flow/): if and else, while, for over a list, break and continue, the par accumulator loop, and the operators midad has. - [Mutation and copying](https://midad.dev/docs/handbook/mutation/): Which builtins change a list or map in place, what each one answers, why a second binding never sees the change, and how E0260 catches a result that does not exist. - [Functions](https://midad.dev/docs/handbook/functions/): Declaring functions, typed parameters and return values, recursion, and passing a function name to a fn parameter. - [Modules and imports](https://midad.dev/docs/handbook/modules/): How one midad file uses another: the imports key, module names and aliases, what an import contributes, and the errors around it. - [Permissions and the frontmatter](https://midad.dev/docs/handbook/permissions/): Every key the frontmatter accepts, every permission midad checks, and what the model does and does not protect against. - [The security model](https://midad.dev/docs/handbook/security/): What a midad program can reach, what the runtime and the checker hold to, and what is still open and written down. - [Routes and serving](https://midad.dev/docs/handbook/routes/): Route blocks, the request map, responses and headers, middleware, HTML templates, handler routes, and what the server does with a request no route matches. - [HTML templates](https://midad.dev/docs/handbook/templates/): The html: block as a language surface: the template syntax, the hole rules, why a map in a variable leaves holes unchecked, and what a native build refuses. - [Calling a native library](https://midad.dev/docs/handbook/native/): The native: block, the ffi grant, the signature check, what a missing library does at run time, and why a native build refuses a bridge. - [AI intents](https://midad.dev/docs/handbook/intents/): The ai:intent block and the ai grant, what an intent call does in this build, and how a native build treats one. - [The database layer](https://midad.dev/docs/handbook/database/): SQLite from midad: the db permission, opening a connection, parameterized queries, transactions, the row cap, and what the layer deliberately does not do. - [Errors and diagnostics](https://midad.dev/docs/handbook/errors/): How midad reports a refusal: the code, the span in the Markdown file, the fix, the JSON form, the exit codes, and the difference between a warning and a runtime error. - [Project layout](https://midad.dev/docs/handbook/layout/): What goes where in a midad project, why the checker enforces the shape of the directory, and what midad new writes. ## Reference - [Reference home](https://midad.dev/docs/reference/): The generated reference: types, builtins, operators, layout rules and every diagnostic code, each read out of the compiler at build time. - [Types](https://midad.dev/docs/reference/types/): Every type the checker accepts, from midad spec. - [Builtins](https://midad.dev/docs/reference/builtins/): Every builtin, its parameter sets and its return type, from midad spec. - [Operators](https://midad.dev/docs/reference/operators/): The operators that differ from other languages, from midad spec. - [Layout rules](https://midad.dev/docs/reference/layout/): The project layout midad enforces, from midad spec. - [Diagnostic codes](https://midad.dev/docs/reference/diagnostics/): Every diagnostic code, from midad explain. ## CLI - [Command overview](https://midad.dev/docs/cli/): Every midad subcommand, the flags each one takes, and the exit codes the binary returns. - [midad check](https://midad.dev/docs/cli/check/): Type-check a midad file or project, lint it, audit the permissions it asks for, and read the result as JSON. - [midad run](https://midad.dev/docs/cli/run/): Run a midad program: its exec block, a named command, or an HTTP server when the file has routes. - [midad build](https://midad.dev/docs/cli/build/): Bundle a midad program with the interpreter, or compile it to a native executable with the C backend or Cranelift. - [midad fmt](https://midad.dev/docs/cli/fmt/): Rewrite the indentation inside a midad file's code blocks, check whether a file is formatted, or print the result. - [midad new](https://midad.dev/docs/cli/new/): Write a midad project that runs into a new directory. - [midad vendor](https://midad.dev/docs/cli/vendor/): Copy a library's midad files into a project and record a fingerprint of what was copied. - [midad ast](https://midad.dev/docs/cli/ast/): Dump the parsed syntax tree of a midad file, for working on the compiler. - [midad explain](https://midad.dev/docs/cli/explain/): Look up a diagnostic code, or read the whole table, as text or as JSON. - [midad spec](https://midad.dev/docs/cli/spec/): Print the language in one object: types, every builtin with its parameter sets and return type, the operator traps, the layout, and how many diagnostic codes there are. ## Releases - [All releases](https://midad.dev/releases/): Every midad release, newest first: 0.2.1, 0.2.0, 0.1.2, 0.1.1, 0.1.0, each with its date, its install command and its changelog entry. - [midad 0.2.1](https://midad.dev/releases/0-2-1/): Everything midad 0.2.1 changed on 2026-12-06, as CHANGELOG.md records it, and how to install that version. - [midad 0.2.0](https://midad.dev/releases/0-2-0/): Everything midad 0.2.0 changed on 2026-12-06, as CHANGELOG.md records it, and how to install that version. - [midad 0.1.2](https://midad.dev/releases/0-1-2/): Everything midad 0.1.2 changed on 2026-12-04, as CHANGELOG.md records it, and how to install that version. - [midad 0.1.1](https://midad.dev/releases/0-1-1/): Everything midad 0.1.1 changed on 2026-12-04, as CHANGELOG.md records it, and how to install that version. - [midad 0.1.0](https://midad.dev/releases/0-1-0/): Everything midad 0.1.0 changed on 2026-12-04, as CHANGELOG.md records it, and how to install that version. ## Status - [What does not work yet](https://midad.dev/docs/limits/): The honest list of what midad does not do yet, rendered from docs/LIMITS.md. ## Diagnostics - [Diagnostic codes](https://midad.dev/docs/reference/diagnostics/): all 100 codes in one table, one page per code at https://midad.dev/docs/reference/diagnostics/CODE/ (for example https://midad.dev/docs/reference/diagnostics/E0402/) ## FAQ - [What is midad?](https://midad.dev/docs/faq/#what-is-midad): midad is a programming language whose source files are Markdown. - [Does midad compile to a native binary?](https://midad.dev/docs/faq/#does-midad-compile-to-a-native-binary): Yes. `midad build app.md --native-all` compiles the whole program ahead of time, through a C backend or a Cranelift backend (`--backend auto|c|cranelift`), and `midad build app.md --native FN` compiles a single function. - [Do I need Node, Python or another runtime to use midad?](https://midad.dev/docs/faq/#do-i-need-node-python-or-another-runtime-to-use-midad): No. midad is a single binary and the interpreter is inside it; there is no Node, no Python, no Go and no package manager in the toolchain. - [Which platforms does midad run on?](https://midad.dev/docs/faq/#which-platforms-does-midad-run-on): The release matrix has four targets: x86_64 and aarch64 Linux on glibc, and Apple silicon and Intel macOS. Each release ships a `.tar.gz` and a `.sha256` for every one of them. There is no Windows target in the matrix. - [How do permissions work in midad?](https://midad.dev/docs/faq/#how-do-permissions-work-in-midad): Every program states what it may touch, in the frontmatter, in the same place a reader looks for its name. - [Can midad serve HTTP?](https://midad.dev/docs/faq/#can-midad-serve-http): Yes. Routes are blocks, not decorators: a file with `route:GET /todos/:id` blocks and a `listen` grant is a server, and `midad run app.md` starts it instead of exiting. - [Which database does midad talk to?](https://midad.dev/docs/faq/#which-database-does-midad-talk-to): SQLite, through seven `db.*` builtins behind a `db` grant: `open`, `query`, `exec`, `begin`, `commit`, `rollback` and `close`. - [Is midad production ready?](https://midad.dev/docs/faq/#is-midad-production-ready): midad is version 0.2.1, and the repository is direct about the gaps: no package manager, no structs, no generics, no closures, no test framework, and lists and maps are untyped, so `at(list, i)` returns `any` and needs a cast before it is - [How fast is midad?](https://midad.dev/docs/faq/#how-fast-is-midad): On the repository's benchmarks, measured on one 1-vCPU machine: a 50-row table template rendered 200,000 times took 93 ms with the Cranelift backend and 131 ms with the C backend, against 147 ms for Go and 171 ms for Node. - [What does midad cost, and what licence is it under?](https://midad.dev/docs/faq/#what-does-midad-cost-and-what-licence-is-it-under): Nothing, and MIT. The source is at github.com/mdexec/midad , the binaries are on the releases page, there is a Homebrew tap at `mdexec/tap`, and there is no account, no service and no paid tier. - [What is a diagnostic code, and how do I look one up?](https://midad.dev/docs/faq/#what-is-a-diagnostic-code-and-how-do-i-look-one-up): Every refusal midad makes carries a code, such as `E0402`. `midad explain E0402` prints the severity, the message and the fix, and `midad explain --json` prints all of them. - [Do I have to write the frontmatter by hand?](https://midad.dev/docs/faq/#do-i-have-to-write-the-frontmatter-by-hand): Yes, a program needs it: `midad: "0.1"` is the only required key, and a file without it is `E0001`, not an executable midad file. - [Can midad run a plain Markdown file?](https://midad.dev/docs/faq/#can-midad-run-a-plain-markdown-file): No. A `.md` file without a `midad:` header is not a program, and `midad check` answers `E0001` for it. - [How are these docs kept accurate?](https://midad.dev/docs/faq/#how-are-these-docs-kept-accurate): The reference pages are generated from the compiler at build time: types, builtins, operators and layout come from `midad spec --json`, and the diagnostic codes come from `midad explain --json`. - [How do I report a bug or ask a question?](https://midad.dev/docs/faq/#how-do-i-report-a-bug-or-ask-a-question): Open an issue at github.com/mdexec/midad/issues . A `midad check` output or a failing example is worth more than a description, because every diagnostic already carries the code that names it.