Spec M14 — project driver and mc.toml

Goal: a developer with only the mc binary builds a project by running mc build in its directory. Everything lives in src/*.mc (stage0 untouched). The single-file CLI (mc in.mc -o out.o, --exe, --backend=, --dump-*) keeps working unchanged.

CLI #

mc.toml (subset of TOML, deterministic order of keys as written) #

[project]
name  = "api"
entry = "main.mc"          # relative to the TOML directory
out   = "build/api"        # relative to the TOML directory; parent dirs created
kind  = "exe"              # exe | obj

[target]
os   = "macos"             # macos | linux | windows   (M14 implements macos only; others -> clear error)
arch = "aarch64"

[compiler]                 # optional: build a taught compiler first, then use it for `entry`
modules = ["oop.mc"]       # each is #include'd after the compiler core; user_init must be defined by one of them
out     = "build/mc-api"   # default build/mc-<name>

[linker]                   # optional; when absent on macos, kind=exe uses the built-in macho-exe backend
cmd  = "ld"
args = ["-o", "{out}", "{obj}", "-lSystem", "-syslibroot", "{sdk}", "-arch", "arm64", "{libs}"]

[libs]                     # named libraries; on macos a dylib path bound by ordinal, elsewhere passed to the linker
sqlite3 = "/usr/lib/libsqlite3.dylib"

[externs]                  # symbol or prefix* -> lib name; unlisted externs default to libSystem
"sqlite3_*" = "sqlite3"

[include]
paths = ["lib"]            # extra search roots for #include "x" after the includer's directory

Tests #

Out of scope (M15/M16) #

#include <name> from the bundle, #embed, foreign targets ([target].os != macos is a clear error).

Edit this page