Skip to content

Releases

v0.5.2-rc2

v0.5.2-rc2 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 20 Nov 21:29
ebe9e57

Downloads

Every download needs a C compiler on the system (GCC or Clang; on Windows, GCC from MinGW-w64), except zc-boot.com, which downloads one. Install explains each one.

File What it is
zenc-<version>-linux-x86_64.tar.gz, zenc-<version>-linux-arm64.tar.gz Native binaries for Linux (glibc 2.34 or later): zc, zc-lsp, zc-repl, zc-format, zc-doc and the standard library. Unpack it (tar -xzf) and add the directory to your PATH.
zenc-<version>-macos-arm64.zip, zenc-<version>-macos-x86_64.zip The same for macOS 11 or later, on Apple silicon and Intel. They are not signed: xattr -dr com.apple.quarantine <directory>.
zenc-<version>-windows-x86_64.zip The same for Windows: zc.exe and the tools.
zc.com The compiler as a portable executable: one file that runs on Linux, macOS, Windows and the BSDs, on x86_64 and arm64, with the standard library inside. On Windows, rename it to zc.exe.
zenc-<version>-ape.zip zc.com and the tools as portable executables: zc-lsp.com, zc-repl.com, zc-format.com and zc-doc.com. Keep them in one directory.
zc-boot.com For a machine with no C compiler: run it in an empty directory, and it downloads the Cosmopolitan C compiler and the zc.com of this release.

None of them has the REPL JIT; build from source with libtcc to get it.

What's Changed

  • zc check reports the RFC 0001 match-arm error; no diagnostics left in codegen by @pherrymason in #385
  • Locals get a C name of their own; a local declared twice in a block is an error; let _ discards by @pherrymason in #386
  • zc check and the build agree on self in a return by @pherrymason in #388
  • codegen: the early return of ? runs the function's defers (#367) by @paulboul1013 in #382
  • A value from true or false can change; codegen reads types and data, not text by @pherrymason in #389
  • The language server shows what zc build reports; no crash after a hover over a C name by @pherrymason in #390
  • A function's name is the written one; one rule gives its C name by @pherrymason in #391
  • zc check accepts a pointer compared with 0; a comparison is checked once by @pherrymason in #392
  • codegen: the drop flag of a local goes on its own line by @pherrymason in #394
  • C declarations are built from the type: arrays of function pointers compile by @pherrymason in #395
  • use takes the fields of a struct declared further down by @pherrymason in #396
  • One place registers a declaration, from its node by @pherrymason in #401
  • Impls and derives are read once every declaration is by @pherrymason in #403
  • The checks after parsing and the Drop facts move to src/analysis by @pherrymason in #397
  • How the program uses a symbol is the analysis's state, not the symbol's by @pherrymason in #398
  • diagnostics: a warning that 0.6 makes an error says so in a note by @pherrymason in #399
  • parser: grow buffers for derived implementations by @paulboul1013 in #400
  • A type name read before its declaration is resolved once every declaration is by @pherrymason in #406
  • Generic instances wait for every declaration; @derive(Clone) finds a Clone impl by @pherrymason in #407
  • panic() and @NoReturn calls end the flow by @pherrymason in #408
  • A use of an alias of a function pointer, tuple or instance declared before what it names no longer crashes by @pherrymason in #409
  • true and false are read as literals before any lookup by @pherrymason in #411
  • A name that hides another is reported once, where it is declared by @pherrymason in #412
  • A default value can name what is declared further down by @pherrymason in #413
  • Struct redefinitions and @required/@pure no longer depend on when a declaration is registered by @pherrymason in #414
  • An array size or a def can name a constant declared further down by @pherrymason in #415
  • A global's value can name what is declared further down by @pherrymason in #416
  • A variant of an enum without payloads is a constant in C by @pherrymason in #417

Full Changelog: v0.5.2-rc1...v0.5.2-rc2

v0.5.2-rc1

v0.5.2-rc1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 18 Nov 11:56
83842b3

What's Changed

  • typecheck: one exhaustiveness check for match, on patterns kept as written by @pherrymason in #122
  • typecheck: accept Enum::Variant() for a variant without a payload by @pherrymason in #123
  • typecheck: returns in lambdas, Self literals and casts to @link_name structs by @pherrymason in #124
  • parser, codegen: keep types in the AST only as a Type with source names by @pherrymason in #125
  • parser, typecheck, codegen: read aliases, generic instances and enum variants from their Type by @pherrymason in #127
  • typecheck: check imported modules and generic instances in a build by @pherrymason in #128
  • parser, typecheck: type calls to C functions from their headers by @pherrymason in #129
  • typecheck, codegen: type the locals of generic instances and drop ZenSymbol.c_type by @pherrymason in #130
  • c-headers, parser: type C variables from their headers and drop the hand-written built-ins by @pherrymason in #131
  • ast, parser, codegen: give tuples a type of their own, TYPE_TUPLE by @pherrymason in #132
  • parser, ast: build generic instances from their template and argument types by @pherrymason in #134
  • parser, typecheck, codegen: make a slice an instance of a built-in Slice by @pherrymason in #135
  • typecheck, utils, codegen: fix the Windows, ThreadSanitizer, analyzer and C++ jobs on main by @pherrymason in #142
  • typecheck, parser, codegen: answer questions about a type from its Type, not its spelling by @pherrymason in #137
  • ast, parser, codegen: write C from C spellings, not the spelling for people by @pherrymason in #139
  • ast, codegen: name primitives as the program writes them in messages and reflection by @pherrymason in #140
  • ast: mark primitive_zen_name const for the sanitizer builds by @pherrymason in #144
  • parser, codegen: keep 0.5.1 slices behind FF_COMPATIBILITY_0_5 by @pherrymason in #145
  • parser, codegen: keep an impl's target as its Type by @pherrymason in #146
  • fix(parser): use the module path for implicit std import diagnostics by @paulboul1013 in #147
  • typecheck, codegen: tell an Option or a Result by its Type by @pherrymason in #149
  • fuzz: declare curr_func_ret as the Type it is by @pherrymason in #150
  • parser, lsp: type tuple literals while the workspace is indexed by @pherrymason in #155
  • parser, codegen: slice an array with a[i..j] by @pherrymason in #153
  • codegen: name a @link_name struct by its C name in @fields by @pherrymason in #152
  • codegen: match through a pointer subject by @pherrymason in #151
  • codegen: write names that are C or C++ keywords under another name by @pherrymason in #154
  • typecheck, parser: move tuples that hold a value with Drop; sizeof of a tuple of variables by @pherrymason in #164
  • codegen: remove the pending closure frees, which nothing ever queued by @pherrymason in #165
  • codegen: decide once whether a moved value or a temporary needs Drop by @pherrymason in #166
  • codegen: a local closure gets a drop flag and frees its context by @pherrymason in #167
  • codegen: drop and move out a const parameter through a mutable pointer by @pherrymason in #168
  • codegen: drop a closure held in a struct field or captured by value by @pherrymason in #169
  • codegen: a tuple drops the values it holds that need dropping by @pherrymason in #170
  • codegen: drop a struct with @link_name, and decide a local's drop from its Type by @pherrymason in #171
  • codegen: assigning to a variable with Drop drops the old value in C too by @pherrymason in #172
  • typecheck, codegen: an array moves what it is built from and drops its elements by @pherrymason in #173
  • parser: mark a struct as Drop from its impl, whatever the declaration order by @pherrymason in #174
  • codegen: declare the temporary of a drop assignment with the variable's type by @pherrymason in #193
  • parser: a variable used as the message of assert or expect is used by @pherrymason in #182
  • c_headers: keep the kind of a header symbol as a CSymbolKind by @pherrymason in #183
  • codegen: emit each type alias once by @pherrymason in #184
  • codegen: decide from the Type whether an interpolated pointer is an address by @pherrymason in #185
  • parser: decide a cast by whether the name is a type, as C does by @pherrymason in #186
  • parser: a call through a module or type name needs the separator after it by @pherrymason in #191
  • parser: no unused-variable warning for a local that will be dropped by @pherrymason in #177
  • analysis, codegen: an enum with Drop, or with a payload that needs dropping, is dropped by @pherrymason in #181
  • parser: instantiate a generic in a declaration once every declaration is read by @pherrymason in #175
  • parser: parse the bodies of generic templates once every declaration is read by @pherrymason in #192
  • fix(parser): restore lexer state after for-loop lookahead by @paulboul1013 in #189
  • fix(codegen): emit #line when the file changes on the same line by @paulboul1013 in #196
  • parser: say that extern enum, extern const... are not declarations by @pherrymason in #197
  • parser: report a token that does not start a struct field by @pherrymason in #198
  • parser: keep the errors for syntax Zen C does not have in one file by @pherrymason in #199
  • fix(repl): handle Backspace and Escape during reverse search by @paulboul1013 in #194
  • parser: resolve Type::method from the declared type, not a name search by @pherrymason in #200
  • parser, codegen: keep a method's own name instead of cutting it from the C name by @pherrymason in #201
  • codegen, lsp, doc: show methods and variants by their own name by @pherrymason in #202
  • ast: int gets i32's C names, so it makes one instance with it by @pherrymason in #203
  • codegen, parser: a method call's owner comes from the target's Type by @pherrymason in #204
  • codegen: read Enum_Variant as a variant only when it names one by @pherrymason in #205
  • parser, lsp: tell an instance of a generic by its Type, not by a name prefix by @pherrymason in #209
  • typecheck: take a struct's address only for a pointer to the same struct by @pherrymason in #210
  • codegen: order structs by the types their fields hold, not by name prefixes by @pherrymason in #211
  • misra, derive, ast: decide by the Type or the whole name, not by text inside it by @pherrymason in #212
  • codegen: name eq, drop and to_string with the mangler; drop the _time_ prototype rule by @pherrymason in #215
  • codegen: emit a name the parser resolved as it is, not cut at __ by @pherrymason in #206
  • parser: find a variant by its C name, not by cutting the name at __ by @pherrymason in #207
  • parser: a method call inside a generic impl keeps its owner's Type by @pherrymason in #208
  • lsp: complete what the program declares by the name it declares, __ or not by @pherrymason in #213
  • A variable hides an enum or enum variant with the same name by @pherrymason in #217
  • fix(codegen): add () to a variant inside a callee by @paulboul1013 in #218
  • docs: contributor guide for humans and agents; local validat...
Read more

v0.5.1

Choose a tag to compare

@github-actions github-actions released this 04 Nov 09:17
6fccc97

What's Changed

  • native binaries for each system and the tools as APE in #119
  • lsp: Fix crashes while indexing workspace.

Full Changelog: (0.4.4 - 0.5.1) bcfefb5...v0.5.1

v0.5.1-rc2

v0.5.1-rc2 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 03 Nov 08:12
c43f458

What's Changed

  • release: native binaries for each system and the tools as APE by @pherrymason in #119

Full Changelog: v0.5.1-rc1...v0.5.1-rc2

v0.5.1-rc1

v0.5.1-rc1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 03 Nov 07:30
78bab2b

What's Changed

  • lsp: Fix crashes while indexing workspace.

Full Changelog: v0.5.0...v0.5.1-rc1

v0.5.0

Choose a tag to compare

@BAGR BAGR released this 02 Nov 05:04
80eaa3f

Language changes

  • Only f"..." interpolates, and print, println, eprint and eprintln are functions of std/io.zc that take one string: println(f"total: {n}") (RFC 0001). The old forms are compile errors that point to the new ones.
  • Lambdas and match arms take =>; -> is member access through a pointer and the return type arrow, so p->value reads the field.
  • Removed: autofree (use defer free(x) or Drop), async/await (use std/thread.zc), unless/guard, repeat/do … while, and the ? input statements (use readln(...)).
  • x[i] calls the struct's get method, and only get; Vec::index is gone.
  • A failed assert outside a test block stops the program with exit code 1.

Highlights

  • Security: a stack buffer overflow when mangling long generic names (GHSA-rv74-w6q7-h8xr), interpolated text read as a printf format, and pkg-config directives that went through a shell.
  • Function bodies can use anything declared further down the file, imports included.
  • Escape analysis in zc check: returning or storing the address of a local is an error.
  • MISRA C:2012: --misra (or --profile misra-c2012) checks the rules and builds MISRA-shaped C.
  • Backends: --backend c|cpp|cuda|objc|json|ast-dump|lisp|dot.
  • Testing: expect, std/test.zc, and each test block reports OK or FAIL; failed checks, panics and out-of-bounds indexes report file:line:.
  • The LSP, REPL, documentation generator and formatter are separate programs: zc-lsp, zc-repl, zc-doc and zc-format. The LSP indexes large workspaces several times faster and shows its progress.
  • Faster compilation: a program of 10,000 lines transpiles in about 6 s instead of 33–38 s.
  • zc help, zc run FILE ARGS..., and clear errors instead of broken C for many invalid programs.
  • Standard library additions in Option, Result, String, VecIter, BigInt, BigFloat and std/mem.zc.

Fixed

More than 140 fixes:

  • 59 bugs that kept valid code from compiling, with an error from zc or invalid C: generics, closures, traits, modules, enums, match, @derive, operators and the generated C;
  • 19 bugs where a program compiled but did the wrong thing: @derive(Eq) on enums with payloads, continue in indexed loops, interpolations lost with -O2, leaks and double frees with Drop, readln into a string…;
  • 15 compiler crashes and memory errors, three of them security issues;
  • 21 bugs in diagnostics and zc check: false errors, missing errors and wrong locations;
  • 33 fixes in tools and platforms: the LSP, the REPL, the CLI, installation, building the compiler, Windows and macOS.

See the full changelog for every fix, addition and change.

Migrating from 0.4.4: see the migration guide.