Repository navigation
umay 0.2.0
Added
- Cross-target compilation.
--targetselects the system to emit code for;
without it the compiler builds for the host.x86_64-unknown-linux-gnu(ELF, System V)x86_64-apple-darwin(Mach-O, System V)x86_64-pc-windows-gnu(COFF, Microsoft x64)
--emit-object-onlyonbuild: assemble and stop, linking nothing.
Producing an object for another system was already possible but always reported
as a failed build, because the link that followed could not succeed. A caller
who only wants the object -- to link it elsewhere, or to inspect it -- is now
a success. Both object paths are printed, andrun --emit-object-onlyis a
usage error rather than a build with nothing to run.- Regression test
emitting_an_object_alone_succeeds_for_a_target_that_cannot_be_linked
checks the exit status, both printed paths, that both files really are Mach-O,
that no executable appeared, and thatrunrefuses the combination. --targetwas also missing fromumay --help; both flags are documented now.
- Regression test
asm --emit-object-onlyprints the assembly and leaves the object in
dist/.asmprinted text and kept nothing, so a caller who wanted an object
had to runbuild, which links, which a cross target cannot do. Without the
flagasmstill writes nothing -- a command that quietly starts leaving files
behind is a worse surprise than one needing a flag.- The printed assembly is byte-for-byte what
asmprints alone; the flag only
appends the line naming the object. - Regression test
asm_leaves_an_object_only_when_askedfails if the flag is
ignored onasm(dist/main.omissing), and it also checks that the
unflaggged run creates nodist/at all.
- The printed assembly is byte-for-byte what
--emit-object-onlyprints the command that links its output. Leaving the
last step to the reader only helps if the instructions are right, and the flags
differ per system (-no-pie,-mconsole,-lws2_32); a wrong one is a link
error about something else. The compiler knows them, so it says them:Where the command cannot work on this host, it says that instead of suggestingbuilt dist/both.o built dist/umay_runtime.o link it with: x86_64-w64-mingw32-gcc -o dist/both.exe dist/both.o dist/umay_runtime.o -mconsole -lws2_32
it silently:(`cc` here links ELF, not Mach-O; this needs a linker that writes Mach-O).- Regression test
the_printed_link_command_works_as_printedruns the printed
line through a shell and runs the result. It fails if the command omits a
runtime object, or writes the executable somewherebuildwould not (both of
which happened while writing it:-o mainrather than-o dist/main). The
"links ELF, not Mach-O" wording is checked too, so the caveat cannot go back to
blaming a missing program when the program is present and simply wrong-format.
- Regression test
- An emitted Windows object links and runs outside this compiler. The flag's
whole claim is that the objects are usable elsewhere, and only the end of that
chain proves it.an_emitted_windows_object_links_and_runs_elsewherelinks
dist/main.oanddist/umay_runtime.oby hand withx86_64-w64-mingw32-gcc
-- the command a user would type -- and runs the result under Wine, checking it
prints its own output. Verified:21andsocket ok, so sockets link and work
through the hand-built path too.- Skips cleanly when MinGW or Wine is absent, rather than failing on a machine
that cannot do the check. - Fails if either object is missing, which is the way this can actually break.
- Skips cleanly when MinGW or Wine is absent, rather than failing on a machine
- A target that cannot be linked here says so, and says where the object is.
umay build --target x86_64-apple-darwinon Linux used to hand a Mach-O object
to the host's linker and print its complaint about file formats. It now reports
the formats involved, names the object it produced and leaves it on disk --
which is the half of the job that did succeed.- The rule is the linker's format, not the host's:
x86_64-w64-mingw32-gcc
links COFF from Linux, and an earlier version of this check refused it. - Regression test
an_unlinkable_target_reports_where_its_object_wentfails if
the rule goes back to comparing against the host's format.
- The rule is the linker's format, not the host's:
- A Windows object is checked for linkability too. Same idea as the macOS
check, read from the real COFF symbol table:WinMainmust be exported, every
UMAY name one object leaves undefined must be defined by the other, and every
remaining name must be one MinGW's CRT or Win32 actually exports.- Regression test
a_windows_object_leaves_only_what_mingw_provides_undefined
fails if a binding is misspelt (CreateThreadwritten asCreateTread). - This replaced a guessed-prefix list in
windows_references_match_their_definitions
that could not tell a C library name from a typo.
- Regression test
- A macOS object is checked for linkability without a Mac. The symbol table is
read back from the assembled object:_mainmust be defined and global, every
name the program leaves undefined must be one UMAY's runtime defines, and every
C library name the runtime leaves undefined must be one macOS actually has.- Regression test
a_macos_object_leaves_only_its_own_runtime_undefinedfails if
a binding is misspelt (writewritten aswrote), which is the fault class
the check exists for.
- Regression test
umay_pipeworks on Windows. It bindsCreatePipeinstead of POSIX
pipe. Both ends are stored eight bytes wide on every system, because a POSIX
descriptor is a small integer and a Windows handle is pointer-sized: the
platform layer widens the narrow one, so the portable body that forks and reads
a pipe has one shape to write against.- Threads work on Windows.
thread_spawnhands one value to another thread
and gets one answer back; how differs -- POSIX forks and reads a pipe, Windows
starts aCreateThreadand asks it for its exit value.umay_thread_spawn
picks, sothread_spawnitself holds no system-specific code and itsSend
check is unchanged. - A generic value can have its address taken.
&value as *const Ais the only
way to reach a value whose type is a parameter, and it is what the cross-thread
hand-off needs. It was refused twice over: the cast had no rule, and the parser
read&v as Tas&(v as T). - A Windows
--target x86_64-pc-windows-gnubuild now runs. The standard
library's system-specific names moved intostdlib/platform/, so a Windows
object binds WinSock andCreateThreadinstead of POSIXacceptand
pthread_create, and links againstws2_32.- Verified end to end:
umay build --target x86_64-pc-windows-gnuproduces a
realPE32+ executable for MS Windows (console), x86-64, and under Wine it
prints the right answers, opens a socket and binds a port.
- Verified end to end:
- Only the prelude a program reaches is emitted. A four-line "hello" used to
emit 160 function bodies -- the JSON parser, the HTTP helpers, the hash map --
because the whole prelude is compiled with every program. Walking the call graph
frommain(and from every function whose address is taken, since an indirect
call cannot be resolved statically) leaves a handful.computebuilds in
0.063 s instead of 0.092 s and its binary is 23 KB instead of 79 KB. compiler/src/target.rs: one description of what differs between systems —
symbol spelling, object format, calling convention, assembler and linker
invocations, and which runtime platform layer to compile.- The Windows x64 calling convention in the backend: four argument registers
in their own order, 32 bytes of shadow space, aggregates returned through a
hidden pointer at any size, and%rsi/%rdipreserved across calls. - The runtime split into a portable body and per-system layers under
runtime/platform/. On Windows, whereforkdoes not exist, the checked
fan-out runs onCreateThread; theSendguarantee is unchanged because the
front end settles it before either call. compiler/tests/cross_target.rs: asserts each target's assembly is accepted by
a real assembler for its object format and yields the right object kind with
_maindefined, and that the Linux output did not change.
Added
- GitHub Actions CI. Every push and pull request runs
cargo test --locked
and a release build. Taggedv*releases additionally build the checksummed
artifact withscripts/release.shand keep it as a workflow artifact. - A
LICENSEfile.Cargo.tomldeclaredMIT OR Apache-2.0, but the texts
were not in the repository or the release tarball. Both are now included.
Fixed
-
The differential generator stopped creating conflicting assignments.
It emitteds.f = f(&mut s, ...),s.f = s.g + 1, and assignments to
variables borrowed elsewhere in the same body. Those are either genuine
conflicts or valid programs beyond the checker's field-wise borrow model, so
long fuzz runs reported compiler errors that were really generator faults.
The AST regression checks 2000 generated programs; CI still builds and runs
30 of them end to end. -
A parenthesized comparison was read as generic arguments. The lookahead
accepted a)inside<...>, so(p < q) > rbecamep<q>(...)and failed
withE0330. It now tracks groups opened inside the argument list; a)or
]that closes an outer group ends the scan. Differential seed 1573 found
it, andparenthesized_comparison_is_not_generic_argspins the fix. -
macOS C calls now use Mach-O's leading underscore. Foreign symbols were
emitted bare, as ELF and Win64 require, so the Mach-O linker looked for
mallocinstead of_mallocand reported every libc function undefined.
The assembler now prefixes foreign symbols only for Mach-O, and the object
test rejects a bare C name. The CI smoke job also runs onmacos-15-intel;
an arm64 runner cannot link this x86_64 backend's objects against its libc. -
A
<comparison could be parsed as generic arguments. The lookahead that
distinguishesf<T>()fromx < yscanned up to 64 tokens and ignored
boundaries, so a>in a later statement closed a phantom argument list:
while (i < 6i32) ... return a > (b)reportedE0224at the6i32. The scan
now stops at any token that cannot appear in a type. A same-line case
(if x < y && z > (w)) was affected too. -
Borrow liveness crossed sibling CFG branches. A
&mutborrow created in
one arm and last used in another was treated as live in blocks on unrelated
paths, so a shared borrow after theiffalsely reportedE0205. Conflict
checks now require the earlier borrow's last use to be reachable on the CFG
from the later borrow's creation. -
Win64 struct returns crashed before they could be used. The callee read
the hidden return pointer from%rdi(the SysV first-argument register)
instead of%rcx(Win64), writing the result through a garbage address. The
largerhttp-routerexample died this way under Wine; it now runs, and a
regression test checks a 40-byte struct round-trip. -
8-bit multiplication emitted an instruction the assembler rejects.
imul
has no two-operand byte form, soa * boni8/u8producedimulb %cl, %dl
and the build failed withinvalid instruction suffix. The selector now
multiplies at 16 bits and keeps the low byte, which is the same result modulo
2^8 for signed and unsigned operands. A differential fuzzing harness found it;
with the front-end bugs below fixed, that harness now runs as a CI gate over
30 seeds (UMAY_DIFF_COUNTstill overrides the count for local sweeps). -
-O2folded!255u8to -256. Unary constant folding ran in an i128
scratch integer and never truncated back to the operand's width, so a later
cast widened the wrong value. Bitwise not and negation now truncate to the
value's own type. -
The parser could spin forever on a malformed
implbody. Error recovery
stops at a top-level keyword so the program loop can parse the next item; a
body loop calling it on a strayimplsaw the same token again forever. Body
recovery now guarantees one token of progress. -
The cache grew without bound. Every source edit creates new content keys,
so the cache had reached 1.3 GiB / 19,000 entries on an active machine. New
key directories now trigger eviction of the oldest entries down to 512 MiB;
UMAY_CACHE_MAX_BYTESoverrides it andumay doctorreports the limit. -
pubcould be bypassed two ways. A private module item was also entered
in the global bare-name table, soutil::helper()resolved as a bare
helper()from any module; a bare reference now resolves only inside the
declaring module and reportsE0101with the owner named elsewhere. Methods
declared in animplwere not checked at all, sovalue.hidden()reached a
private method from outside; that now reportsE1018. A module's own private
items and methods still work. -
Four emitted diagnostics had no
umay explainentry:E0192,E0193,
E0194(module loading) andE1017(trait bounds). A test now scans the
compiler source and fails if any emitted code lacks an explanation. -
Stale documentation: the README phase table showed phases 6–9 as partial
or unstarted,lib.rssaid phases 2+ were unimplemented,Cargo.tomlpointed
at a repository URL that is not this one, and the ROADMAP's test count was
out of date. -
A pipe silently became two half-handles on Windows.
umay_pipewas a stub
that always failed, and the storage callers read back was four bytes per end --
too narrow for aHANDLE, so even a realCreatePipewould have handed back a
value that named nothing. Both ends are eight bytes now, widened in the platform
layer on POSIX and written at full width on Windows.- Regression test
a_pipe_reports_two_usable_endsbuilds and runs a program that
opens a pipe and rejects any end that is zero, negative or the same as the
other. It fails if the widening is removed.
- Regression test
-
&v as Tparsed as&(v as T).asbinds looser than every prefix
operator, so the cast applied to the thing being pointed at rather than to the
pointer. The same fault made*p as usizemean*(p as usize). The parser now
takes one operand for a prefix operator and applies casts above it. -
A frame assumed the stack alignment it was entered with. Both ABIs promise a
16-byte stack pointer at acall, and every frame relies on it -- but a Windows
thread starts its routine without one, so the pointer was eight bytes off and
the first call the thread made faulted. The prologue now rounds the pointer down
instead of trusting it. -
A structure argument was dropped when a call mixed register and stack
arguments. On Win64 the stack arguments begin above the 32-byte shadow
space, not inside it: taking the larger of the two sizes put the first one at
offset zero, where the callee never looked. -
A one-field structure crashed on Windows. Win64 returns a structure of 1,
2, 4 or 8 bytes inrax, and 16, 32 or 64 bytes inraxand further registers;
only the other sizes use a hidden pointer. The compiler treated every
aggregate as needing the pointer, so the caller read the field fromraxwhere
the callee had left the address it was told to write through. The rule was
written twice -- once incodegenfor the callee, once iniselfor the
caller -- and fixing one did not fix the other; it now lives in
codegen::aggregate_goes_through_pointerand both ask it.- Regression test
windows_returns_a_small_aggregate_in_a_registerchecks the
callee and the caller in the same assembly. It fails if the Win64 arm goes
back tosize > 0.
- Regression test
-
Windows sockets crashed on the first call after opening one.
Socket.fdwas
ani32, but a WindowsSOCKETis a 64-bit handle: narrowing it lost the top
half, and the resulting value named nothing. The field, and the platform
bindings, areisizenow. -
Windows and macOS objects could not be linked at all. Four separate faults,
each invisible on Linux and each reported as the same page of
undefined referenceerrors:- A cross-target assembler is a driver:
clang -o out.o in.slinks rather
than assembles, so the object was never produced.-cwas missing. - Definitions took the target's
_prefix but references did not, so every
call into the runtime and every read of a string literal named a symbol that
did not exist. Only definitions went through the mangling. - Symbols from the C library were given the same prefix, which asked for
_mallocwhen MinGW exportsmalloc. - MinGW's startup code calls
WinMain, notmain, whatever subsystem the
driver is told to use. The program object now defines aWinMainthat jumps
tomain; the runtime object must not, or the two collide.
- A cross-target assembler is a driver:
-
The Windows link driver is
x86_64-w64-mingw32-gcc, notclang. Clang's
PE linker cannot resolve the__ImageBaserelocations in MinGW's import
libraries and fails on every CRT archive. -
A store through a pointer no longer has its pointer deleted. Optimisation
killed the liveness of a local whenever a statement assigned to it, but
*p = 5lowers to_0.(deref) = 5: it writes through_0and does not
define it. The statement that produced the pointer was therefore judged dead
and removed, so the program stored through a register that was never written.
umay build -O1and above produced binaries that segfaulted, andalloc/
deallocbenchmarks died withdouble free or corruption. Optimisation is
only allowed to remove work, never to change what a program computes. -
A comparison's operands keep their own type. Folding stamped a comparison's
destination type (bool) onto its operands, which retyped an integer literal
to a byte:i < 1000was emitted asmovb $1000, %cl, so the bound became
232 and a loop ran 232 times instead of 1000. The wrong answer appeared at
every level above-O0. -
errno,renameandmkdirno longer reach a C symbol directly from the
portable runtime: the accessor and the replacing-rename differ per system
(__errno_location/__error/_errno, and Windows' CRTrenamerefuses
to replace an existing target where POSIX replaces it).
Changed
- Documentation now matches the release state.
README.mddescribes all
completed phases and the current per-target verification;ROADMAP.mdsays
differential fuzzing runs in CI by default; the memory model and its ADR count
the six unenforced diagnostic codes listed in their own table. Package
metadata moves to0.2.0so the release notes describe a real version. - The benchmark now builds UMAY as an optimised release.
scripts/bench.py
compiled UMAY at its default-O0while every other language in the table was
given its optimiser (gcc -O2,rustc -O, ZigReleaseFast). The comparison
measured one flag, not five languages.
Known limitations
- A non-host target's executable cannot be linked on a machine without that
system's SDK and CRT.umay build --target ...keeps the assembled objects
and prints the link command that a machine with the SDK can run. - Windows objects link with MinGW-w64 and run under Wine locally, including the
largerhttp-routerexample. Those checks skip on a runner without Wine;
they are not a GitHub Actions gate yet. - macOS objects are assembled and their symbols checked statically on any host.
Amacos-15-intelCI job links and runs a small binary; the result of a given
commit is visible in Actions. x86_64is the only architecture. An ARM triple is refused with an
explanation rather than emitting a binary nothing can load.- Borrow liveness is still field-insensitive on some paths: reading
s.fand
assignings.gin the same body can be rejected (E0208remains deferred).
The 30-seed differential gate is green; longer runs stay manual.
[0.1.0] — 2026-11-08
The first release: a language, a compiler, a standard library and a toolchain,
all working end to end. This version is the MVP that Phase 9 of the roadmap
defines — every phase from architecture to stabilization is done.
Language
- Statically typed, natively compiled systems language with ownership and
borrow checking and no garbage collector. - Modules from files (
mod name;), with dependencies reachable as modules. - Generics with inline trait bounds, traits and
implblocks,Option/Result
as ordinary enums, exhaustivematch,?error propagation. - Explicit, checked
ascasts, no implicit numeric conversion.
Compiler
- Lexer and recursive-descent parser with error recovery and a nesting guard.
- Semantic analysis: interning type context, three-pass checking so declaration
order never matters, local inference, exhaustiveness checking. - HIR and MIR with a set of optimisations.
- Custom x86_64 backend: instruction selection, linear-scan register allocation
with honest handling of fixed registers, and an assembler printer. No LLVM,
no Cranelift. - Ownership and borrow checking, drop elaboration.
- Diagnostics as data: stable codes, one rendering for humans and one for
machines,umay explain CODEfor every code.
Standard library and runtime
- Written in UMAY and compiled by the same backend (ADR 0010): strings,
Vec,
HashMap, JSON over counted bytes, TCP, files and processes, and a
concurrency model withSend/Syncchecked at the spawn boundary.
Toolchain
umay check | build | run | asm | ast | mir | fmt | lint | explain | doctor | new | clean | lock | metadata | version.- A language server that runs the compiler rather than a copy of it: live
diagnostics, hover, go-to-definition (including across modules), completion,
outline and formatting over JSON-RPC. - A deterministic formatter that rewrites the gaps between tokens and nothing
else. - A content-addressed build cache keyed on the compiler's own binary, the source
bytes and the module tree, so a stale artifact is impossible and an unchanged
rebuild recompiles neither the program nor the runtime. upm: a manifest (umay.toml), a lockfile (umay.lock), resolution of the
whole dependency graph, and fetching from a registry named byUMAY_REGISTRY,
with every fetched package pinned by SHA-256.
Known gaps
whereclauses andlet-elseare not parsed; a program that uses them is a
clear syntax error. Use inline bounds andmatch.pubis accepted but there is no cross-module visibility enforcement yet.- Attributes are parsed and carried but have no semantics; an unused one is
W0010. - Zig is not part of the build-time comparison in
docs/measurements.mdbecause
it was not installed on the measurement machine; it is named, not dropped.