FAQ
These are the questions that come up when someone meets midad for the first time. Every answer is a fact from the repository at the commit this site was built from, and each one names the page or the file that has the detail. The same questions are in the machine-readable index at llms.txt.
What is midad?
midad is a programming language whose source files are Markdown. A .md file
with a midad: header is a program: the prose is documentation and the fenced
blocks are the code, with state, fn, route:, cmd and exec blocks each
in the place a reader would look for them. There is no second file to keep in
sync, because the document and the program are the same document. The
tour builds one program in steps, and the
handbook is the reference for each part.
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. Without
--native-all, midad build bundles the interpreter and the source into one
executable instead. The C backend covers a subset of the language and refuses
the rest by name, rather than miscompiling it: routes, commands, FFI, the
blocking file builtins and eval_source are on that list. Served handlers can
still be compiled with midad run --native-handlers.
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. A C compiler (cc) is
needed only for build --native-all and --native-handlers, which emit C. Rust
is needed only to install with cargo install or to build from a checkout.
Programs that call db.* need libsqlite3 at run time, which the interpreter
loads with dlopen at the first db.open.
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. From source,
midad builds with Rust stable on any of those platforms, and the
install page has the commands.
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. The grants are fs_read, fs_write, net, env,
ffi, listen, db, ai and eval, and nothing is granted by default. Each
grant is checked twice: statically by midad check, and again at run time
against the actual target. The language says plainly that the static check alone
is not a sandbox, and
Permissions and the frontmatter explains how a target
is matched.
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. The same file is a script, a CLI tool and a web app without being
split up. Routes and serving covers the request map, the
response helpers and the static directory.
Which database does midad talk to?
SQLite, through seven db.* builtins behind a db grant: open, query,
exec, begin, commit, rollback and close. Every value is bound by
SQLite's own parameter mechanism, so a value can never become SQL, while an
identifier cannot be bound at all. db.query answers at most 10,000 rows.
PostgreSQL and MySQL are designed and not built. The
database layer has the details.
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
arithmetic. Whether that is ready for a given project is a judgement about those
limits, not about the version number. The
limits page is the repository's own list, rendered unedited.
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. A route answering
33.7 KB of JSON took 136.5 µs per request, against 85.5 µs for Go, 211.6 µs for
Node and 325.4 µs for Rust. midad loses the JSON route and the database group-by
and the tables in BENCHMARKS.md say so next to the wins.
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?
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. The reference has a page per code,
generated from the binary itself, so the page and the compiler cannot disagree.
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. midad new DIR writes a
project that already has it, and midad fmt rewrites a file without changing
what it means. The other keys are module, entry, imports, persist,
static and permissions.
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. Fenced blocks are only code when the header says so,
which is what keeps an ordinary README from becoming a program by accident.
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. Every code example on the site is
executed by the same build, and an example whose output stops matching fails it.
The pages are also checked for the things a crawler needs, so a page cannot ship
without a title, a description, a canonical URL and structured data.
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.