Skip to content

v0.14.9 — Conditional Compilation + Hex Parser Fix

Choose a tag to compare

@murphsicles murphsicles released this 10 Jun 08:28
· 127 commits to main since this release

v0.14.9 — 2026-06-10

New: #[cfg(feature = "...")] Conditional Compilation

Zeta now supports feature-gated compilation via the #[cfg(...)] attribute system. This is essential for large multi-module packages where you want to select which components to build.

CLI Usage:

zetac my_program.z --features "xxh64,xxh3" -o output

Supported cfg predicates:

  • feature = "name" — enabled when name is passed via --features
  • any(feature = "a", feature = "b") — true if any predicate matches
  • all(feature = "a", feature = "b") — true if all predicates match
  • not(feature = "name") — true if feature is NOT enabled
  • target_os, target_arch, target_family — checked against build host

Modules added:

  • src/frontend/cfg.rs — cfg predicate evaluator + FeatureSet

Parser changes:

  • top_level.rs: parse_mod checks cfg before building module AST; gated items produce AstNode::Skip (filtered out at top level)
  • parser.rs: cfg_should_skip() helper
  • ast.rs: Skip variant for filtered items
  • evaluator.rs: Skip passthrough in CTFE

Fix: Hex literal parsing ≥ 0x8000000000000000

i64::from_str_radix silently rejects values exceeding i64::MAX, causing large hex constants (MSB set) to parse as zero. This broke xxhash constants (P1, P2, P4) and any code using hex literals ≥ 2^63.

Fix: u64::from_str_radix(...) as i64 — parses as unsigned 64-bit, then reinterprets bits as signed via the as cast.

Affected file: src/frontend/parser/expr.rs:137

Full Changelog

  • b720cd24 Add #[cfg(feature)] support with --features CLI flag
  • 7953beae Fix hex literal parsing for values ≥ 0x8000000000000000