Changelog
Every change in each release of Zen C. The CHANGELOG.md of the compiler repository lists the most significant ones.
0.5.1
Fixed
- Release downloads (#109, PR #112, PR #113):
zc.comfinds its standard library in any directory, andZC_ROOTworks again;zc-boot.cominstalls thezc.comof this release;- the tools come as portable executables too:
zc-lsp.com,zc-repl.com,zc-format.comandzc-doc.com; - native binaries for Linux (
zenc-<version>-linux-<arch>.tar.gz), macOS and Windows (zenc-<version>-<os>-<arch>.zip).
- The language server no longer crashes when two files declare the same enum, one with a payload on a variant and one without, and calling a variant constructor without its payload is an error instead of a crash (#110, PR #111).
0.5.0
Issues and pull requests marked OG are in Zuhaitz-dev/zenc-lang; the others are in zenc-lang-ce/zenc.
Fixed
- Security:
- a stack buffer overflow when mangling long or deeply nested generic, enum variant and method names (GHSA-rv74-w6q7-h8xr);
- text interpolated into the format argument of
printf,fprintf,snprintfand other variadic calls is passed through"%s", so a%in it is no longer read as a format directive; //> pkg-config:build directives runpkg-configwithout going through a shell.
- Malformed or truncated source no longer crashes or hangs the compiler: recursion limits, end-of-file checks in every block parser, and many buffer overflows and NULL dereferences found by fuzzing. If the compiler still crashes, it says so and keeps the generated C.
- Memory errors in the compiler:
- a
matchexpression with more than 8 bindings in a pattern (OG PR #517); Type::methodon a generic resolved to an instance with a long name (OG PR #517);- a lambda capturing more than 32 variables (OG PR #511);
snprintfresults are no longer used as buffer offsets in the language server (OG PR #526);- an f-string used as a value no longer writes past its buffer (PR #4);
- a slice literal of a type with a long name (#17, PR #58);
- more than 2048 trait implementations (#26, PR #57);
- a tuple type whose element types add up to more than 256 characters, also in the language server (#15, PR #83);
- undefined behavior in constant folding:
let a: int[1 << 66];declared 4 elements on arm64. A shift by a negative amount or by 64 or more, andLLONG_MIN / -1, are no longer constants, and an overflow wraps around (#28, PR #90).
- a
- Function bodies and
testblocks can use anything declared further down the file, imports included: functions, methods, impls, generics and operators (OG PR #486). - Closures and lambdas:
- returning a capturing closure keeps its return type and its captured values (OG #358, OG #361);
- non-capturing lambdas and methods (
Person::speak) can be assigned tofn*pointers, also in struct fields (OG #344); - lambdas no longer capture C library names (
sprintf,stdout) orNULL,trueandfalse(OG #344), nor other names that are not variables outside them (OG PR #513); - lambdas capture outer variables used anywhere in their body, not only in some kinds of statements (OG PR #500);
- lambdas can contain
for … inloops and destructuringlet(OG PR #508), can be nested (OG PR #510), and can capture fixed-size arrays (OG PR #512); - closures inside f-strings: a
:in the closure no longer cuts the expression, the return type is inferred, and captures are read in f-strings used as expressions (OG PR #509); - lambdas inside generic functions get one definition per instance;
- closures that capture a function pointer compile (OG #418, OG PR #469);
- calling a closure with too few or too many arguments is an error, as for a function: the generated C did not compile; and a lambda parameter that is never used is warned about, as a function's is (PR #100).
- Traits:
- Generics:
- pointer type arguments:
Option<T*>,Map<MyStruct*>(OG #350, OG #328); - generic structs with slice fields (
data: T[]); - generic function bodies can use
matchdestructuring,deferand ternaries, andsizeof, casts and local types are substituted per instance; - a static call on a generic path (
Option<V>::None()) no longer ties the template to an unrelated instance (Map<JsonValue>::getreturnedOption<Vec<DirEntry>>); - the annotation of
let x: Foo<int> = make()selects the instance, and methods of genericimplblocks are found as templates; - an instance is no longer accepted where another instance of the same generic is expected (
Id<OrderKind>forId<UserKind>); through a pointer the program used to build and run with the wrong value (OG PR #521); Map<K, V>instances are namedMap__K__Veverywhere, and a module function whose name starts with__can be called (util::__name()) (PR #2).
- pointer type arguments:
- Enums and
match:- variants shared by several enums call the right constructor, also without
()on a generic instance (Maybe<int>::Nothing) (OG PR #450); - explicit values (
Ok = 200, hex, negative) reach the C enum andmatch(OG #399, OG PR #480); - enums without payloads compare with
==and cast to integers; Enum::Variantwithout()used as a value calls the constructor;matchon a variant whose name contains_;matchbindings onResultandOptionget the payload type, soOk(s) => s.length()works;- enum variants with more than 32 payload types no longer crash the compiler;
- a
matchexpression is parsed like amatchstatement: its patterns take literals, ranges,||and strings, and its bindings are typed. Each arm is emitted as a value, so a nestedmatch, anifor a string literal can be the value of an arm, and an arm canreturnorassert; - a struct pattern (
Opt { has: true, val: v } =>) is an error: the field values were ignored, so it matched any value, evenNone, or generated invalid C (#38, PR #93); - enums with
@link_nameuse the C name everywhere (PR #63).
- variants shared by several enums call the right constructor, also without
@derive:@derive(Eq)on an enum with payloads compares the values of the variant, not only the variant:Just(1) == Just(5)wastrue(OG PR #520);@derive(Eq),Clone,Debug,FromJsonandToJsonwork on generic structs and enums; no instance got the methods (OG PR #520);@derive(Eq)compiles on enums without payloads (OG #316, OG PR #484);@derive(Clone)clonesStringandVecfields instead of sharing them (double free) (OG #431, OG PR #485).
- Method calls:
- fill in default arguments and convert
&xto trait objects (OG PR #453); - resolve on enum values, also inside f-strings (OG PR #453);
- work on temporaries as receivers (
v.get(0).id == id,E::V.f()) (OG PR #464).
- fill in default arguments and convert
- Operators:
a != buseseqwhen there is noneq, also on instances of generic structs (OG PR #488);- overloaded operators pass struct operands by reference and drop temporaries (
text += &other) (OG #336, OG PR #467); name < indexandname < *ptrparse as comparisons (OG #367, OG #427, OG PR #478);cond ? .a : .b(theselffield shorthand) parses as a ternary (OG #324);- the
?operator works onOption, and builds theErrorNoneit returns from the enclosing function's return type; x[i]on a temporary callsgetthrough a temporary variable instead of taking the address of a value that has none (#65, PR #66);- a unary operator (
-x,!x,~x) overloaded inimpl Trait for X(PR #48).
- Loops:
continueinfor i, v in arradvances the index instead of looping forever (OG #359);- method calls on fields of the loop variable over
Vec<T*>(o.inner.get()) (OG #349, OG PR #482); let t = s;inside afor x in vloop keeps the element type (OG #377, OG PR #475);- a
breakorcontinuenested in more than 64 loops runs the right defers (OG PR #517); - a stray
breakafter afor i, x in a..bloop is reported byzcinstead of the C compiler (OG PR #517).
deferwithitworks in any expression (it[1],(int)it, ternaries) (OG PR #503).- Nested tuples (
((int, int), (int, int))) generate valid C. - Strings and interpolation:
- interpolations are no longer lost in
-O2and--releasebuilds; temporaries are evaluated once and freed once (OG #385); - a
Stringfield in an interpolation ({p.name}) (OG #384); - raw strings
r"..."andr"""..."""are not interpolated (OG #397); - non-
charpointers print with%p, and values of unknown type fall back to%sinstead of failing in C; - a
runeinterpolates without importingstd/io.zc; - moves are checked inside interpolations (
f"{a.c_str()}"afterlet b = a;) (OG #378, OG #383, OG PR #483); assertandexpectinterpolate anf"..."message (OG #402, OG PR #473);- several crashes in f-string parsing.
- interpolations are no longer lost in
- Modules and imports:
mod::fn()andmod::Type::method()resolve after a plainimport "mod.zc";- types used inside a module no longer get that module's prefix (
mod__Type); extern fnandextern letkeep their C names inside modules, andextern let x: T;keeps its declaration instead of vanishing (OG PR #455);- modules imported with
asno longer clash when they share a file name (OG PR #454); import "math.h" as mkeeps its alias when a module imported earlier already includedmath.h(OG PR #463);- a header imported twice (directly and through a std module) is no longer reported as a circular import;
- importing
std/arena.zcno longer forms an import cycle; - selective imports (
import {a, b} from) take more than 32 names; - a function shared by several modules gets one prototype in the C output;
- methods
_nameandnameon the same type no longer collide in C; - errors in an imported file are reported with that file's path, not the importer's (OG PR #487).
- Opaque aliases (OG PR #490):
selfand generic arguments (Option<UserId>) keep the alias type;- arguments are checked like
let:UserIdandItemIdno longer mix; - in their own module, two different aliases are not interchangeable;
- in their own module, an alias of a number compares with numbers (
*self == 0).
@link_namestructs: literals, and variables inside loops, methods andtestblocks, use the C name (OG PR #501, OG PR #514), and so do generic instances, casts andsizeofof a type with@link_name(#41, PR #73).defconstants keep their sign and their 64 bits (def NEG = -1;,def BIG: u64 = 0xcbf29ce484222325;) (OG #322, OG PR #472).- Drop and moves:
SetimplementsDropand no longer leaks (OG #420);- by-value parameters whose type has a destructor (
String,Vec, structs holding them) are dropped when the function returns; - a discarded call result with Drop is dropped (
Resource::new(i);,items.pop();) (OG #406, OG PR #471); x.forget()after movingxis not reported as a use after move.
- Generated C:
- each type is declared before the types that use it (OG PR #452);
- indexing through a pointer (
self.rows.data[r].push(v)) uses plain array indexing instead of the[]overload, which produced invalid C; - empty struct initializers are emitted as
{0}; - every variable of a top-level
let a = 1, b = 2;is emitted,staticand@thread_localglobals keep their storage class, and@cfgalternatives of one global are all kept (#18, #59, #60, PR #67); - a local without a declared type no longer takes the type of a variable with the same name in another function (#62, PR #68);
- a string literal can be the value of an
ifexpression (#39, PR #74); - a temporary that needs an address (a method receiver, an index or
==overload operand) is copied with its type instead of__typeof__(PR #70), and with--cppit stays alive during the call (#69, PR #72); - a
deferright afterlet x = v;is its own statement instead of being read aslet x = v defer ….
comptimeblocks process escapes in strings, and inside a function their output is parsed as statements (OG PR #451).readln(...)reads astringorchar*argument into a new string instead of writing over the pointer, and each integer with a conversion of its size: aboolor au16overwrote the bytes after it (#24, PR #91).zc build foo.zcwithout-ono longer overwrites, and then deletes, afoo.cof the user in the same directory.zc check(--typecheck):- checks method bodies in
traitandimplblocks (OG #347); - methods can call methods defined further down the same
impl; - a
T*argument assigned to aTvariable is accepted forCopystructs (OG #356); - assigning to a variable captured by value in a lambda is reported (OG #358);
- an infinite loop without
breakcounts as returning; - errors inside the standard library are not reported: the instances of
Vec<T>with aTthat implementsDropgot false move errors, so every program that importsstd/io.zcfailed (#45, PR #95).
- checks method bodies in
- Diagnostics:
--misrareports Rule 16.4 once for amatchwithout a default arm (#29, PR #55), no longer reports Rule 17.7 forreturn f();, and builds a program end to end: every program used to fail with rule 5.10 on the compiler's owntrueandfalse, and the MISRA preamble lackedZC_FUNC,ZC_GLOBALandstring(OG PR #519).zc transpile -o FILEno longer overwrites its output with a temporary file, and replaces an existingFILEon Windows too (OG PR #519).- Platforms:
- Windows: UTF-8 console output (OG #338),
Stringcase-insensitive comparison withoutstrcasecmp,std/time.zcno longer redeclarestime(), built programs link statically, and a failure to run them shows the OS error; @cfg(apple)is set on macOS (sostd/sync.zcbarriers work) and@cfg(windows)on Windows;- a macro name clash on Termux (OG PR #447, Yuuki1578);
- Windows:
zcrestores the console code page when it exits (#86, PR #87),build.batbuilds without libtcc (PR #47) and, like CMake, buildszc-lsp,zc-repl,zc-docandzc-format(PR #71); - macOS:
std/sys/info.zcuses the system'sstruct utsname;uname()wrote past the Linux-sized one.
- Windows: UTF-8 console output (OG #338),
- The C compiler receives the
-Ipaths and the input file's directory, with-iquotefor relative#includes, and no empty-I. - Installation:
- an installed
zcfinds its standard library inPREFIX/share/zencwithout-I(OG PR #524); - std lookup follows one order:
-Ipaths,ZC_ROOT,/usr/local/share/zenc,/usr/share/zenc; the compiler also findsstd.zcby walking up from its own location, and std modules are loaded from one location only; - an installed
zccompiles programs that importstd/regex.zcand resolves@link("std/...")paths; - Make and CMake install
std.zc, and CMake installs toshare/zenc(OG PR #448, robknopf); zc --versionshows the new version after a rebuild.
- an installed
- Building the compiler:
- with TCC, zig cc and Cosmopolitan (APE);
- plain
makeworks without libtcc (the REPL JIT is enabled only when found) (OG #437, OG PR #465); - with clang older than 14 (
-Wreturn-stack-address) (OG #440, OG PR #466); - with
ZC_LSP=0orZC_REPL=0, the tools whose sources it excludes are left out (OG PR #515); - with
ZC_NO_PLUGINS(it failed to link).
- Embedding the compiler (
driver_compile): the caller's configuration is used throughout (OG PR #494, OG PR #495), and a compilation after one with errors no longer fails (OG PR #507). - LSP:
- crashes and memory leaks in completion, go to definition, find references and indexing;
- client timeouts while indexing the workspace;
- re-analysing a file no longer reports redefinitions from files indexed before;
- an unresolved import no longer crashes the server (OG PR #396, robknopf);
- the server writes to stderr only with
--verbose, which broke Neovim ("cannot resume dead coroutine"); - each response carries the request's id as the client sent it, a string too (#19, PR #75);
- after about a thousand edits with a type error, every type failed to parse until a restart (#16, PR #76);
- words inside comments and strings are no longer colored as keywords (#32, PR #81);
- on Windows the server answers
initialize(PR #82); - the server stops indexing when the editor has exited, instead of running on (PR #79);
- methods are offered after
value.andType::, also on generic instances, and a member being typed completes like the members (#88, PR #89); - completion and signature help show a function's signature as written, with its Zen C types and parameter names, as the hover does, not its C form (
fn abc(int8_t) -> Vec__int8_t); signature help no longer splits a parameter at the commas inside its type (PR #97).
- REPL: Ctrl+C no longer locks multi-line input, crashes are fixed,
:c,:typeand:runwork on Windows, APE builds and with the standalonezc-repl, and:plotcompiles (#43, PR #54). zc -hlists only the optionszcparses (#21, PR #56), andzc help docshows the options ofzc-doc(#31, PR #53).- The Forth and Befunge plugins accept CRLF line endings.
Added
- Language:
const selfmethods, inimpland in traits;- several variables in one
let:let a = 1, b = 2;; @thread_local static let x: T;, andstatic letat file scope;@crepr("struct timeval")maps a struct to an existing C type, and@link("file.c")compiles and links a C file with the program;export import "file.zc"re-exports a module;nullin C mode;- arrays in
comptimeblocks (declaration, indexing, casts; out-of-bounds indexes are compile errors).
- A failed
assertorexpect, apanicand an index out of bounds say where they are in the source (file:line:). - Escape analysis in
zc check: returning or storing the address of a local is an error, also through arrays, struct fields, and functions or methods that return one of their pointer arguments (lifetime elision). - Clear errors instead of broken C for:
- top-level
const(OG PR #458), and anything else that does not start a top-level declaration (pub fn, a stray},namespace) (OG PR #463); - C keywords used as names (
let double) (OG PR #456); x as T, with a hint towards(T)x(OG PR #522);- a struct named like a std generic (OG PR #457), and a struct defined twice (OG PR #354, jiang1997);
- functions and methods defined twice (OG #178, OG PR #476);
- circular imports;
breakandcontinueoutside a loop;- an initializer of an unrelated type (
let x: int = "text"); - prefix pointers (
*Type; Zen C usesType*); - leftover tokens in an interpolation (
f"{x y}", code in anf"""string) (OG #368, OG PR #470); - a C string or number as the operand of an overload that takes a struct (
String += "x") (OG #336, OG PR #467); - a global initialized with an f-string (OG #411, OG PR #477);
- an unknown trait in
@derive(@derive(Cpy)) (OG PR #489); - a function whose closing
}is missing at the end of the file (Unclosed '{') (OG PR #486); autofree,async,await,unless,guard,repeatanddo … while(see Removed), with the replacement;- a match arm written with
->, and->used as a lambda arrow (x -> x * 2,(a, b) -> a + b), with a hint towards=>(PR #94).
- top-level
- Testing:
expect(cond, msg), a check that records the failure and goes on;std/test.zc, imported intestblocks:expect_eq,expect_ne,expect_approx_eq;- each
testblock reportsOKorFAIL, a failure no longer stops the other tests, and the exit code is the number of failed tests.
- Backends:
--backend NAMEwithc,cpp,cuda,objc,json(the AST),ast-dump,lisp(Common Lisp) anddot(Graphviz), plus--backend-opt key=value;--cpp,--cudaand--objcstay as aliases. CUDA and Objective-C builds get their own compiler flags, and the C++ backend compiles the standard library. An unknown--backendname is an error, with a suggestion (OG PR #515). --filccbuilds with Fil-C, the memory-safe C compiler.- MISRA:
--misrachecks MISRA C:2012 rules and directives, plus Zen rules (noraworpluginblocks, no#directives, no_arm on enum matches, no shadowing, reserved names, no tuples of 3 or more fields, nostring == string);--profile c11|hosted|misra-c2012(--misraismisra-c2012); MISRA output has no#linedirectives (Rule 20.13);@cfg(misra), and@cfg(freestanding)with--freestanding;StaticArena, a fixed buffer used for allocation in MISRA builds.
- CLI:
zc helpandzc help <command>;zc run FILE ARGS...passes the arguments to the program, and so does everything after--(#30, PR #92);zcreports an unknown command instead of building silently (zc test f.zc) (OG #409, OG PR #468);-W<group>and-Wno-<group>turn Zen C diagnostics on or off (unused,safety,logic,conversion,pedantic,interop); other-Wflags still go to the C compiler;--no-suppress-warnings(see Changed) (OG #341);zc doc FILE(zc-doc) writes Markdown documentation from///and/** */comments, genericimplmethods included.
zenc.jsonaccepts"c_types": C type names that the unknown-type check accepts.- Standard library:
Option:unwrap_or_else,is_some_and,is_none_or,filter;Result:unwrap_or,unwrap_or_else,ok,err,map_err,is_ok_and,is_err_and,expect_err;String:clone(OG #431, OG PR #485),to_int,repeated,reverse,trim_start,trim_end;VecIter:collect,count,forEach,find,any,all,filter,fold;BigInt:compare,is_zero,from_string,sub,mul,div,rem;BigFloat:compare,sub,mul,div,from_string;Base64::decode;- a generic
sort<T>(arr, len); std/mem.zc:realloc_n,dealloc,alloc_bytes,zalloc_bytes;std/plugin.zc, to write compiler plugins in Zen C;///documentation comments on the main modules.
- REPL: runs code in process through libtcc,
zc-repl -c "code", tab completion of keywords, commands and session symbols, and:commands such as:type,:time,:c,:show,:saveand:load. - LSP:
- project-wide definition and hover, percent-encoded file URIs, completion filtered by the typed prefix, and types colored as types (OG PR #442, PigeonCoding);
- hover, go to definition and completion for C headers (OG PR #491);
workspace/symbol(OG PR #462) and go to declaration (OG PR #460);- full signatures on hover (OG PR #461);
- formatting, and signature help that marks the active parameter;
- completion of keywords and types,
Enum::Variant, and members through generics and methods (a.b.); breakandcontinueoffered in every kind of loop, also nested inmatch(OG PR #505, OG PR #506);- hover for built-ins and for plugin blocks;
- code actions that replace deprecated
varandconst; shutdownandexit;zenc.server.json(include paths,exclude,use_gitignore) and.gitignoresupport when indexing (OG PR #493);--verbosestartup log: version, project root, and what the workspace indexing cost (OG PR #525);- the progress of indexing the workspace, shown in the editor's status bar (PR #78);
- completion of the fields of structs from C headers, through typedefs of another name and through fields (
camera.position.), with each field's C type (PR #99).
- Build:
make ZC_LSP=0 ZC_REPL=0 ZC_PLUGINS=0 ZC_BACKENDS=0and thecore,liteandminimaltargets build a smaller compiler;make format,lint,bench, fuzzing targets, and test targets for MISRA, backends, plugins, the LSP, TCC and Fil-C.
- Test tooling:
- diagnostic output tests (OG PR #496) and C unit tests,
make test-unit(OG PR #497), run by the CI (OG PR #498); make test-check: files thatzc checkmust accept with no errors (OG PR #523);- the MISRA test runner matches expected errors against diagnostics only (OG PR #459), and a MISRA build is tested end to end (OG PR #519).
- diagnostic output tests (OG PR #496) and C unit tests,
- Documentation:
- German translations of the README, CONTRIBUTING, SECURITY and LSP guides (OG PR #366, VOIDWERK);
- the README and its translations describe runes and the
testframework (OG #338); MANGLING.md,STYLE.mdand the compiler conventions inCONTRIBUTING.md.
Changed
- Strings (RFC 0001):
- only
f"..."interpolates, and{{/}}are escapes only there; a plain"..."that relies on the old interpolation is an error for this release (PR #5); print,println,eprintandeprintlnare functions ofstd/io.zcthat take one string and print it as text:println(f"total: {n}"). They needimport "std/io.zc", and the old forms that would compile and print nothing are errors, with the replacement (PR #50, PR #51, PR #61).
- only
- Lambdas and match arms take
=>, and->is member access through a pointer and the return type arrow:p->valuereads the field, also whenpis a plain identifier, where it used to be the lambdap => value(#46, PR #94). x[i]calls thegetmethod of a struct, and onlyget(#33, PR #64).- A failed
assertoutside atestblock stops the program with exit code 1, instead of going on and exiting with 0. - The LSP, REPL, documentation generator and formatter are separate programs:
zc-lsp,zc-repl,zc-docandzc-format.zc lsp,zc repl,zc docandzc formatstill work but are deprecated, and--zenis gone. comptimeblocks run in an interpreter inside the compiler (let, loops,if, string concatenation,code(),yield(),compile_error,compile_warn).zc checkfollows the build's rules: match bindings, aliases,p[i], pointer/value, and omitted struct fields (required only in MISRA mode) (OG PR #523).- Output is shorter by default:
zcprints only "Compiling FILE";-vshows each phase.zc --helpis a short usage summary. - Diagnostics go through one path: errors and warnings are counted once, also with
--json, and hints print the same way everywhere (OG PR #496, OG PR #497). - C compiler warnings caused by the generated code (
-Wparentheses, unused values and variables, sign comparison, missing field initializers) are silenced by default;--no-suppress-warningsshows them (OG #341). #defineand#includein Zen C code are deprecated with a warning: usedefandimport.c_long_longandc_ulong_longare nowc_longlongandc_ulonglong.- Standard library:
to_string()returnschar*everywhere (ComplexandJsonValuereturnedString);length()andfree()are the canonical names;len()(JSON) andfree_mem()(BigInt,BigFloat) remain as deprecated aliases;alloc,alloc_nandzallocreturn zeroed memory, andrealloc_nzeroes the new tail;- each
Randomhas its own generator state (same seeds, same sequences); format()can be nested: it rotates four thread-local buffers, anditos,utosandformatare thread-safe;- modules use
extern fn,@creprand@linkinstead ofrawC blocks (std/sys,time,json,sha256,regex,process); sortis a generic quicksort with median-of-three pivots, andStringbuilding copies withmemcpy;std/net/httpno longer prints "Server listening";Vec::indexis gone; usegetorv[i](PR #64).
- The DSL plugins (Befunge, Brainfuck, Forth, Lisp, SQL) are written in Zen C, the regex plugin is gone, and plugins can report diagnostics and provide hover text.
- LSP:
- memory no longer grows without bound while editing (OG PR #449);
- unknown requests get
MethodNotFound(OG PR #460); - closing a document reverts it to the file on disk (OG PR #492);
- a project outside the compiler's tree finds the standard library (OG PR #516);
- go to definition finds variables inside ternaries, array literals and lambdas (OG PR #499).
- The language reference moved from the README to the documentation site; the installation guide was updated (OG PR #369, z0rhan).
- Faster compilation: symbol and type lookups (OG PR #444, apocalypse9949); struct ordering and lookups in codegen (a program of 10,000 lines: 33–38 s to about 6 s); name lookups indexed by name (a program of 60 files: 4.6 s to 0.8 s; indexing a workspace of 1,206 files in the language server: 56 s to 6.5 s) (PR #80).
- Building the compiler: C23 (
gnu23) by default, falling back tognu11;zcno longer contains the TRE regex library, whichstd/regex.zccompiles from source. - Internal: the compiler source was split into many smaller files with a shared source list, the code generator writes through an emitter, global state moved into the compiler and parser contexts (OG PR #494, OG PR #495), typecheck and MISRA checks were separated, the AST walkers share
ast_children()(OG PR #499 to OG PR #505), the C code generator shares its loop and defer scaffolding (OG PR #518), the driver no longer sets the parser context twice (OG #436, OG PR #474), the C names of symbols are built in one place (PR #2), duplicated parser code was merged (PR #48), f-strings are an AST node written by codegen (PR #51), dead code was removed (PR #49), and CI gained sanitizer, fuzzing, coverage, benchmark and example-build jobs; benchmark noise no longer fails pull requests (OG PR #502).
Removed
- These forms are compile errors that name their replacement:
autofree: usedefer free(x)orDrop;asyncandawait: usestd/thread.zc;unlessandguard: useifandif !;repeatanddo … while: useforandwhile.
- The
? "prompt" (x)and? x, yinput statements, and theprintandprintlnkeywords (println "text"): usereadln(...)andprintln(f"...")(PR #50).