Maylang 0.15.1 — Fern
Released 2026-11-14 UTC. A patch release that prepares the repository for public access and removes Any from the library and the tools. The legacy maypkg package manager is gone; projects use may workspaces. Strict typing narrows Optional<T> after a nil check and lets a closure inside a generic function name its type parameters, and the language gains hexadecimal, octal and binary integer literals with digit separators. Generated code gets faster again: a top-level main and Float loop bodies compile to native words, records are built into fixed slots, enum payload reads and map probes skip runtime calls, and a bounded collection threshold cuts the collector's pause and peak footprint. Doc comments are now the single source of the API reference, and the repository gains an MIT license and a security policy.
Repository
Prepared the repository for public access. The unmaintained
frozen/tree (other targets, NodeOS, the core runtime, maybrowser, mayos,stdlib/mland archived examples) was removed frommain; its last version is thefrozen-archivetag. Also removed: the dated repository audit,docs/history/, the stale compliance snapshots, a duplicate.github/CONTRIBUTE.mdand a scratch example.maycnow saystarget … is not supportedinstead ofis frozen, and the language server no longer skips directories namedfrozen.Removed the legacy
maypkgpackage manager and everymayproj.json. Projects usemayworkspaces;may migratestill converts an oldermayproj.json. The example projects that usedmaypkg(starfall, kaindsim, rivet, sdl_test and the learning projects) now havemay.jsonmanifests, and kaindsim's and rivet's Makefiles compile withmaycdirectly. Release bundles and installers no longer shipmaypkg; saved component lists and--componentsvalues that name it are ignored, so older installations still upgrade.Added a security policy with private vulnerability reporting, an experimental-status note in the README, and a roadmap rebuilt from the open issues.
Language
Strict typing narrows
Optional<T>toTafter anilcheck: insideif (x != nil), in the else-branch ofif (x == nil), on the right ofx != nil and ..., and for the rest of a block after anif (x == nil) { return ...; }guard. Only names their module never assigns narrow (strict guide).Strict typing for generics: a closure inside a generic function can name the enclosing function's type parameters (
compose<A, B, C>can returnfun(x: A) -> C), and a type parameter no argument determines becomesNeverat the call, solet xs: List<Int> = stack();is accepted.reverseof aStris typedStr, as the runtime returns, instead ofList<Str>(strict guide).The standard library uses concrete and generic types instead of
Any:algo,iter,functional,collections,stats,random,csv,format,string,path,math,test,io,net,validateand the prelude.Anyremains only at dynamic boundaries, each commented: JSON, validators that inspect runtime types, mixed-type[a, b]pairs, and the Int-or-Float helperssquare,cube,averageandmedian. Breaking: callers holdingAnyvalues must use the real types; stacks areList<T>, queuesList<List<T>>and setsMap<T, Bool>;stats_*results that can be undefined areOptional<Float>andstats_linear_regressionreturns aRegressionstruct;random_newreturns aRandomstruct;validate_alltakesValidationRules and returns aValidation(contracts).The examples use concrete types:
Anydropped from 348 to 26 uses, all commented dynamic boundaries (JSON documents, the ledger's untrusted input stream,extern_ccallables). market, game, ledger, features, maytasks, starfall and kaindsim model their data with structs; their output and exported files are unchanged. maytasks now skips malformed saved tasks instead of listing them asnil, and starfall starts a fresh flight from a truncated save file instead of failing with a type fault.uniqueis typed as returning its list element type.mayand the shared tool modules use concrete types:may.jsonis validated as JSON as before, then decoded intoTargetSpec,Profile,DependencyandConfigstructs, and builds returnArtifacts. Because a target's cache identity includes its serialized spec, existing.may/caches rebuild once.tools/shared/imports.maykeeps only the import scannermayuses; its graph traversal and brace checker were dead code after themaypkgremoval. An empty[]or{}now joins with a typed collection (xs ?? []).maylspuses concrete types: indexed documents areDocstructs holdingToken,Scope,DefandImportvalues, ranges and positions areRange/Position, and queued navigation and workspace requests and diagnostic waiters are structs instead of string-keyed maps. Lookups returnOptional<Def>/Optional<Doc>and rely onnilnarrowing.Anyremains at the JSON-RPC boundary — parsed messages, replies and the diagnostic caches, which a forked worker serializes and the parent stores as a parsed snapshot. Behavior and protocol output are unchanged.Hexadecimal
0xff, octal0o755and binary0b1010integer literals, and_digit separators in every numeric literal (1_000_000,0xffff_ffff,6.022_140e2_3). Prefixes are lowercase; each_must sit between two digits; every radix has the signed 64-bit range, with the minimum reached through unary minus. Invalid digits, misplaced separators, uppercase prefixes and radix fractions are lexer errors.1_000was documented before but did not compile. The formatter keeps a hexadecimalEfrom reading as an exponent, the VS Code grammar highlights the new forms, and the Rust bootstrap lexer accepts them too. String conversions (int,float) still read decimal only.Behavior contracts admit the numeric conversions and rounding primitives:
to_float,float,int,trunc,floor,ceil,round,sqrtandabshave empty effect rows when the checker can establish that their single argument is anIntorFloat. Other arguments, includingBool, fail closed.int,truncandabscan still raise catchablearithmeticfaults, as/can (docs).Behavior contracts admit the scalar mathematics:
sin,cos,tan,ln,log2,log10,exp,powand**with aFloatoperand onIntorFloatarguments,min/maxon two arguments of the same type, andboolonInt,FloatorBool.Int ** Intand mixedmin/maxstay unknown (docs). Strict typing now typespowas returningFloatinstead ofAny.
Tooling
maychas a command surface instead of flags only:mayc run <source> [-- ARGS...]compiles to a private temporary executable in$TMPDIR/mayc-run-<pid>/, forwards the arguments after--unchanged and exits with the program's status (removing the temporary directory unless-onames a path);mayc check <source>andmayc build <source>are subcommand forms of--checkand the default. Diagnostics keep their source excerpt and caret span but now carry a stableerror[E_STAGE]code and honor--color auto|always|never/--no-color(autouses a terminal's stderr unlessNO_COLORis set).-O0/-O1/-O2select the optional backend passes and the inliner, and--deps FILEwrites a Make-style dependency file naming the produced binary, every expanded import, the compiler and the runtime sidecars that were read.--helpdocuments the commands and options (compiler guide, toolchain reference).maygained a scriptable command surface:may list [--json]describes targets, defaults and prerequisites,may which [TARGET] [--build] [--json]prints the artifact path a target would use without compiling (exit 1 until it exists),may test --listandmay test --filter PATTERNnarrow the discovered.test.mayfiles, andmay version/may doctorreport toolchain identity and dependency-lock state as text or JSON. Global-C DIR,-qand-vwork before or after the command (everything after--still belongs to the program), and verbose builds print the exact compiler/recipe command and per-target time (workspace runner).
Performance
Language-server call hierarchy and navigation replies (measurements):
callHierarchy/incomingCallsnow streams through the navigation worker's 32-file batches like references, instead of loading the whole workspace into the worker, and the parent forwards worker results without parsing and re-encoding them. On 3,000 files with 4 callers each, incoming calls drop from 11.71 s and 560 MiB peak to 2.47 s and 188 MiB, and references from 3.06 s to 1.93 s.benchmark_call_hierarchy.pyreproduces the measurements, and a new test checks incoming calls across batch boundaries.Native Float loop bodies and a native Float main (reports: loops, main, follow-up): a Float function that contains a loop now compiles as native-word code. Declared Float locals get pre-planned XMM8-15 homes that survive iterations and are spilled/reloaded around calls, operations coalesce into their dead left operand,
>/>=fuse intoucomisdplus one branch, and a call-free body keeps the raw backend's Int local registers and fusions; an escaped Float function is demoted to the tagged ABI so dynamic calls keep the tagged fault rules. The Float loop microbenchmark drops 82.6% and the cross-language Mandelbrot is unchanged as a control. A top-level body whose values are all Int/Bool/Float words now also compiles as a native-word main, which makes the cross-language top-level Mandelbrot native: 45.0 to 42.1 ms (1.4x to 1.2x the C build), with the tagged main kept as the fallback and Float boxed as fat type 3 only atprint. Multi-argumentprintarguments are reified into frame slots first, because its boxing helpers are several runtime calls behind one IR call site (that clobber was found and fixed before merging).--no-optstill keeps all of it tagged, andnative_float_loops.may,main_native_floats.may, the oracle suite andbackends.pyobjdump assertions cover the boundaries. Still tagged:int(Float), thesqrt/rounding/min-max family, extern Float signatures and Float globals (status).Collector pause and the default threshold policy (report): the post-sweep threshold is bounded at the allocation frontier instead of the frontier plus the margin, removing the frontier creep that raised the heap by 8 MiB per collection; the mark drain traces sealed-record payloads exactly (the key slots are image strings) and the 1 MiB global-root address table is a byte-kind block the collector never scans, which removes 95% of the conservative mark probes. On binary trees depth 16: CPU 0.9138 to 0.8345 s (-8.7%), peak RSS 236 to 146 MiB (-38%), collections 11 to 16, total pause 352 to 248 ms; the other seven roadmap workloads do not collect at the default floor and are unchanged within the layout spread (worst case sieve +1.2% over 30 pairs, +0.6% over 100), and the compiler self-compile is 5.0% faster at the same peak RSS. The measured negatives (skipping record zeroing, a sweep table-clear restructure) are in the report.
Allocating-safepoint inventory for precise stack maps (report):
mayc --stack-map-inventory <src>prints the call sites that can start a collection while the caller's frames are live, as one JSON object, and exits; the normal path never runs the analysis and compiler images are byte-identical with and without it. The inventory computes the "can reachrt_alloc_kind" fixpoint over fat and raw call graphs, treats indirect calls and unresolved runtime names as allocating, and splits sites by call kind and frame shape. The compiler image has 8,086 fat-frame safepoints, which at the design's 2-bit-per-slot bound is about 40 KiB (1.35% of the code) rather than the 1.14 MiB (38%) an all-call-site scan implied, so map size is not the binding constraint; descriptor encoding, liveness precision and the collector switch remain open.tests/stack_maps.pypins the JSON contract.Opt-in inliner (report):
--inline(default off) clones only small, straight-line, effect-free accessor and one-expression-helper bodies into their call sites, declining anything else. An accessor measures -39.2% and a one-expression helper -73.0% in the inlining microbenchmarks (25/25 rounds each); the default build and every suite program are byte-identical, and the oracle suite now also compiles every behaviour fixture with--inlineand requires identical output. The flag is skipped under--no-opt,--rawand--debug.Phase 4 measurements (escape analysis, code alignment): a caller-side escape analysis of constructor calls reports zero non-escaping sites on every roadmap benchmark and on the compiler, because a constructor is a generated function that returns the record; the scalar replacement it enables is -98.4% on a hand-written microbenchmark but flat on n-body, trees and self-compile with byte-identical images, so the rewrite was reverted and the analysis kept as the decision set. Porting the raw backend's 16-byte body and loop-head alignment to fat code was measured negative in both a combined and a loop-only variant (consistent small regressions on sieve/hashmap/ strings, no consistent win) and reverted; the report keeps the numbers and the
--no-code-alignscope proof. Neither changes the default compiler.Inline map probing for Float and Bool keys (report): the probe's key types now match the runtime's: Float keys hash with
rt_hash_mixand the-0.0fold and compare withrt_same's IEEE equality (-0.0equals+0.0, NaN equals nothing), and Bool keys use the folded payload hash and payload equality. The fallback set is unchanged (non-map receivers, dynamic values, sub-threshold maps, growth, faults,--no-opt). A Float+Bool-key map workload drops from 258.8 to 126.1 ms (-51.3%); the Str-key probe and hashmap controls compile to byte-identical binaries and do not move, so existing workloads are unchanged.tests/map_probe_keys.mayand the oracle test cover the semantics.GC floor and margin overrides (report):
MAYC_GC_MINandMAYC_GC_MARGIN(decimal bytes) replace the collection floor and margin derived from the nominal heap, so the threshold policy can be tuned per run without rebuilding the runtime. Defaults are unchanged when the variables are unset or invalid, and the accepted range keeps a typo from disabling collection. UnderMAYC_GC_MIN=8388608 MAYC_GC_MARGIN=524288binary trees drops from 234 MiB to 95 MiB peak RSS at 1.75x the run time and 60 instead of 11 collections, hashmap drops 30% and strings 37% while six of the eight roadmap workloads do not collect at the default heap and are unchanged. The overrides are read by the existing start-up statistics probe, so default programs keep their previous code layout: paired pinned runs of the previous and current runtime show fib within noise and no workload regressing by more than 2%. The report records the interleaved measurements, the separate effects of the floor and the margin, the frontier-creep traces, the layout audit and the tested invariants.Main as native (report): when every top-level binding was demoted to a main local and every value and operation is an
Int,BoolorPtrmachine word, main's statements compile to native-word code instead of tagged code. Words are the fat payloads themselves, so the only boundary isprint, which boxes its arguments and calls the runtime. The collatz top-level loop drops from 94.75 to 47.48 ms (−49.9%) on the cross-language suite; fib's native main is inside the spread because its work is one call, and the suites that use Float, strings, lists, maps, structs or closures keep the tagged main unchanged.--no-opt,--raw, the tagged fallback andtests/main_native_words.may(with the tagged-fallback companiontests/main_native.may) plus the oracle test cover the boundaries, andbackends.pyasserts the native path is taken: its image differs from the tagged build and carries the immediate-typedprintboxing sequence.Enum payload reads in
match(report): a variant pattern proves the tag, so the tag and its payload bindings are read by guarded fixed slot instead of onert_map_getcall per arm; the runtime probe stays forAny/grown/foreign values andResultpatterns. A recursive-enum evaluator drops from 7007 to 1369 ms (5.1x) and a match loop from 610 to 164 ms (3.7x), with identical output; both paths are off under--no-opt,enum_payloads.mayis pinned in the oracle suite, and an objdump assertion covers the generated code. Refs #134.Inline fixed-slot record construction (report): a struct or enum constructor's
rt_struct_newheader writes and itsrt_struct_setslot writes are emitted as one generated block when the record size is a compile-time constant, while the allocation itself stays a runtime call. The heap layout is unchanged (kind-4 record block, entries atp + 48),MAYC_GC_STATScounters are identical on every workload, and--no-optkeeps the runtime calls. Binary trees drop from 975 to 803 ms of CPU (-17.7%), 2M constructions from 93 to 72 ms (-22.9%) and the record-churn workload by 20-27%; n-body and the field-read controls are unchanged. The compiler's own self-compile is 0-6% slower depending on the method and peaks up to ~2% higher, a conservative-retention effect of building the compiler with the change.tests/record_construct.mayand the oracle test cover the paths.Native Float functions (report): a straight-line function whose parameters, result, locals and operations are
Int,Float,PtrorBoolnow compiles to native-word machine code. A Float is its binary64 bit pattern in a word, so the word call ABI, fat entry and word adapters are unchanged; inside the function XMM8-15 hold the Float locals and XMM2-7 the Float temporaries, and+ - * /and the six comparisons run as SSE with the runtime's division-fault and NaN rules. Call-bound Float helpers are 3-53% faster (26-53% for expressions wider than one multiply), includingto_float, which was a runtime call. A Float body that contains a loop stays tagged, so the cross-language Mandelbrot and n-body numbers are unchanged; the compiler image grows 2.4%, and this commit alone costs about 10% compiler self-compile (absorbed on the branch, where the net self-compile is faster than before).tests/native_floats.mayand the oracle test cover the semantics.Value propagation, dead code and block-local CSE before the fat backend (report):
src/ir_opt.maypropagates copies, eliminates repeated field and element reads in a straight-line region with alias-aware invalidation, removes dead definitions, stores, overwritten copies and unnamed labels, and trims the emitted frame. n-body drops from 113.6 to 94.8 ms (-16.5%) on the pre-phase-2 base, the compiler's own image shrinks 7.7% and its self-compile is 1.8% faster; the other workloads are inside the spread. Functions with an exception region keep the old path, and--no-optskips the module;tests/ir_opt.mayand the oracle test cover it.Inline map probing and the
??fast path (report):m[k]with a receiver the checker proved aMapand a key provedStrorIntwalks the runtime's hash table inline, keepingrt_index_getfor non-map receivers, dynamicAnyvalues, other key types, maps below the hash-table threshold and every other case. A??whose indexed value is read only by the coalesce's copy and branch takes that branch from the value the probe loaded, with no temporary round trip; the nil test stays because a present entry can hold nil through anAnyalias. The hashmap workload drops from 110 to 103 ms (-6.9%) and a probe-heavy workload from 240 to 182 ms (-24.1%); the sieve and string controls are unchanged (their executables are byte-identical). Both paths are off under--no-opt, andtests/map_probe.mayplus the oracle test cover them.Direct calls with register arguments (report): a call to a function known at compile time with matching arity passes up to three fat arguments in the register pairs RDX/RAX, RDI/RSI and R8/R9, and a native-word callee's payloads in the SysV argument registers, instead of building the 16-byte argument vector; a proven argument also skips its type check. Call-bound microbenchmarks drop 16-27%, the compiler image shrinks 2.5% and its self-compile is 1.7% faster. fib is unchanged because its recursive calls are already native-word calls, and binary trees and n-body move 1-2% because their time is allocation and map probes. Closures, function values, a mismatched arity and
--no-optkeep the argument vector;tests/direct_calls.may,tests/direct_calls.pyand the oracle test cover both paths.Fixed-slot records and guarded slot reads (report): a struct or enum constructor builds one
48 + 32n-byte map block and writes its entries directly, so construction allocates once and hashes nothing (binary trees 1.70x, 2M two-field constructions 1.85x, a record-churn workload 1.71x, self-compile 1.20x faster). The strict checker records each field's entry slot, and a field read on a statically known struct is a guarded offset load; a grown, compacted or foreign record falls back to the field-cache probe. The collector gains a record block kind so a record's moved entries block and hash table stay traced (the cause of the reverted prototype's timing-dependent crash). A duplicate-key declaration keeps the map path. Both paths are off under--no-opt;record_layout.may,record_dup_keys.may, the GC record probe and a reduced-heap record churn cover them. Refs #134.Inline
pushand string equality (report): a push into a list with spare capacity stores the element at its kind's width and bumps the count, falling back tort_pushfor growth, a widening element type and non-list receivers;==/!=on two strings of different byte lengths answer without enteringrt_eq. The sieve's 10Mpushloop drops from 250 ms to 187 ms (-25%); the string workload is inside the spread and the hashmap control is unchanged. Both paths are off under--no-opt, andtests/inline_push.mayplus the oracle test cover them.Audit the rest of the runtime library and remove its remaining superlinear and allocation-heavy paths (report):
sortis a stable merge sort (O(n log n) comparisons), anduniquerecords seen values in a map instead of scanning the result.strof a list or map allocates its text once and fills it with one copy per part (asjoindoes) instead of concatenating per element, and map display sorts its keys by merge instead of by insertion.trim,int,parse_int,reverse,starts_with/ends_with,pad_left/pad_rightand the JSON reader and writer no longer index code points in a loop (char_atre-walks the string from byte 0) or concatenate per character; the JSON scanner works in byte offsets.rt_str_eqcompares eight bytes per step, andkeys/valuesfill the result list directly.Measured on the new
runtime_pathsworkloads, a 50 000-charactertrimdrops from 7 032 ms to 2.0 ms,json_parseof a 20 kB document from 615 ms to 1.5 ms,strof a 20 000-element list from 1 312 ms to 6.5 ms andsortof 10 000 Ints from 292 ms to 5.1 ms, with peak RSS down from up to 288 MiB to 19 MiB.compiler/mayc/tests/strings.pynow checks the rewritten string functions against Python's code point semantics.
Opt-in runtime collection statistics (
MAYC_GC_STATS=1). The collector counts collections, allocated bytes, live bytes after the last sweep, total pause time and the heap and resident high-water marks, and writes one parseableGC key=valueline after each line of output and at an uncaught fault exit. One start-up read of/proc/self/environdecides whether to enable them; after that every counter and the CLOCK_MONOTONIC pause probe sit behind one global flag, so a normal run pays a flag test per allocation and per output write.compiler/mayc/tests/limits.py --runtime-gc-statsruns the GC cases with the variable set, addsLive MiBandRuntime pause mscolumns and aruntimeobject to the report, and requires the runtime's collection count to equal the inline meter's.make test-limitsexercises it.Derive the collection threshold from the live bytes of each sweep instead of the fixed 256 MiB default: the first cycle starts at half of the nominal heap, then every sweep sets
max(floor, 2 * live + margin)with a margin of one sixteenth of the nominal heap (at most 8 MiB), never below the allocation frontier plus that margin and clamped to the reservation. Empty tails are still reclaimed by rewinding the bump pointer; the threshold only lowers, nothing is unmapped. Measured with the cross-language suite (five runs; the C and Rust controls moved 7-16% between the two runs on this host, so treat the times as a spread), binary trees peaks at 218 MiB instead of 287 MiB and runs in 1847 ms instead of 1746 ms; sieve, whose flags list is 160 MiB live, keeps its RSS and runs in 331 ms instead of 433 ms. The compiler's own live set no longer fits the first threshold, so--checkofmain.maycosts about 10% more (1.39 s against 1.26 s) and a small file around 40% more (185 ms against 130 ms) while its peak RSS falls from 89 to 56 MiB. Conservative retention, not the threshold, now bounds peak RSS on the benchmark workloads: the tree sweep still finds about 39 MiB live in a 200 MiB heap.Track the cross-language suite behind the performance roadmap (#101):
compiler/mayc/tests/backend/xlang.pybuilds the eight workloads in Maylang, C, Rust, Java, Node and CPython, requires every language to print the same output, and records median wall time and peak RSS (make bench-xlang; not a CI gate). The baseline is xlang-baseline.md.Add
--no-opt, which turns off the fat backend's constant and variable forwarding, proven operand types, register homes, XMM Float temporaries and the new top-level-to-main-local pass.compiler/mayc/tests/oracle.pynow compiles every behaviour fixture both ways inmake test-compilerand requires identical exit status, stdout and stderr, so a pass that changes behaviour fails there.Top-level bindings that no function reads or assigns become locals of main instead of data words, so they keep a frame slot, can take a register home and are no longer collector roots (report). The suite shows no measurable change on its own (±3%, within the run-to-run spread): proven types had already removed the type checks, and the remaining gain needs main's body to compile as native-word code.
Specialized list element storage (#101 phase 2): a list literal or comprehension with a known element type stores
Boolas one byte,Intas a word andFloatas its binary64 bits, and a value of another type arriving through anAnyalias widens the list back to 16-byte fat values, so observation is unchanged (design, report). The sieve benchmark drops from 152 MiB and 308 ms to 16 MiB and 263 ms; aList<Bool>of ten million flags now costs 10 MiB instead of 160 MiB.
Licensing
Add a root MIT LICENSE that covers the compiler, tools, standard library, examples and native adapters, with THIRD_PARTY_NOTICES.md listing the vendored Sokol, stb and binjnes sources plus the bundled homebrew ROM and reproducing their notices (#54). GitHub can now detect the repository license. The release archive ships both files, the VS Code extension LICENSE matches the root copy, and
make checkfails when a vendored source loses its attribution or the manifests drift.
Documentation
Doc comments are the single source of API descriptions (#100). Every declaration in
stdlib/,native.mayandprelude.mayhas a///comment in the new doc comment standard: an imperative summary and optionalParams:,Returns:,Faults:andExample:sections. The per-symbol text indocs/reference/descriptions.jsonand the catalog entries fornative.mayfunctions intools/maylsp/docs/reference.jsonmoved into those comments, andmake checknow fails on a missing or malformed doc comment or on duplicated text.maylsprenders the doc comment sections in hover and completion, keeps indentation inside comments (so fenced examples survive), and takes signature-help parameter text fromParams:items.The VS Code extension highlights Maylang code in docs:
mayis a language alias, so hover fences are coloured; a Markdown injection grammar and a markdown-it plugin colourmayandmaylangfences in the Markdown editor and preview; and///comments get their owncomment.line.documentation.maylangscope with highlighted backtick spans and section names. The extension now starts the language server only once a Maylang document is open.Stop describing the closed sustained-allocation report (#2) as a known crash. It does not reproduce on the fat runtime: 20
gc_stress.pyseeds × 400 steps, the GC and limits suites, and five repeated runs of the trees, hashmap, strings, n-body and sieve benchmarks and of mayc compiling itself all pass with identical output. The 0.15.0 remaining limits are corrected.