A new programming language for WebAssembly GC
TypeScript
65
1,417 commits
updated Sep 26, 2026
Zena is a statically typed programming language designed from the ground up to compile to compact, high-performance WebAssembly GC binaries with a fast, self-hosted toolchain.
Zena takes TypeScript's syntax and ergonomics as a starting point, pairing them with a sound static type system and consistent semantics free from JavaScript's historical quirks. It integrates proven features from modern languages—Dart, Swift, Scala, Rust, and Kotlin—along with novel systems for resource ownership, asynchronous cancellation, and native WebAssembly Component Model support.
// Variables are immutable by default; primitive types are strict
let maxRetries: i32 = 3;
var attempts = 0;
// Sealed class hierarchies for algebraic data types
sealed class Shape {
case Circle(radius: f64)
case Rect(width: f64, height: f64)
}
// Pattern matching expressions with exhaustiveness checking
let area = (shape: Shape): f64 => match (shape) {
case Circle {radius}: 3.14159 * radius * radius
case Rect {width, height}: width * height
};
// Classes with Dart-style constructors and private fields
class Counter {
#step: i32;
var count: i32 = 0;
new(this.#step);
increment() {
this.count += this.#step;
}
}
// Pipelines for readable data flow
let formatted = " hello world "
|> trim($)
|> toUpperCase($);
[!WARNING] Zena is under active development and is not ready for production use. Syntax, semantics, and standard libraries are changing rapidly, and breaking changes occur frequently.
Zena builds on TypeScript-like syntax while enforcing strict static guarantees:
any type, no unchecked casts, and no implicit type coercion.i32, i64, u32, u64, f32, f64). References are non-nullable by default.let) and class fields are immutable by default; var marks mutable state.if, match, and try evaluate directly to values.this. parameter shorthand; class mixins for flexible code reuse.var/let distinction, compound assignment operators (no ++ or --).|>), and structured control expressions.resource class, Own<T>, and Borrow<T> enforce move semantics and stack-bound borrows at compile time without complex lifetime annotations.cancel blocks in try/catch/cancel/finally handle interruption cleanly, while shielded blocks ensure critical cleanup runs to completion..wit) files and WASI interfaces without external code generators or intermediate bindgen tools.Map.get()), expanding toward unboxed composite types and Struct-of-Arrays (SoA) layouts.Zena provides a self-hosted toolchain and specialized execution runtimes on Wasmtime:
zena-cli (zena): The primary developer tool, bundling the self-hosted compiler, test runner, benchmark runner, and documentation generator (zena doc).zena-run: A lightweight standalone runner that executes compiled Zena modules (zena-cli target) on Wasmtime without compiler overhead.zfx (zenafx): An experimental graphical runtime for WebAssembly components, providing GPU-accelerated rendering (wasi:webgpu) and OS window presentation (wasi-gfx:surface).Zena is in active development and experimental. The core language (classes, interfaces, mixins, generics, pattern matching, records, tuples, exceptions, SIMD, and async functions) is implemented in the self-hosted compiler. Work is ongoing on the ZIR optimization pipeline, async cancellation, the affine ownership system, and native WIT integration.
Zena is implemented primarily through generative AI paired with human architecture, engineering guidance, and code review. It serves as both an active language project targeting modern WebAssembly environments and an exploration of AI-assisted language engineering and toolchain development.
git clone https://github.com/elematic/zena.git
cd zena
npm install
npm run build
npm test
TypeScript
47.3%
JavaScript
23.4%
CSS
11.2%
Rust
10.2%
Nunjucks
4.4%
Shell
1.5%
A new programming language for WebAssembly GC
TypeScript
65
1,417 commits
updated Sep 26, 2026
Zena is a statically typed programming language designed from the ground up to compile to compact, high-performance WebAssembly GC binaries with a fast, self-hosted toolchain.
Zena takes TypeScript's syntax and ergonomics as a starting point, pairing them with a sound static type system and consistent semantics free from JavaScript's historical quirks. It integrates proven features from modern languages—Dart, Swift, Scala, Rust, and Kotlin—along with novel systems for resource ownership, asynchronous cancellation, and native WebAssembly Component Model support.
// Variables are immutable by default; primitive types are strict
let maxRetries: i32 = 3;
var attempts = 0;
// Sealed class hierarchies for algebraic data types
sealed class Shape {
case Circle(radius: f64)
case Rect(width: f64, height: f64)
}
// Pattern matching expressions with exhaustiveness checking
let area = (shape: Shape): f64 => match (shape) {
case Circle {radius}: 3.14159 * radius * radius
case Rect {width, height}: width * height
};
// Classes with Dart-style constructors and private fields
class Counter {
#step: i32;
var count: i32 = 0;
new(this.#step);
increment() {
this.count += this.#step;
}
}
// Pipelines for readable data flow
let formatted = " hello world "
|> trim($)
|> toUpperCase($);
[!WARNING] Zena is under active development and is not ready for production use. Syntax, semantics, and standard libraries are changing rapidly, and breaking changes occur frequently.
Zena builds on TypeScript-like syntax while enforcing strict static guarantees:
any type, no unchecked casts, and no implicit type coercion.i32, i64, u32, u64, f32, f64). References are non-nullable by default.let) and class fields are immutable by default; var marks mutable state.if, match, and try evaluate directly to values.this. parameter shorthand; class mixins for flexible code reuse.var/let distinction, compound assignment operators (no ++ or --).|>), and structured control expressions.resource class, Own<T>, and Borrow<T> enforce move semantics and stack-bound borrows at compile time without complex lifetime annotations.cancel blocks in try/catch/cancel/finally handle interruption cleanly, while shielded blocks ensure critical cleanup runs to completion..wit) files and WASI interfaces without external code generators or intermediate bindgen tools.Map.get()), expanding toward unboxed composite types and Struct-of-Arrays (SoA) layouts.Zena provides a self-hosted toolchain and specialized execution runtimes on Wasmtime:
zena-cli (zena): The primary developer tool, bundling the self-hosted compiler, test runner, benchmark runner, and documentation generator (zena doc).zena-run: A lightweight standalone runner that executes compiled Zena modules (zena-cli target) on Wasmtime without compiler overhead.zfx (zenafx): An experimental graphical runtime for WebAssembly components, providing GPU-accelerated rendering (wasi:webgpu) and OS window presentation (wasi-gfx:surface).Zena is in active development and experimental. The core language (classes, interfaces, mixins, generics, pattern matching, records, tuples, exceptions, SIMD, and async functions) is implemented in the self-hosted compiler. Work is ongoing on the ZIR optimization pipeline, async cancellation, the affine ownership system, and native WIT integration.
Zena is implemented primarily through generative AI paired with human architecture, engineering guidance, and code review. It serves as both an active language project targeting modern WebAssembly environments and an exploration of AI-assisted language engineering and toolchain development.
git clone https://github.com/elematic/zena.git
cd zena
npm install
npm run build
npm test
TypeScript
47.3%
JavaScript
23.4%
CSS
11.2%
Rust
10.2%
Nunjucks
4.4%
Shell
1.5%