Markdown files that run.ملفات Markdown تعمل كبرامج.

One .md file holds the prose and the program. midad type-checks it, runs it in an interpreter, or compiles it to a native binary through your C compiler, or through a built-in Cranelift backend.ملف .md‏ واحد يجمع الشرح والبرنامج. تفحص midad الأنواع، وتشغّله بمفسِّر، أو تحوّله إلى برنامج تنفيذي أصلي عبر مترجم C لديك، أو عبر واجهة Cranelift المدمجة إن لم يوجد مترجم C.

checkفحص
every block, before anything runs, with codes and spansكل كتلة قبل التشغيل، برموز وأماكن
runتشغيل
interpreter, no compiler neededبالمفسِّر، بلا حاجة إلى مترجم
buildبناء
C backend (cc -O2) or Craneliftواجهة C (‏cc -O2) أو Cranelift
licenceالرخصة
MIT · no hosted service · no known users yetMIT · بلا خدمة مستضافة · لا مستخدمون معروفون بعد

The prose is the documentation and the fenced blocks are the code, so there is no second file to keep in sync. Conditions must be booleans, and a number never mixes with a float implicitly: both are errors before anything runs.الشرح هو التوثيق، والكتل المسوَّرة هي الكود، فلا ملف ثانٍ يجب مزامنته. يجب أن تكون الشروط قيماً منطقية، ولا يُخلط عدد صحيح بعدد عشري ضمناً: كلاهما خطأ قبل أن يعمل أي شيء.

On every example on this site, the interpreter, the C backend and the Cranelift backend print the same output.في كل مثال على هذا الموقع، يعطي المفسِّر وواجهة C وواجهة Cranelift المخرجات نفسها.

report.mdthe whole programالبرنامج كله
---
midad: "0.1"
module: report
---

# Order report

Totals are a function. The program is the `exec` block.

```fn
function total(prices: list): number {
  let sum = 0;
  for p in prices {
    sum = sum + int(p);
  }
  return sum;
}

function average(prices: list): float {
  return float(total(prices)) / float(len(prices));
}
```

```exec
let prices = [120, 45, 300, 16];
print("orders: " + str(len(prices)));
print("total: " + str(total(prices)));
print("average: " + str(average(prices)));
let units = idiv(total(prices), len(prices));
print("whole units per order: " + str(units));
```
outputالمخرجاتinterpreter / C / Craneliftالمفسِّر / C / Cranelift
$ midad run report.md
orders: 4
total: 481
average: 120.25
whole units per order: 120
$ midad build report.md --native-all -o report
built: 17 KB (C backend) / 1.2 MB (Cranelift)

measured, one vCPUقياسات، معالج افتراضي واحد

workloadinterpcraneliftCGo
heavynot run366615682616
json15.89.91.339.0
strcat6.81.40.56.2
fib(27)141.31.81.42.0
lists17.81.00.81.3
splitjoin8.92.72.22.1
loops452.818.38.87.2
maps18.86.89.44.0
ms, whole process, median of three, 2026-12-04. green = fastest, amber = slower than Go. The interpreter is 50-100x slower on the loop workloads.بالمللي ثانية، للعملية كاملة، الوسيط لثلاث تشغيلات، 2026-12-04. الأخضر الأسرع، والكهرماني أبطأ من Go. المفسِّر أبطأ 50 إلى 100 مرة في اختبارات الحلقات.

what it does not doما لا يفعله بعد

  • no package manager, registry or version resolutionلا مدير حزم ولا سجل ولا حل إصدارات
  • lists and maps are untyped: an element is anyالقوائم والخرائط بلا أنواع: العنصر any
  • no types of your own, no generics, no closuresلا أنواع خاصة، ولا عامة، ولا إغلاقات
  • native builds refuse routes, commands and foreign calls by nameالبناء الأصلي يرفض المسارات والأوامر والاستدعاءات الخارجية بالاسم
  • the native runtime never frees memoryبيئة التشغيل الأصلية لا تحرّر الذاكرة
  • map key order differs between the interpreter and Cترتيب مفاتيح الخريطة يختلف بين المفسِّر وC
  • no known usersلا مستخدمون معروفون
  • The full list is docs/limits, rendered from docs/LIMITS.md at build time.القائمة الكاملة في docs/limits، مولَّدة من docs/LIMITS.md وقت البناء.

    installالتثبيت

  • cargo install midad  from crates.ioمن crates.io
  • brew install mdexec/tap/midad
  • archives for Linux (x86-64, arm64) and macOS (Apple silicon, Intel) on the v0.2.0 release, each with a .sha256أرشيفات Linux (x86-64 وarm64) وmacOS (Apple silicon وIntel) على إصدار v0.2.0، ومع كل أرشيف .sha256
  • or from source: git clone https://github.com/mdexec/midad && cd midad && cargo build --releaseأو من المصدر: git clone https://github.com/mdexec/midad && cd midad && cargo build --release
  • the C backend needs cc; the interpreter needs nothingواجهة C تحتاج cc؛ والمفسِّر لا يحتاج شيئاً
  • Cranelift links libmidad_rt.a. The 0.2.0 archives and cargo install carry the binary without it: build one with cargo build -p midad-rt --release and point MIDAD_RT_A at itتربط واجهة Cranelift الملف libmidad_rt.a. ولا يأتي هذا الملف مع أرشيفات الإصدار 0.2.0 ولا مع cargo install: ابنِه بالأمر cargo build -p midad-rt --release ثم اضبط MIDAD_RT_A على مساره