Language reference
Changelog
Format follows Keep a Changelog, versioning follows SemVer.
[Unreleased]
Added
-
make publish: builds the site (make site) and uploadstarget/site/public/to a Cloudflare Pages project withwrangler pages deploy(wrangler 4.167.0 throughnpx).CLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID,CLOUDFLARE_PAGES_PROJECT,SITE_DOMAINand the optionalCLOUDFLARE_PAGES_BRANCHare read from.env(ignored by git; new.env.example); the target stops before building when one is missing or the domain is stillmul.example. ADR-012 amendment. -
Signed numbers for patch mode (row 4.80, RFC-014 Signs, ADR-022 and ADR-021 amendments, RFC-013, Go adapter 0.13.0):
mul plan set_literal --signedtakes the value as the whole number with its sign. A number literal fact has an optionalsign("unary"withsignStartandsignedText, or"free"; none for the right operand of a binary operator), so the plan replaces an existing unary sign (-3to-5,+5or5; the inner minus of- -6) or writes one where the syntax allows (x := 5to-6,-(7)to-(-9)) and refuses it fora - 3anda -3; the plan marks the edit"signed": true, andapplyaccepts a sign only for such an edit and refuses one that would join the operator before it (MUL-P014,a-and-5). Without the flag nothing changes.mul_graph::ForeignLiteralhassign: Sign. Fixturescorpus/signs.go,corpus/signs_bom.go(byte order mark and CRLF), the cases and refusals ofscripts/patch.sh(patch-cases.tsv,patch-refusals.tsv). -
Snapshot id under load (row 4.190, RFC-013): the intermittent
Snapshot::iddifference ongolang.org/x/toolsseen in row 4.14 was looked for in the core and the Go adapter and not reproduced: forty ingests (twenty ofx/toolsv0.53.0, twenty of the Go tool treecmd, two at a time each, with sixteen busy loops on 32 cores) gavesnap:5afd6b93a2f5a583andsnap:97d01f4b13e34817every time, and twelve more of each in a heavier run did too (onecmdrun of those lost its adapter process to memory pressure of the shared machine, which is an error, not another id). Part joining and hashing are sequential and per key in arrival order, and the adapter's extraction goroutine hands its result over through a closed channel before any part is built, so no part is split, reused or reordered while the state changes. New tests inmul-adapter(many_small_parts_give_the_id_of_the_joined_answer,a_part_out_of_order_or_twice_changes_the_id) fail when a part is hashed out of order, twice or not at all. The earlier difference is most likely the cgo cache spelling fixed in row 4.90. -
Core memory of a large ingest, second step (row 4.91, ADR-023 amendment):
mul_graph::Interned(a sharedArc<str>that derefs tostr) holds each repeated path, symbol id, package id, name, kind and usage once, so the fields ofForeignFile,ForeignPackage,ForeignSymbol,ForeignReference,ForeignLiteralandForeignDiagnosticthat carried those asStringare nowInterned(readers that need an owned string call.to_string());mul_adapter::Partsspools the compact text forSnapshot::idto a temporary file outside the project instead of holding it,Parts::finishreturns aResult, andAdapterError::Spoolreports a file that cannot be written or read.Snapshot::idand the graphsnapshot_idare unchanged (checked against the old formula on the fixture,golang.org/x/toolsandcmd). Core peak forcmd1,277 MB to 569 MB, for x/tools 374 MB to 276 MB (release build,VmHWM). -
Extraction time of a very large project (row 4.15, RFC-013, ADR-023 amendment, Go adapter 0.12.0): on 2 cores with a cold cache the Go tool tree
cmdneeded 27.2 s for the first part (45 % of the 60 s per answer). The adapter now extracts in the background and answers aningestrequest with an empty part and the samenextafter 15 s if the extraction is not done; the core is unchanged (it reads empty parts as any other, a test showsSnapshot::idstays the same), the protocol and manifest gain nothing and the contract stayslcl-v0. -
Memory of a large ingest (row 4.14, RFC-013, ADR-023 amendment): the core no longer joins the parts of a paged
ingestinto oneserde_json::Value.mul_adapter::Client::ingesttakes a sink and hands it each part as it arrives;mul_graph::ForeignBuilder(add_part,finish) imports the parts into the typed lists, checking per part what the part decides and, after the last part, what needs all of them (duplicates, ranges inside files, dangling ids, missing lists).ForeignGraph::from_factsis the one-part case.Snapshot::id(same value, hashed from the compact text kept per key) and the graphsnapshot_idare unchanged. Peak memory of themulprocess in a release build: 642 MB to 373 MB forgolang.org/x/tools, 3,451 MB to 1,275 MB for the Go tool treecmd; time unchanged. -
Go adapter 0.11.0: named parameters of function types in package-level
varandconstand the contents of a function literal assigned to one are symbols with the variable as owner (F/parameter:x; row 4.30, RFC-013, ADR-021 amendment). No schema change; references from names that share one declaration range are now attributed in a fixed order. -
Go adapter, cgo files that are not plain (row 4.31, Go adapter 0.10.0, RFC-013, ADR-021 amendment): a symbol or use of a project file that the
//linemapping cannot confirm is no longer dropped silently; the adapter reports a diagnostic withfileandoffset(names cgo made up stay silent). New fixturefrontends/go/testdata/repo/native/crlf.go(cgo with CRLF line ends). A byte order mark in a cgo file stops cgo itself, so that case is checked on a throwaway project, not in the corpus. No schema change. -
mul plan set_literalselectors and kinds (row 4.13, RFC-014, RFC-013, ADR-022 amendment):--at <file>:<line>:<column>next to--at <file>:<byte>(bytes from 1, a line ends at\n, a CR and a byte order mark are counted; the file hash must still be the one of the facts, elseMUL-P005;scripts/patch.shchecks it on the CRLF and byte-order-mark corpus files); a number with a sign is refused with its own message (a minus is an operator in the facts, so--5or a changed meaning is never written; the transformation that edits a sign is row 4.80); optional adapter methodvalidatefor literal kinds outside the five lexical rules, declared by"validate": trueincapabilities.json(contract stayslcl-v0, an adapter without it is unchanged), whose acceptance is recorded as"validatedBy": "adapter"on the edit, so thatapplytakes a kind with no rule only from such an edit.mul_patch::Settingsreplaces theallow_generatedargument ofplan_set_literal;Editgainsadapter_checked;mul_adapter::Client::validate. No Go adapter change. -
Go adapter 0.9.0: diagnostic offsets the line:column text cannot give (row 4.20, RFC-013, ADR-021 amendment): the adapter records the parser's raw error positions, so end-of-file syntax errors get an exact
offset, and reads files with//linedirectives through their adjusted positions (a directive without a column leavesoffsetnull). No schema change; new fixturefrontends/go/testdata/broken/directive/. -
The Go corpus
frontends/go/testdata/repopasses the whole verification (row 4.18, ADR-024):corpus/tags_ignored.gocarries// +build ignore,!ignorematching its//go:build ignore && !ignoreline, sogo vet(run bygo test) accepts it andmul apply --verify format,build,testkeeps a one-literal change on the corpus.scripts/verify.shtakes@repoas a project (the corpus itself) andverify-cases.tsvruns it with all three steps; the file stays excluded from the build, still has a hash and no symbols, and the byte-exact round trip is unchanged. -
generatedmarker on files (row 4.10, Go adapter 0.8.0, RFC-013, RFC-014, ADR-021 amendment): a file oflcl-facts-v0gains the optional booleangenerated(absent ornullis false, so old payloads load). The Go adapter sets it for the header// Code generated ... DO NOT EDIT.before the package clause (go/ast.IsGenerated).ForeignFile::generatedcarries it intoForeignGraph(not intosnapshot_id).mul planrefuses a literal in a generated file with the newerror[MUL-P013]and plans nothing;--allow-generatedplans it and prints a warning on standard error (plan_set_literaltakesallow_generated). The plan does not record the override; the apply-time check stays in row 5.6. -
Loopback in the verification namespace (row 4.17, ADR-024 amendment): a step now has its own loopback up (
unshare --keep-caps,ip link set lo up, thensetprivdrops every capability), so a test that listens and connects on127.0.0.1passes; the network to the outside stays cut. New fixturefrontends/go/testdata/verify/loopback; thenetworkfixture still fails to reach the host.ipandsetprivare now required, and a system without them is refused withMUL-E001. -
Verification (row 4.4, Go adapter 0.7.0, RFC-013, RFC-014, ADR-024): new crate
mul-verifyand the commandmul verify <language> [--dir] [--before <dir>] [--steps format,build,test] [--timeout <s>] [--memory <MiB>] [--log-dir] [--frontends]. Thecapabilities.jsonmanifest gains the optionalverifyblock (envand the commands of the stepsformat,build,test;mul_adapter::VerifySpec,Step), so the core holds no language command; no protocol message is added and the contract stayslcl-v0. Each step runs in a child process with a wall-clock limit (120 s), a memory limit (RLIMIT_DATA, 4096 MiB per process), a file size limit and no network, without root:unshare --user --map-current-user --net --pid --fork --kill-childplusprlimit(the options evaluated and the limits of the mechanism are in ADR-024). A system that cannot do this (not Linux, tools missing, user namespaces forbidden) getserror[MUL-E001]and nothing runs; there is no unisolated mode. The report has per step the status, the time, the first 10 lines of output and the path of the full log; the first failed step stops the rest. The format step passes unless the change left a file unformatted that was not before (so an unformatted fixture does not fail, and a longer literal that moves the alignment of comments does; row 4.12).mul apply <plan> --verify build,testwrites the plan, verifies the written tree and puts the old bytes back when a step fails (error[MUL-E008], exit 1); newmul_patch::apply_checked; a restore that fails isMUL-P012. Error familyMUL-E001toMUL-E008andMUL-P012indocs/language/errors.md.scripts/verify.sh(inmake check-adapterthroughfrontends/<language>/testdata/verify-cases.tsv) runs seven fixtures through the real CLI: a passing change, a file unformatted before and after, a build break, a failing test, a test that hangs (killed at the limit, no process left), a test that connects to a listener on the host (it must fail, and the listener must see only the control connection) and a change that unformats a file; the four failing cases leave the tree byte for byte as it was.scripts/lib.shholds the tree-state function shared withscripts/patch.sh.mul-patchsplitsstage.rsout ofapply.rs. Wave 4 gate: on a Go modulemul planandmul apply --verify format,build,testchange one literal with a minimal patch and gofmt,go buildandgo testpass. -
Go adapter 0.6.0: cgo files, type parameters and function-type parameters (row 4.11, RFC-013, ADR-021 amendment): a file that uses cgo is read like any other, its ranges mapped from cgo's output back to the source through its
//linedirectives; new kindtypeparameter(<owner>/typeparameter:T) andparametersymbols for interface methods, function types and function-typed fields (Visitor.Visit/parameter:node,Handler/parameter:request). No schema change. New fixturesnative/mixed.goandmembers/typeparams.go. -
Broken Go projects in the round-trip corpus (row 4.9, RFC-013, ADR-021 amendment):
frontends/go/testdata/broken/is a module that does not build (syntax error, type errors, a missing and an unused import, a test file that does not compile, a healthy package);scripts/roundtrip.shround-trips it next totestdata/repo/. A diagnostic oflcl-facts-v0gains the optional keysfileandoffset(byte offset of the position), the core validates them (ForeignDiagnostic::file,offset; absent or null stays valid) andmul ingestprints(byte N). Go adapter 0.5.0 computes them (null for a position outside the file or a file with//linedirectives) and sorts diagnostics by package, file and offset. -
Ingest at the size of a real module (row 4.8, RFC-013 Paged ingest, ADR-023): measured on
golang.org/x/tools(72.9 MB of facts, ingest 2.3 s in the adapter) and the Go tool treecmd(408.8 MB, 14 s), loading dependencies from source is cheap (1.3 s and 3.4 s) and the limit that was hit is the 64 MiB answer line, not the 60 s.ingestmay now be answered in parts: a part carriesnext,mul-adapterasks for the next one withcursor(new moduleparts, at most 4096 parts, each with its own 60 s) and joins the lists, so snapshots and the graph see the unpaged object; a result that fits one part is unchanged. Go adapter 0.4.0 pages at about 16 MiB (x/tools6.2 s in 5 parts,cmd30.6 s in 26 parts); the facts of the fixture are byte-identical to 0.3.0. No cache and no export data: not needed, recorded in ADR-023. The measurements are infrontends/go/README.md. -
Patch engine and
set_literal(row 4.3, RFC-014, ADR-022): new cratemul-patchand the commandsmul plan set_literal <language> <dir> (--at <file>:<byte> | --symbol <id>) --value <text> [--out <plan.json>]andmul apply <plan.json> [--dir <dir>] [--dry-run]. A plan is JSON (mul-plan-v0, unknown keys ignored so wave 5 can extend it) with edits on byte ranges, each withold,new,kindand thebaseHashof the whole file.applyre-checks everything against the disk and writes nothing when the file hash differs, the old bytes are not there, a range is empty, outside the file or overlapping, the path is not a plain relative path inside the root or is a link, or the new value is not a well-formed literal of its kind (lexical rules forint,float,imaginary,char,string; any other kind is refused). Each file is replaced atomically (exclusive temporary file, mode copied, rename) and every other byte, including a byte order mark and CRLF, is copied unchanged;--dry-runprints the same diff without writing.scripts/patch.sh(inmake check-adapterthroughfrontends/<language>/testdata/patch-cases.tsv) runs plan and apply on the Go corpus and fails unless only the literal's bytes changed, the mode is kept, no temporary file is left and a second apply is refused. Every refusal printserror[MUL-P001]toMUL-P011(plan unreadable, empty, path outside, not a regular file, hash mismatch, range outside, overlap, old bytes differ, ill-formed new literal, file changed between check and write, write failed), documented indocs/language/errors.md; all files are compared once more before the first write, and a system failure on a later file restores the earlier ones. A plan is a plain file (stdout or--out), no implicit store; the convention and the compatibility with row 5.1 are in RFC-014.patch-cases.tsvalso covers float, imaginary and char literals and a file edited between plan and apply. The first half of the wave 4 gate;verifyand rollback are row 4.4. -
Go adapter 0.3.0, symbol coverage (row 4.7, RFC-013, ADR-021 amendment): embedded struct fields, interface methods, local types, local constants and labels (new kind
label) are symbols (Record.Base,Reader.Read,<fn>/type:<T>,<fn>/constant:<name>,<fn>/label:<name>) and their uses are references; no change to the facts schema or the Rust core. Generated files are listed and read like any other; a file that uses cgo is listed and hashed as written, gives no symbols, and a diagnostic says so. New fixturesfrontends/go/testdata/repo/members/andnative/. -
Backlog rows written out for sessions:
BACKLOG.mdgains the row formDone when:/Open, to settle in …/Decide with the user first:and the rule that a choice left open by a row is recorded in an RFC or ADR before it is implemented. Rows 4.3, 4.4, 5.1–5.6, 6.1–6.4, 7.1, 7.2 and 7.5 are rewritten in that form from the cited sections of the design document; rows 7.2, 9.2 and 12.3 are split (new rows 7.2a logical tasks, 9.2a floating point, 12.3alang.upgrade). Rows of waves 8–13 stay outlines and are rewritten by the first session of their wave. -
Literal facts for
set_literal(row 4.6, RFC-013, ADR-021 amendment):lcl-facts-v0gains the required listliterals(kind,text,file,start,end,symbol): the literal tokens of the project with their exact byte range (a byte order mark and CRLF count), the token as written and the symbol that holds it. The schema name is unchanged; the core now rejects a payload without the list, and the adapter contractSnapshot::idof a project changes.mul_graph::ForeignGraphhasliterals,literals_ofandliteral_at; the import checks file, range, text length, duplicate start and holder.mul ingestprintsliterals: N,mul inspect --languageone line per literal, and--symbolthe literals the symbol holds. The Go adapter (0.2.0) reports int, float, imaginary, char and string literals, skipping import paths. -
Round-trip corpus (row 4.5, spec §13.7):
frontends/go/testdata/repo/corpus/joins the Go fixture project (comments at every position, odd spacing, generics, raw strings, non-ASCII identifiers,//linedirectives, build tags, CRLF, mixed line ends, byte order mark, no final newline). Go tests ininternal/adaptercopy the project with fixed old modification times, ingest through the protocol and fail on any change of bytes, modes, mtimes or paths, and check that file hashes equal the SHA-256 of the files and that symbol and reference ranges and symbol hashes are exact. Newscripts/roundtrip.sh <language>runs the realmul ingeston a copy offrontends/<language>/testdata/repoand diffs the tree before and after;make check-adapterruns it for any adapter that has such a corpus. No change to the adapter or the facts schema. -
Go adapter and the facts of
ingest(row 4.2, RFC-013, ADR-021):frontends/go(adapter 0.1.0, level L1, Go 1.21 to 1.27, ownCHANGELOG.md,Makefilewithbuild,test,lint,coverage) reads a Go module withgo/packagesandgo/typesand answershello,project(thegodirective ofgo.mod, as major.minor),ingestandshutdown. Theingestresultlcl-facts-v0is language-neutral:fileswith SHA-256 of their exact bytes,packages,symbols(functions, methods, types, variables, constants, struct fields, parameters, locals; byte range of the declaration and of its name, SHA-256 of exactly those bytes, scope) andreferences(call, read, write, type; byte range of the name) between symbols the project defines, anddiagnostics; offsets count a byte order mark and CRLF. The adapter runs the Go tool withGOFLAGS=-mod=readonlyandGOTOOLCHAIN=localand writes nothing. Newmul_graph::ForeignGraph::from_factsimports and validates the facts (unique ids, ranges inside their file, no dangling id) with its ownsnapshot_id; the core still names no language. New commands, all read-only:mul ingest <language> <dir>,mul inspect --language <language> [--symbol <id>] <dir>,mul refs <language> <dir> <symbol>, each with--frontends <dir>.make check-adapter LANG=<language>builds the adapter first when its Makefile has abuildtarget.mul-graphdepends onserde_json; the Go adapter ongolang.org/x/toolsv0.53.0. -
Longer inputs for the
typed_programfuzz target (row 3.14, ADR-015):make fuzzruns it with-max_len=$(FUZZ_TYPED_LEN)(default 16384) and-len_control=0, because libFuzzer's length control had kept inputs at 43 bytes or less. In a 300 s session on nightly withcargo-fuzz0.13.2 the corpus reached 1908 inputs of up to 1252 bytes (424 KB in all) in 20.8 k runs (bigger programs, so fewer runs than the 167 k of row 3.12); no crash, so no regression case. -
Language adapter contract LCL v0 (row 4.1, RFC-013, ADR-020): new crate
mul-adapter. An adapter is a separate process in any language infrontends/<language>/, found only throughfrontends/*/capabilities.json(language,adapterVersion,level0-4,languageVersionsmin..max,outsideRangereadOnly|refuse,command); the core names no language.Clientstarts it and speaks one JSON object per line over stdio (hello,project,ingest,shutdown) with a 60 s timeout, a 64 MiB line limit and named errors. The adapter reports the project's declared language version (go.mod,composer.json,pyproject.toml,tsconfig);decidegives full access inside the range and read-only access or a refusal outside it or without a declared version, never a guess;Snapshotkeeps the version, the access and the adapter's facts, with an idsnap:....mul adapter check <language> [--frontends <dir>] [--project <dir>]andmake check-adapter LANG=<language>check one adapter in isolation. New dependency:serde_json1.0.154. -
mul build --strip-positions(row 3.13, ADR-018): builds an executable without the file path and the source line of its trap sites; a trap printserror[CODE]: message. It reuses the trap site table withTrapSites::default()(no frames beyond the line feed), so the default build is unchanged. Accepted bybuildonly. -
Guarded recursion in the typed program generator and the first libFuzzer sessions (row 3.12, ADR-015). A generated function with an
i32parameter may emitif pK > 0 { f(..., ((pK % 4) - 1), ...) { ... } }, wherepKis its firsti32parameter; inside that guard it may call itself again, always with the decreased measure, so recursion is at most four calls deep and ends in both backends before the call depth trap. The property testcrates/mul-cli/tests/typed.rsnow also requires that some recursive programs run to the same end in the interpreter and the JIT, and a new case pins the generated text of the guard.make fuzz FUZZ_TIME=540ran on nightly withcargo-fuzz0.13.2 (540 s per target; 20 000 proptest cases per property first):front_end6.2 M runs,parser4.8 M,mulb_reader82.8 M,typed_program167 k; no crash, so no regression case to add. -
Parameters and locals in the Code Graph (row 3.8, ADR-019):
mul_graph::KindhasParameterandLocal,Symbolascope(the declaring function's id),Referenceausage(Usage::{Call, Read, Write}); every name read and assignment target resolves to its declaration through the block scopes. Idssym:mul:<module>:<function>/parameter:<name>and.../local:<name>, with#<n>for the n-th declaration of a name in sibling blocks; each member has acontent_hashover its canonical declaration. Function ids and hashes and thesnapshot_id(mul-snapshot-v1, functions only) are unchanged. Newmul_graph::{member_id, content_hash}andGraph::members_of;calls_ofreturns calls only.mul inspectlists members after their function,--symbol main/local:tprints scope, declaration, origin, hash andreferences: [read@…, write@…], and a function's detail lists itsparametersandlocals..mulbCode Graph section 4 (optional-feature bit 2, RFC-012) with kinds, scopes and usages replaces section 3 in the writer; section 3 is still read, and section 4 wins when a file has both. Limit: 1 048 576 symbols in section 4. -
Source positions outside the interpreter and JIT (row 3.7, ADR-018). An executable from
mul buildreports a trap exactly asmul rundoes:file:line:column: error[CODE]: message [byte N], the source line and the^marker, or<source>: ... [byte N]for a.mulbwhose recorded source changed. The object carries a tablemul.rt.siteswith the pre-rendered head and tail of the diagnostic of every trap site (mul_backend_cranelift::TrapSites), and the Cmainwrites head, message and tail. A code generation error names the IR node it failed on, and the CLI prints its position under the internal compiler error (at file:line:column [byte N]), like a verifier error.mul_syntax::Span::frameandDiagnostic::render_in(rendering with or without the source text) are shared by the CLI and the executable. -
.mulbsections 2 and 3 (row 3.5, RFC-012): the source map (path, length and raw SHA-256 of the source, then the byte range of every function, block, instruction and terminator, with no counts: the shape comes from the IR section) and the Code Graph (module, symbols with name, kind, visibility, signature, effect, content hash and origin, references by symbol index;symbol_idandsnapshot_idare derived, the reader recomputes the snapshot).mul build --emit mulbwrites both as optional sections;mul_format::Mulbhassource_mapandgraphfields in place of the opaquesectionslist. A.mulbfile now gives the same positioned run-time errors as its source while the recorded source file is unchanged (otherwise<source>: error[CODE]: message [byte N]), andmul ir --source-mapandmul inspect [--symbol]work on it; a file without the section a command needs is reported by name. The file hash and thesnapshot_idstay separate (ADR-016).mul_graph::{symbol_id, snapshot_id}are public;SourceMap::dumptakes the source text as anOption. The.mulbfuzzing corpus includes both sections. -
mul inspect --file <file>.mulb(row 3.6): prints the header (schema version, feature masks, capabilities, content hash) and the section list (identifier, name, required flag, size) of a.mulbfile.mul_format::inspectshares the header and section walk withdecode(newheadermodule withHeader,Info,SectionInfo), so rejections carry the sameMUL-B0xxcodes; a non-.mulbpath is a usage error. -
Site without links into the private repository (row 3.11): the
link_rewritesandrepository_urlare gone fromsite/ssg.yaml;docs/language/names repository files (spec/grammar.ebnf, RFC numbers,llms.txt) as text, the theme drops the GitHub links, andCHANGELOG.mdis published at/changelog/(generated byscripts/site-content.sh). New docs testsite_does_not_link_the_private_repository(inmake check) fails on any link to the repository host in the site sources, andmake sitefails when the builttarget/site/public/contains one. -
Deeper fuzzing (row 3.9, ADR-015): a typed program generator (
crates/mul-cli/tests/common/typed.rs,typed_stmt.rs,typed_expr.rs) turns any byte string into a MUL program that passes sema by construction (types, scope without shadowing,var-only assignment, effects, returns and no unreachable code), with locals, assignments, calls,print, nested blocks,ifchains,whileloops with any condition and counted loops. The property testcrates/mul-cli/tests/typed.rs(256 cases inmake check) checks throughcommon/oracle.rsthat sema and the verifier accept each program, that a.mulbround trip keeps its IR, and that the interpreter and the Cranelift JIT agree on result, output and trap (with its instruction). Newmul_interp::run_fueledandFueled: the interpreter with a step budget, so a generatedwhile trueends inFueled::OutOfFuelinstead of hanging; the JIT runs only when the interpreter finished.mul runis unchanged and there is no new error code. New cargo-fuzz targettyped_program, which includes the generator and the oracle by path;make fuzzruns the typed property withFUZZ_CASESand the new target. 30 000 generated programs in release mode found no disagreement and no crash. libFuzzer did not run: no nightly toolchain orcargo-fuzzon the development machine (the four targets type-check on stable). -
Site after wave 3 (row 3.10): the blog post "Identity and persistence" (
site/blog/2026/identity-and-persistence.md, coverblog-identity.svg) on the Code Graph andmul inspect,.mulb, positioned run-time errors and fuzzing, with the open items; the "What comes next" list of the welcome post brought up to date; the home page pipeline step on the IR lowering says every IR node maps back to the MUL source. -
Docs test
language_links_are_published_by_the_site(inmake check): a link indocs/language/must be a sibling page or a../../repository path, the two forms the site resolves, so a link such as../adr/fails beforemake sitedoes. -
Fuzzing of the
.mulbreader (rows 3.2 and 3.3, ADR-015): the property testmulb_reader_is_total_on_bytes_and_corrupted_filesrunsmul_format::decodeon arbitrary bytes and on truncated and mutated.mulbfiles of every corpus program that compiles; cargo-fuzz targetmulb_reader, whose corpusmake fuzzseeds withmul build --emit mulb. -
Code Graph (row 3.1, ADR-014): new crate
mul-graphwith stablesymbol_id(sym:mul:<module>:<name>),content_hash(sha256:over a layout-independent canonical text of each function) andsnapshot_id(snap:+ 16 hex digits over all ids and hashes), plus definitions, references (call sites) and calls (Graph::build,find,calls_of,references_to).mul inspect <file>lists the snapshot and symbols;mul inspect --symbol <id> <file>prints one symbol. Compact, pretty and one-line layouts, comments and function order give the same ids, hashes and snapshot. New dependency:sha20.11.1. -
Fuzzing and round-trip property tests for the front end (row 3.3, ADR-015).
crates/mul-cli/tests/robust.rs(proptest, stable toolchain, part ofmake checkwith 256 cases per property) feeds lexer, parser, sema, lowering and verifier arbitrary bytes and text, every prefix of every corpus program and mutated programs, and checks on generated programs that compact → pretty → compact is lossless, layouts are idempotent,parse(format(p))equalsparse(p)apart from spans, and the verifier never rejects the IR of a program that type-checks; hostile inputs of 200 000 nested parentheses, unary operators, blocks,if/while, operator chains, calls, literals and names end in a diagnostic. No crash was found: the limitsMUL-S003andMUL-S004already bound every recursive phase. The harnesscrates/mul-cli/tests/common/robust.rstakes anyfn(&[u8]) -> Result<_, _>(reader_is_total), so the.mulbreader needs one small test file; a watchdog aborts on a hang.fuzz/is a standalone cargo-fuzz crate (targetsfront_end,parser, excluded from the workspace);make fuzzruns the property tests withFUZZ_CASESand, when a nightly toolchain andcargo-fuzzexist, the targets forFUZZ_TIMEseconds each from a corpus seeded withtests/andexamples/. -
The
.mulbbinary format (row 3.2, RFC-012, ADR-016), new cratemul-format. A 68-byte header (magic, schema version 1, flags, required and optional feature masks, capabilities, section count, body length, SHA-256 content hash over the header and body) and sections(identifier, flags, length, payload); section 1 is the IR module, 2 and 3 are reserved for the source map and the Code Graph (rows 3.4, 3.1). An unknown required feature or required section rejects the file (MUL-B004,MUL-B007); an unknown optional section is skipped. Size limits for file, sections, counts, names and strings; capabilities are recomputed from the IR and the IR passes the verifier on load. Saving is deterministic: save, load, save is byte-identical.mul_format::{encode, decode}:decodetakes any&[u8], never panics and is the entry point for fuzzing (row 3.3). Error codesMUL-B001..MUL-B009inerrors.md. -
mul build --emit mulb [-o <file>]writes the verified IR;check,ir,runandbuildaccept a.mulbpath in place of source. -
Source maps (row 3.4, ADR-017): every function, block, instruction and terminator of the IR has a byte range in the MUL Source, kept in a side table (
mul_ir::SourceMap:SourceFilewith path, length and SHA-256, and aSpanTableparallel to the module) filled bymul_ir::lower_with_spansfrom the checked program; IR equality and the IR dump do not depend on it. A run-time trap in the interpreter and in the Cranelift JIT now reportsfile:line:column: error[CODE]: message [byte N], the source line and a^marker at the operation that trapped (the same one in both backends, also in a file written on one line, and inside a called function); the JIT records the trap site in itsoutslot,ExecError::Trapcarries theIrNode. A verifier error (exit code 3) names the source position of its IR node.mul ir --source-map <file>prints the map.mul_verifier::VerifyErrorhas anatfield;mul_ir::Module::inst_nodesnumbers the instructions. -
mul_syntax::Span::position(line and column of a byte range), shared by diagnostics and the source map. -
Design document chapter 23, both editions (row 2.20): compact MUL as a third variant. The counts table has a compact column; a new section "Second layout: compact MUL" with a table and a plot of the ratios to compact MUL; the break-even table and plot show pretty and compact MUL side by side, and the prose is reread for the larger guide (
o200k_base: 2172 tokens). With compact MUL the guide is recovered against Go, PHP and C (about 8700, 8000 and 6300 tokens of code); the chapter states that this is a gain of the layout against the other languages as written, not of the syntax, and that correctness in the compact layout is row 7.3. The estimator section describes the glue rule and its error on compact MUL; threats to validity and conclusions have a layout item. Listings stay pretty (ADR-013).measure.pywrites the new parts (cvol,cprogs,\tsRowsCompactRatios,\tsPlotCompactRatios, the extra columns and the fifth argument of\tsPlotBreakEven); the numbers already published do not change. -
Token study in both layouts (row 2.19):
research/token-sample/measure.pycounts every MUL program in the pretty layout (throughmul fmt --pretty --stdout, the layout the published numbers use) and in the stored compact one;results.csvhas alayoutcolumn (pretty,compact,as written),summary.jsonacompactpart andgenerated.texnew macros (ctotal,csave,cagg,cgm,ctlo,cthi,cest.*) for the comparison with compact MUL. The BPE counts of the sources are unchanged; the guide is larger since row 2.16, so its cost and the break-even volumes in chapter 23 moved (o200k_base: 2069 → 2172 tokens). -
Site: comparison pages from the committed evidence (row 2.18).
scripts/site-content.shreads the IR, the run output in every language and the token tables fromexamples/compare/evidence/<name>/instead of running the programs again, and shows thecl100k_baseando200k_basetables next to the estimator table with one sentence on why they differ.make site-content(and somake site) runsmake evidence-checkfirst. -
Site: pretty view of compact MUL in the browser (row 2.17).
site/theme/mul/js/layout.jslays out everymulcode block holding a whole module for reading, with a Compact/Pretty switch per block; Copy always copies the compact layout. Example pages show the stored compact source once instead of two server-side copies.make site-layout(part ofmake site, needs Node.js) runsscripts/site-layout.test.mjs: on every MUL file the script's pretty and compact layouts must equalmul fmt --prettyandmul fmt; the docs test also checks that the script lists every keyword. -
make venv: a project virtual environment in.venv/withtiktoken(research/token-sample/requirements.txt);make evidence,make evidence-checkandmake token-studyuse it when it exists. -
mul fmt [--pretty] [--check | --stdout] <file>...and RFC-011, the layout of MUL Source (row 2.16, ADR-013). The compact layout is canonical and the default: a space only between two word tokens (keywords, names, numbers), a line feed only after a comment, nothing else.--prettywrites the layout for people (one statement per line, four-space indentation, spaces around operators, a blank line before every function). Both layouts keep every token and comment, and compact → pretty → compact is lossless. Only a program that parses is formatted;--checklists files out of layout and exits with 1,--stdoutprints instead of writing. The formatter ismul_syntax::formatwithLayout::{Compact, Pretty, OneLine}.spec/grammar.ebnfand RFC-011 state where whitespace is required and guarantee that no rule depends on a line feed. New tests (crates/mul-cli/tests/layout.rs): the round trip on every golden, conformance, example and reference source; every golden and conformance case run in the one-line layout in both backends;examples/andtests/must stay compact; the guide's blocks compact, the other reference pages pretty. -
ADR-013: the compact layout (no optional whitespace) is the canonical form of MUL Source, the pretty layout is produced on request; implementation is backlog row 2.16, the correctness risk is measured in row 7.3.
-
examples/compare/evidence/<name>/: committed evidence for every comparison program — the verified IR, the output and exit code in MUL (interpreter and Cranelift), Go, PHP, C and Rust, and token tables from the offline estimator and from thecl100k_baseando200k_basevocabularies.make evidencerewrites it,make evidence-checkfails when it is stale.research/token-sample/count.pyis the counter used throughmul tokens --tokenizer-cmd. -
Comparison pairs
isqrt(integer square root by bisection) andabundant(abundant numbers below 100, sum of proper divisors) in MUL, Go, PHP, C and Rust; both are on the benchmarks page and passmake compare. -
Design document v2.2 (both editions): signed by the author; chapter 23 "Pilot study: tokens of the source text" with tables, formulas, confidence intervals, an exact Wilcoxon test, linear approximations and three plots; a Declarations section (authorship, use of AI tools, data availability, conflict of interest). The chapter's numbers, table rows and plots come from
research/token-sample/generated.tex. -
research/token-sample/: measurement scriptmeasure.pywith a self-test, raw dataresults.csv, derivedsummary.json;make token-studyrepeats the measurement (tokenizers run locally: built-in estimator,cl100k_base,o200k_base, two local models). -
Five more comparison programs in
examples/compare/(fib,gcd,fizzbuzz,power,digits), checked bymake compare. -
Rust in the comparison pairs (row 2.12):
examples/compare/<name>.rsfor every pair, with the same output and exit code as the MUL program.make comparebuilds each one withrustc --edition 2021 -O(skipped whenrustcis missing),make tokensand the example pages add it to the--comparelist, and the benchmarks page has a Rust column and a fifth chart series in Google Pink (#d01884light,#e52592dark), checked for colour-vision deficiency together with the other four. -
Documentation site (row 2.11) built with spagu/ssg:
make sitewrites a static directory totarget/site/public/,make site-serveserves it on port 8888 and rebuilds on changes. The language reference isdocs/language/read in place; the examples gallery (source, verified IR, run output, token tables), the landing page's Hello world, four feature snippets fromsite/snippets/and the benchmarks page with its bar chart are generated at build time by runningmul(scripts/site-content.sh,site-data.sh,site-benchmarks.sh). Also a blog (site/blog/, Atom feed, first post "Welcome to MUL") and a papers page publishing the PDFs frommake paper. Own themesite/theme/mul/: IBM Plex Sans and Mono self-hosted, Google palette, light and dark schemes at WCAG 2.2 AA contrast, drawn SVG illustrations, Open Graph and Twitter meta tags on every page, Google Tag Manager wired with the placeholderGTM-XXXXXXX. The build fails on dead internal links, missing titles or descriptions, and reference pages missing from the sidebar. -
docs/language/highlighting.md: token classes for colouringmulsource andmul iroutput; the site's highlighter (site/theme/mul/js/highlight.js) implements it, and a documentation test checks that both list every keyword of the lexer. -
ADR-012: the site is a host-agnostic static directory; the domain is not chosen yet (
SITE_DOMAIN, placeholdermul.example). -
docs/site-style.md: palette, contrast ratios, syntax and chart colours, type and images of the site.
Changed
-
mul_adapter::Snapshothas the fieldid(a string) instead ofpayload, andClient::ingest(root, sink)takes the sink that imports the parts (row 4.14);Snapshot::id()is gone.AdapterError::Factscarries the importer's rejection of a part. -
mul_ir::ExecError::Codegenis{ message, at: Option<IrNode> }with the constructorExecError::codegenandExecError::at(row 3.7);mul_backend_cranelift::{build_executable, emit_object}take&TrapSites(TrapSites::default()keeps the olderror[CODE]: messageoutput).mul buildexecutables of programs without a source map name the file given, asmul rundoes. -
research/token-sample/measure.py(over 600 lines) split into modules with one job each (row 2.21):stats.py(statistics and the self-test),measurement.py(sample, tokenizers, counting,results.csv),summary.py(summary.json),latex.py,macros.pyandplots.py(generated.tex).measure.pystays the entry point with the same options;make token-studywrites byte-identicalresults.csv,summary.jsonandgenerated.tex. -
mul tokensestimator refitted on both MUL layouts (row 2.19): one new rule, a(.:#or{that ends a punctuation run right before a word merges into it, as BPE vocabularies make(nor{returnone piece. On the study's compact MUL files the bias againsto200k_basefalls from +12.8% to +0.9% (mean error 2.5%); over all 40 study files the mean error is under 4%. The calibration test covers both layouts with tighter bounds (mean error < 5%, bias < 3%, every language and layout total within 5%, same order as the real vocabularies). The evidence token tables, the blog post and the docs follow the new counts. -
Site on ssg 1.9.13 (row 2.13, spagu/ssg#438, #439, #440 fixed): the Makefile passes
--domain=$(SITE_DOMAIN)instead of writing asedcopy ofsite/ssg.yaml;pretty_htmlis on again and the<pre>blocks come out byte for byte as without it (184 blocks compared);description:is a top-level key and the templates read.Description, sovariables.descriptionis gone. -
examples/,examples/compare/andtests/are in the compact layout, rewritten bymul fmt(the nine golden cases with a deliberate syntax error stay as they were). The committed evidence follows: on the ten comparison programs MUL counts 836o200k_basetokens (pretty: 1186, −29.5%) against 1111 for Rust, 1141 for Go, 1169 for PHP and 1295 for C; the IR and run outputs did not change. -
The compact guide (
mul guide,docs/language/guide.md) andllms.txtuse the compact layout and explain it; the reference pages keep the pretty layout andsyntax.mdhas a Layout section with both. Example pages of the site show each program in both layouts, and the landing page's Hello world in the pretty one. -
Compile-time diagnostics end the first line with the byte offset,
file:line:column: error[CODE]: message [byte N], so an error in a one-line file can be located; a source line longer than 100 characters is shown as 40 characters on each side of the error, with...where it is cut. -
mul tokensreports which layout it counted: alayoutcolumn in the table and a"layout"field per file in the JSON (compact,prettyoras written); existing fields are unchanged. The estimator calibration test estimates the MUL programs in the pretty layout, the one the pilot study counted. -
Design document v2.3 (both editions), chapter 23: the study was rerun with the recalibrated
mul tokensestimator (only the estimator columns ofresearch/token-sample/changed). The section on the estimator's accuracy now gives the numbers before and after (mean error againsto200k_base13.3% → 4.6%, same language order as the BPE vocabularies) and its limits: the shortest files, thegemma3:12btokenizer, and the fact that the error is measured in-sample. A new threat to validity covers that, and the conclusion no longer says the estimator needs improvement. -
mul tokensestimator recalibrated on the pilot token study (row 2.14). New per-class rules: punctuation and operator runs cost one token per 3 characters (the fixed list of two-character operators is gone), word parts one per 5 characters, a line break is free right after punctuation, indentation is a token of its own (with tabs, one per tab after the first). Againsto200k_base/cl100k_baseon the 32 study files the mean error falls from 14.7% to 4.6%, the bias from +14.3% to +3.6%, and the languages now come out in the same order as with the real vocabularies (before, Go looked longer than MUL). A test pins these bounds toresearch/token-sample/results.csv. The table prints anote:line under the tokenizer name, and the JSON report has a new"estimated"field (truefor the estimator,falsefor--tokenizer-cmd); existing fields are unchanged. The evidence token tables, the benchmarks page and the blog post's numbers follow the new counts. -
Example pages of the site print the Go, PHP, C and Rust versions of each comparison pair on the page instead of linking to the files on GitHub, and the gallery index no longer links into the repository: it stays private until the production release, so those links were dead for readers.
-
docs/language/README.mdhas front matter (title,slug: reference, description) so the site publishes it at/reference/. -
Text published on the site no longer points to internal planning documents: backlog row numbers and the
§reference are gone fromdocs/language/(README.md,not-in-mul.md,effects.md) and from the comment inexamples/effects.mul, and the benchmarks and papers pages no longer cite the ADR or the backlog.
Fixed
- Ingest spool file no longer survives a killed core (row 4.290, ADR-023 amendment): on Unix
mul_adapterunlinks themul-ingest-*.spoolfile right after creating it and keeps using the open handle, so a SIGKILL or crash leaves nothing in the temporary directory; other platforms keep the remove-on-drop. Tests: no entry while the spool is in use, and a child process killed with SIGKILL leaves the directory empty.Snapshot::idis unchanged. - Go adapter facts no longer depend on the state of the Go build cache (row 4.90, Go adapter 0.12.1, RFC-013): the Go tool caches the output of cgo by content, and its
//linedirectives name the source by the path of the run that filled the cache, which can be the directory behind a symbolic link of the project root (the Go tool treecmdread through/snap/go/currentgave 62 symbols, 61 references and 34 literals fewer, and 24 more diagnostics, when the cache came from the resolved path). The adapter now takes a path with either spelling of the root, the given one or with links resolved, as a project file. No schema change; the facts ofgolang.org/x/toolswere the same in ten runs before and after, so the intermittent difference seen there in row 4.14 is not explained by this (see row 4.190). - Flaky
mul-adaptertest:starts_a_program_of_a_relative_frontends_directoryexecuted a just-written script directly, so aforkin a concurrent test thread (which holds the write descriptor until itsexec) made the exec fail with "Text file busy" (3 failures in 300 runs of the crate). The test now runs a symlink to the system shell, and no test helper marks a script executable any more: adapter scripts are only run assh ./a.sh(row 4.16). - A relative
--frontendsdirectory (row 4.2): the program of an adapter'scommandcontaining/was resolved against the adapter's directory a second time and was not found; it is now made absolute before the process starts (row 4.1 only ran adapters from absolute paths).mul adapter check --project <dir>passes the adapter an absolute, canonical path, asmul ingestdoes; a relative<dir>was refused by the adapter. - The range of a binary or unary expression that starts or ends with a parenthesised operand now covers the parentheses:
-(1 + 2)was reported as-(1 + 2, and(a - b) / (c - d)started after its first(. scripts/site-benchmarks.shread the token table by column position and failed with a division by zero sincemul tokensprints thelayoutcolumn; it now reads the fields from the end of each row.
Removed
MUL_Pelna_Specyfikacja_Rust_Cranelift_LLVM.docx: the design document is nowMUL_Rozprawa_Naukowa.tex(v2.1), which contains the spec and keeps its chapter numbering.
Added
- English edition of the design document v2.1,
MUL_Design_Paper_EN.tex(row 2.10), with the same chapter and section numbering and the same\labelkeys as the Polish originalMUL_Rozprawa_Naukowa.tex, so the§references inBACKLOG.mdare valid in both.make paperbuilds both PDFs intotarget/paper/withlualatexand first names any missing TeX package or font. MUL_Rozprawa_Naukowa.texv2.1: implementation status chapter; sections on objects without inheritance, the AI language reference, language adapters as modules, foreign-language OOP in the Code Graph, version tagging andmul tokens; fixed tables, code blocks and links left by the docx conversion.BACKLOG.md: finished rows are kept and marked<strong>DONE</strong>; new rows for language adapters as modules (version ranges, scaffold, new-release process), language and dependency version tagging, Python and Pascal adapters, syntax-density and session-handle experiments, docs site and browser demo; wave 13 (standard library and self-hosting).
Changed
-
The expectation header of golden and documentation tests accepts
// expect:lines before// expect-error:: what the program prints before it traps. A trap case without them must now print nothing (strings_print_trap.mulstates its line). The header parser moved from the test helpers intomul_cli::expect, shared by the harness andmul test. -
Breaking: the value returned by
mainis now the process exit code, as in C, Go or Rust (RFC-010):mul runand executables built bymul buildexit with its low 8 bits and print nothing for it. The new flag--print-result(onrunandbuild) restores the previous behaviour: print the value on the last line and exit with 0. -
Backend::runtakes the writer for program output;mul_interp::runandbuild_executable/emit_objecttake the new arguments (out,MainResult). -
IR instructions carry
result: Option<(Value, Type)>, so an instruction may define no value (print). -
Golden and documentation examples may have several
// expect:lines (program output, then the value ofmain); the harness also checks the exit-code mode.
Added
-
mul tokens <file> [--compare <file>...] [--json] [--tokenizer-cmd <cmd>](row 2.9): token count of a source file in any language and, with--compare, a table (or JSON) with the absolute and percentage difference of each file to the first one. The default counter is an offline, deterministic estimate (mul_cli::tokens::Estimate); an exact counter runs only when given with--tokenizer-cmd(text on stdin, count on stdout), andmulsends no code anywhere by itself. README explains that the result is a tokenizer-dependent estimate. -
Comparison pairs
examples/compare/{hello,primes,collatz}.{mul,go,php,c}with the same output and exit code;make compare(scripts/compare.sh) checks that,make tokensprints the estimate of each pair, andmake demoshows one comparison. -
RFC-003, normative MVP semantics (row 2.8): 20 numbered rules
SEM-01..SEM-20for thei32range and literals, checked overflow, division and remainder (zero check before overflow,MIN % -1traps), evaluation order, short-circuit, traps (the first one in evaluation order wins, earlier output stays) and the absence of conversions. No behaviour changed; every rule was already implemented. -
Conformance suite
tests/conformance/: 38 cases, each naming its rule in a// rule: SEM-NNline; the golden harness runs them in the interpreter, the JIT and a native executable, and a test requires a case for every rule of RFC-003. -
mul test [<path>...]: runs every.mulfile with an expectation header under the given files and directories (default: the current directory) in the interpreter and the Cranelift JIT, requires the backends to agree and checks<name>.irsnapshots; printsok/FAILper file and a summary, exits 1 on a failure or when nothing ran.make conformanceruns it ontests/. -
stringandprint(RFC-010, row 2.7): string literals with\n,\t,\\,\"escapes (MUL-S006for an invalid one), the typestringfor parameters, results and variables, the built-iniofunctionprint(text)called as a statement, call statements whose value is discarded. New codesMUL-T014(printused as a value) andMUL-T015(==/!=on strings); a function namedprintisMUL-T001. IR:const.stringandprint; the verifier checks their types and effect (MUL-V010,MUL-V011). -
mul-runtimecrate: string values are 32-bit handles into the module's string table, its native layout, and the referenceprint. The interpreter and the JIT (a host function) use it; executables get a generatedprintthat callswrite(2), so they still need nothing else from libc. -
examples/hello.mulinmake demo; 14 golden cases for strings, call statements and exit codes, with IR snapshots. -
pureandioeffects (RFC-009, row 2.6): an optional effect after the return type,purewhen none is written; apurefunction cannot call anioone (MUL-T013). New keywordspureandio. The IR function carries its effect (printed only forio) and the verifier rejects apure→iocall (MUL-V011). Four golden cases with an IR snapshot,examples/effects.mulinmake demo, language reference and guide. -
Verifier type checking of the IR (RFC-008, row 2.5a): instruction result and operand types, ordering comparisons on
i32only, call argument and result types,boolbranch conditions, block argument types and the returned value; new codeMUL-V010. -
MUL specification v1.0 (proposal) in docx format.
-
BACKLOG.md: session plan in 13 waves (0–12), from MVP-0 to additional languages. -
README.md: project description, status, quick start, structure, and badges. -
Cargo workspace (Rust 1.100, edition 2024) with the crates
mul-cli,mul-syntax,mul-sema,mul-ir,mul-verifier,mul-interp. -
mulbinary with--versionand--help; an unknown command exits with code 2. -
Makefile(build, run, fmt, clippy, test, coverage ≥98%, audit, check),.gitignore,rust-toolchain.toml. -
MVP-0 of the language (RFC-001):
module, functions without parameters,return, thei32type,+ - * / %, unary minus, parentheses,//comments. -
mul-syntax: lexer and parser with byte ranges,file:line:columndiagnostics with a^marker, limit of 256 operations per expression (MUL-S003). -
mul-sema: type resolution, literal range,-2147483648asi32::MIN, requiredreturn, unreachable code, duplicate functions. -
mul-ir: typed SSA IR with one block per function, left-to-right lowering, deterministic text dump. -
mul-verifier: unique functions and values, definition before use. -
mul-interp: reference interpreter with checked arithmetic (overflow, division by zero). -
CLI:
mul check,mul ir,mul run; exit codes 1 (program error) and 3 (compiler error). -
spec/rfc-001-mvp0.md,docs/adr/ADR-001..011, thetests/golden/format with 20 cases and an IR snapshot. -
make demo: the pipeline on the examples inexamples/. -
mul-backend-cranelift(Cranelift 0.138): IR lowering with checked arithmetic without CPU signals, JIT and an object file withmainin the C ABI. -
Backendtrait andRuntimeErrorinmul-ir::exec; the interpreter and Cranelift implement the same contract. -
CLI:
mul run --backend interp|craneliftandmul build [--target native] [-o <output>](linker from$CC, defaultcc). -
Differential tests: every golden case goes through the interpreter, the JIT, and the executable.
-
Function parameters and calls, including recursion (RFC-002, row 2.2):
fn f(a: i32, b: i32),f(x, y), calls to functions defined later in the file. -
Diagnostics
MUL-T006..T009(duplicate parameter, unknown name, unknown function, wrong argument count),MUL-V004/V005(call checks in the verifier),MUL-R005(call depth limit of 10 000, the same in every backend) andMUL-R006(entry function with parameters). -
IR: parameters as
%0..%n-1, thecall.i32 @f(...)instruction;Module::entrypicks the entry function for every backend. -
10 new golden cases with an IR snapshot for calls;
examples/calls.mulinmake demo. -
Language reference for AI (row 2.1):
spec/grammar.ebnf(ISO EBNF matching the parser),docs/language/(syntax, types, effects, errors with everyMUL-*code and a typical fix, idioms, what MUL does not have), the compactdocs/language/guide.mdprinted by the newmul guidecommand, andllms.txt. -
crates/mul-cli/tests/docs.rs: everymulblock indocs/language/passesmul checkandmul run(interpreter and Cranelift) with the stated result; every grammar rule names existing golden cases; grammar terminals equal the lexer's keywords and punctuation; everyMUL-*code in the compiler is documented; links inllms.txtand the reference resolve. -
Golden case
module_path.mul(dotted module name). -
mul_syntax::fixed_spellings(): keywords and punctuation of the lexer, for the grammar consistency test. -
Local variables and block scopes (RFC-005, row 2.3):
let x = eandvar x = ewith an optional: i32, assignmentx = eto avar, nested blocks{ ... }; areturnmay end a nested block. No shadowing: a visible name cannot be declared again. -
Diagnostics
MUL-S004(blocks nested deeper than 64 levels),MUL-T010(name already defined, no shadowing),MUL-T011(assignment to aletor a parameter). -
11 golden cases for variables and blocks with an IR snapshot;
examples/locals.mulinmake demo. -
Conditions (RFC-006, row 2.4): the
booltype withtrue/false, comparisons== != < <= > >=, short-circuit&&/||,!, andif/else if/elsestatements; areturnmay appear on any path, and recursion can stop. -
Type checking of operands, initializers, assignments, arguments, returns and conditions:
MUL-T012(type mismatch); chained comparisons areMUL-S005. -
IR: several basic blocks per function with block parameters, terminators
jumpandbranch, instructionsconst.bool,not.booland comparisonseq ne lt le gt ge; variables assigned on several paths are merged through merge-block parameters;Function::reverse_postorder. -
Verifier: SSA dominance (
MUL-V002), unknown jump targets (MUL-V006), block argument count (MUL-V007), entry block (MUL-V008), unreachable blocks (MUL-V009). -
13 golden cases for conditions with two IR snapshots;
examples/conditions.mulinmake demo. -
whileloops (RFC-007, row 2.5):while cond { ... }tests aboolcondition before every iteration; the body is a fresh block scope each time and mayreturn. A loop never terminates a path, so areturnfollows it (MUL-T004). -
IR: a loop header block takes as parameters the variables its body assigns; the entry jump and the back edge pass their values. No new instructions, terminators or diagnostic codes.
-
8 golden cases for loops with two IR snapshots;
examples/loops.mulinmake demo; interpreter/Cranelift differential test for loops.
Changed
-
Interpreter keeps call frames on the heap, so deep MUL recursion never overflows the Rust stack.
-
Native calling convention:
fn(out, budget, args...) -> status; status 8 meansMUL-R005(supersedes the RFC-001 section Native code). -
Planned RFCs renumbered: normative semantics is RFC-003, memory model RFC-004.
-
Golden and documentation tests share one helper module (
crates/mul-cli/tests/common). -
HIR: a function body is a list of slot assignments plus the returned expression;
Expr::ParambecameExpr::Local(parameters are the first slots). Lowering maps variables to SSA values, so the IR format, verifier and backends are unchanged. -
MUL-T004,MUL-T005andMUL-T007apply to nested blocks and variables; the parser reportsexpected statementinstead ofexpected `return`. -
IR dump: every block is printed with its label (
b0:), also in single-block functions; the IR snapshots were updated. -
HIR: a function body is a list of statements (
Assign,If,Return); calls carry the callee's return type, comparisons their operand type. -
MUL-R006covers any entry signature other thanfn() -> i32(RuntimeError::EntryParamsbecameEntrySignature);MUL-T002acceptsi32andbool;MUL-T004reads "must end withreturnon every path". -
In native code and the interpreter a
boolis ani32holding0or1, so the calling convention is unchanged. -
Project language switched to English (docs, code comments, diagnostics, CLI help).
-
No GitHub Actions: the quality gate is the local
make check; the CI task was removed from the backlog.
This page is docs/language/ in the repository, published as it is. Every mul code block on it is compiled and run by the test suite.