Skip to content

v2.0.8

Latest

Choose a tag to compare

@kvthweatt kvthweatt released this 22 Oct 02:24
· 24 commits to main since this release

Base (pre-bootstrap) Python Compiler

  • Nested template types: Box<BB> now works in nested type parameters, in return types, and in inference from Box<Box>, such as Pair<A, Box>. This is in both the Python compiler and the bootstrapped compiler.
  • Pointer returns from literals: an integer literal returned from a pointer-returning function now takes the signature’s type. foo() -> MyS* -> 0; compiles without a cast. A 0 becomes a null pointer, and other constants are converted with inttoptr.
  • !? in switch statements: a switch on the not-null operator no longer fails in the Python compiler with i8 true. Case constants are rebuilt at the switch’s integer width.
  • Switch codegen: a switch where every case returns, combined with defer, no longer fails with “must end with return”. A merge block that no case reaches is now marked unreachable.

Bootstrapped compiler

  • Self-hosting: the bootstrapped compiler gets all of the above. The compiler sources were also cleaned up with the new syntax (below).
    f-strings: chained put_str/put_int sequences were collapsed into f-strings. Expressions containing .mem are deliberately left alone, because the f-string buffer has no length check and the inline-asm strings overflow it.
  • Empty default {} stubs: these no longer generate a stub default. When every case diverges, the statements after the switch are hoisted into the default.
  • Void calls: call(); ->; became -> call(); where the function returns void.
  • Verification: a corpus check of 270 programs gave 268 identical outputs and 2 that differ. The fixed point held: the compiler built with itself twice produced identical binaries.

Tooling and editors

  • Notepad++: keywords and autocomplete were rebuilt from the Sublime syntax.
  • setup.py (Windows wizard):
    • Window: it resizes to fit, and the Back/Next buttons are no longer pushed off-screen.
    • MSVC detection: it now finds Visual Studio and Build Tools by looking for the toolset on disk.
    • llc and LLVM version: MSYS2 is installed only if llc is missing or older than LLVM 21. Long steps run with no timeout.
    • PATH and launcher: it refreshes PATH after each install and writes scripts\flux_dev_prompt.bat.
    • Python compiler: it asks whether the Python v1.5.4 compiler is installed. If not, it copies it in from src\compiler\v1.5.4.
    • Two-stage bootstrap: stage 1 is python fxc.py fxc.fx. Stage 2 recompiles with build\fxc\fxc.exe into fxc2.exe.
    • Cleanup: after both stages succeed, it removes exactly the files it copied. A file it overwrote is restored.
  • Setup guides: the Linux, macOS and Windows guides now match the real toolchain per OS, including the copy step, the bootstrap, and a note to use the native compiler afterwards for speed.

Known issues

  • On Windows, fc.py passes freetype.lib to lld-link on every build. This file is not part of the Windows SDK. If linking fails on it, that is why.
  • The borrow checker, effects checking, and the FVM and its codegen (needed for comptime self-execution) are still Python-only.

Full Changelog: v2.0.0...v2.0.8