Repository navigation
Releases
Releases · agnogad/umay
umay 0.3.1
Full Changelog: v0.3.0...v0.3.1
umay 0.3.0
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 ...
umay 0.1.0
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.