midad documentation

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. There is no second file to keep in sync, because the document and the program are the same document.

hello.md
---
midad: "0.1"
module: hello
---

# Hello

The function below is a fenced block; the sentence above it is documentation.

```fn
function greet(name: string): string {
  return "hello, " + name + "!";
}
```

```exec
print(greet("world"));
```
output (checked by the build)
hello, world!

Three commands cover most of the language:

$ midad check hello.md      # type-check, lint, audit permissions
$ midad run hello.md        # run the exec block
$ midad build hello.md -o hello

midad run on a file with route: blocks starts an HTTP server instead of exiting. The same file can be a script, a CLI tool and a web app.

Where to go

What this documentation is built from

Every page here comes from one of three places: the code at the commit the site was built from, the two commands that describe the language (midad spec and midad explain), or the repository's own docs/. The reference pages are generated from those commands at build time, so they cannot describe a language the binary does not have.

Every code example on the site is executed by the build, and the output you see next to it is the output it produced. An example that stops working fails the build rather than sitting here quietly wrong.

What it is not

midad is version 0.1. The language has no structs, no generics, no closures, no package manager, and its lists and maps are untyped. The compiler is moving fast, and some of what you might expect is missing. The limits page is the repository's own list, rendered unedited, and it is the one to read before you trust anything here.

On this page