Skip to content

Repository files navigation

Zanna

Zanna

License: GPL v3 Platform

Zanna is a from-scratch, IL-first compiler toolchain and virtual machine for building platform-native applications and games. Source languages lower to a typed intermediate language, Zanna IL, which can run on the VM, feed the optimizer, or compile to native code through the built-in backends.

Zia is the flagship language: a modern, statically typed language with classes, generics, enums, lambdas, modules, pattern matching, and direct access to the Zanna runtime. A BASIC frontend is included for education, compatibility experiments, and quick prototypes.

Status: Pre-alpha, active development. The current source tree is v0.2.99; the IL reference is 0.3.0. APIs, diagnostics, IL rules, and tooling are still evolving.


Download

Latest tagged release: v0.2.7-dev (2026-06-30)

In development: v0.2.99 on master. See the draft v0.2.99 release notes.

git clone https://github.com/zannagames/zanna.git
cd zanna

Quickstart

Build, test, and install the toolchain with the platform scripts:

# macOS
./scripts/build_zanna_mac.sh

# Linux
./scripts/build_zanna_linux.sh

# Windows
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build_zanna_win.ps1

Verify the build:

zanna --version

Create and run a project:

zanna init my-app              # Zia project (default)
zanna init my-app --lang basic # BASIC project
zanna run my-app

Try the REPL:

zanna repl
zia> 2 + 3 * 4
14
zia> Say("Hello from Zanna")
Hello from Zanna

See the Getting Started Guide for platform-specific setup, build directory layout, and troubleshooting.


Components

Component Description
Zia Statically typed application language with classes, generics, modules, lambdas, enums, and pattern matching
BASIC Educational and prototyping frontend that lowers to the same IL
Zanna IL Typed, block-structured SSA-style IR with a normative 0.3.0 reference
Optimizer Registered O1/O2 pipelines covering SSA promotion, SCCP, GVN, LICM, loop cleanup, inlining, devirtualization, runtime fast paths, and cleanup passes
VM IL execution engine for fast bring-up, tests, debugging, and step-budgeted runs
Native backends AArch64 and x86-64 code generators with backend optimization, register allocation, assembly emission, and executable output
Assembler / Linker In-tree ELF, Mach-O, and PE object/link support with DWARF and platform packaging integration
Runtime Shared standard library for collections, graphics, 3D, GUI, games, networking, crypto, text, threads, localization, and more
Language servers Zia and BASIC servers with LSP and MCP modes for editors and AI coding tools
Zanna Studio IDE written in Zia on the Zanna GUI runtime: semantic editing, project search/replace, side-by-side diffs, VM debugging with structured inspection, PTY terminal, and Git source control
Tools Unified zanna driver plus zia, vbasic, ilrun, il-verify, il-dis, REPL, package, installer, and benchmark commands

Why Zanna?

  • IL thin waist: Zia, BASIC, and future frontends share one typed IR, verifier, optimizer, VM, and native backend path.
  • Self-contained native toolchain: Zanna includes its own runtime, assembler, linker, object writers, package generation, and install packaging paths.
  • Machine-readable tooling: zanna check, zanna eval, zanna explain, --dump-runtime-api, and --dump-opcodes expose JSON-friendly surfaces for editors, scripts, and AI agents.
  • Cross-platform by design: macOS, Linux, and Windows are first-class targets; platform checks are centralized in adapter layers.
  • Runtime-first apps and games: The standard library includes 2D/3D graphics, GUI widgets, game systems, audio, networking, localization, threading, and structured data APIs.

Examples

The examples tree includes curated applications, games, 3D scenes, API audits, language samples, IL programs, and C++ embedding demos.

Demo Description
Paint Drawing app with tools, layers, file dialogs, zoom, and undo/redo
Chess GUI chess with alpha-beta AI and drag-and-drop play
Crackman Maze chase game with pathfinding and mode-driven AI
Game3D starter & scenes The Game3D learning ladder, from hello-triangle to a streamed open world
zanna run examples/games/chess/
zanna build examples/apps/paint/ -o paint
./scripts/build_demos.sh

The larger showcase titles — XENOSCAPE, Ashfall, 3D Bowling, Ridgebound, ZannaSQL, and more — live in the zannademos repository, which tests and builds them against a Zanna checkout.


Architecture

+-------------------------+
|    Source Languages     |
|      Zia / BASIC        |
+-----------+-------------+
            |
            v
+-------------------------+
|  Parser / Sema / Lower  |
+-----------+-------------+
            |
            v
+-------------------------+
|       Zanna IL          |
|  Verifier / Optimizer   |
+------+------------+-----+
       |            |
       v            v
+-------------+  +-----------------+
|     VM      |  | Native Backends |
|  Interpreter|  | AArch64/x86-64  |
+------+------+  +-------+---------+
       |                 |
       +--------+--------+
                v
+-------------------------+
|      Zanna Runtime      |
| Collections / Graphics  |
| GUI / Game / Network    |
| Text / Threads / ...    |
+-------------------------+

See the Architecture Overview and Code Map for subsystem details.


IL at a Glance

Frontends lower to typed Zanna IL that is compact, explicit, and inspectable.

Zia source:

module Hello;

bind Zanna.Terminal;
bind Fmt = Zanna.Text.Fmt;

func start() {
    var x = 2 + 3;
    var y = x * 2;
    Say("HELLO");
    Say(Fmt.Int(y));
}

Representative IL:

il 0.3.0
extern @Zanna.Text.Fmt.Int(i64) -> str
extern @Zanna.Terminal.Say(str) -> void
global const str @.L0 = "HELLO"
func @main() -> void {
entry_0:
  %t0 = iadd.ovf 2, 3
  %t1 = imul.ovf %t0, 2
  %t2 = const_str @.L0
  call @Zanna.Terminal.Say(%t2)
  %t3 = call @Zanna.Text.Fmt.Int(%t1)
  call @Zanna.Terminal.Say(%t3)
  ret
}

Use --dump-il, --dump-il-opt, and zanna il-opt to inspect the pipeline. The IL Quickstart is the practical introduction; IL Guide is the normative reference.


Runtime Library

All frontends share the Zanna Runtime Library. The runtime surface is generated from the live registry and spans:

  • Collections, core types, functional helpers, math, text, structured data, I/O, time, and utilities
  • 2D graphics, 3D graphics, Game3D, GUI widgets, input, audio, and game systems
  • Networking, crypto, diagnostics, memory controls, threading, system APIs, and localization

Authoritative runtime inventory:

zanna --dump-runtime-api

Authoritative IL opcode inventory:

zanna --dump-opcodes

Tools

Command Purpose
zanna run <file|dir> Build and run a source file, project directory, or manifest
zanna build <file|dir> -o <out> Build IL or a native executable
zanna check <file|dir> --diagnostic-format=json Type-check and verify without running; JSON diagnostics include ranges, notes, and fixits
zanna eval 'expr' --json --type --il Evaluate a Zia or BASIC snippet through the REPL pipeline
zanna explain <CODE> --json Explain a diagnostic code from the central catalog
zanna repl [zia & basic] Interactive REPL
zanna -run <file.il> Execute an IL module directly, with optional tracing and step limits
zanna package <dir> Package an application for macOS, Linux, Windows, or tarball output
zanna install-package Package the Zanna binary tools and Zanna Studio into a platform installer
zia / vbasic Standalone source compiler entry points
zia-server / vbasic-server Language servers with LSP and MCP modes
ilrun, il-verify, il-dis Direct IL execution, verification, and disassembly
zanna il-opt Run and inspect optimizer pipelines
zanna bench IL benchmark runner

See the installer and package release guide for native signing, checksums, artifact inventories, release workflows, and clean-VM install/upgrade/uninstall validation.

Common examples:

zanna run program.zia
zanna -run program.il --max-steps 100000
zanna build project/ -o app
zanna check project/ --diagnostic-format=json
zanna eval '2 + 3 * 4' --json --type
zanna explain V-ZIA-UNDEFINED --json
zanna --dump-runtime-api
zanna --dump-opcodes

See the Tools Reference, Debugging Guide, and MCP tool reference for full details.


Building

Requirements

  • CMake 3.20+
  • C++20 compiler: Apple Clang, Clang, GCC 11+, or MSVC

Build Scripts

# macOS
./scripts/build_zanna_mac.sh

# Linux
./scripts/build_zanna_linux.sh

# Windows
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build_zanna_win.ps1

The scripts configure, build, test, and install Zanna. The Unix wrappers delegate to scripts/build_zanna_unix.sh.

Useful iteration knobs:

Variable Effect
ZANNA_SKIP_CLEAN=1 Incremental rebuild
ZANNA_SKIP_TESTS=1 Build only
ZANNA_TEST_LABEL=<label> Run one CTest label

Targeted checks after a build:

ctest --test-dir build -L codegen --output-on-failure
ctest --test-dir build -R test_zia_lexer --output-on-failure
./scripts/example_smoke.sh --fast

Platform guides:


Documentation

Getting Started: Setup Guide, REPL Guide, Zia Tutorial, The Zanna Book

Language References: Zia, BASIC, IL Guide, IL Quickstart

Runtime & APIs: Runtime Library, 3D Graphics, Game Engine, GUI

Internals: Architecture, VM, Code Map, Backend, IL Passes

Contributors: Contributor Guide, Frontend How-To, Testing


Contributing

Zanna is in active development and the architecture is still stabilizing. Small fixes, documentation improvements, bug reports, and focused tests are welcome.

Before proposing changes:

  • Read the relevant spec or reference first; IL Guide is normative for IL.
  • Keep the product dependency-free.
  • Preserve macOS, Windows, and Linux behavior.
  • Use the platform build scripts and keep tests green.
  • Follow Conventional Commits for commit messages.

See Contributor Guide and Testing for the full workflow.


License

Zanna is licensed under the GNU General Public License v3.0 (GPL-3.0-only).

See LICENSE for the full text.

About

Zanna is a self-contained development platform for building native games and applications on Linux, macOS, and Windows. It brings back the coherence and immediacy of classic developer tools, while providing a modern language, compiler, runtime, IDE, 2D/3D engine, GUI toolkit, networking and packaging.

Topics

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages