Skip to content

raillen/zenithlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Zenith Language

A reading-first programming language.
Alpha · v0.4.1 · Compiler in C · Native backend via C emission


Zenith is a language built for study, small projects, and research. It is a practical exploration of language design, compilers, diagnostics, runtime, and accessible tooling. It is not a production language or a market product.

Philosophy

Four rules drive every decision:

  1. Clarity over clever syntax. Code should read like intention, not puzzle.
  2. Explicit over magic. Behavior visible at the call site.
  3. Reading before short typing. Scannable names, predictable structure.
  4. Cognitive accessibility as a requirement. Diagnostics explain; docs reduce load.

Ref: language/decisions/033-language-philosophy-and-manifesto.md

Status

Item Value
Public status alpha
Source version 0.4.1-alpha.1
Latest packaged release 0.3.0-alpha.3 (2026-04-24)
Compiler v2, written in C
Backend C emission → native binary
Runtime runtime/c/ — ARC, single-isolate
Standard library stdlib/std/
v1 plan complete — all 7 tiers (T0–T7) closed

APIs may change. Some features are experimental. Breaking changes may happen between pre-releases before 1.0.0.

Quick Start

Requirements: Python 3 and GCC or Clang on PATH.

# Build from source
python build.py        # Linux / macOS
build.bat              # Windows

# Verify
./zt.exe doctor

Hello World

Single file, no project needed:

namespace script

func main()
    print("Hello from Zenith")
end
./zt.exe run hello.zt

First Project

./zt.exe create my_app --app
./zt.exe run my_app

Scaffold structure:

my_app/
  zenith.ztproj
  src/
    app/
      main.zt

zenith.ztproj:

[project]
name = "my-app"
kind = "app"
version = "0.1.0"

[source]
root = "src"

[app]
entry = "app.main"

[build]
target = "native"
output = "build"
profile = "debug"

src/app/main.zt:

namespace app.main

func main()
    print("Hello from Zenith")
end

CLI

Zenith 0.4.1-alpha.1

Usage: zt <command> [input] [options]

Build and Run:
  check           Validate code without building
  build           Compile to native executable
  run             Compile and run
  test            Run tests

Project:
  create          New project scaffold
  fmt             Format source files
  clean           Remove build output
  summary         Project overview and session context

Docs and Tools:
  doc             Validate or show documentation
  explain         Look up a diagnostic code
  doctor          Verify Zenith installation

Advanced:
  repl            Evaluate expressions interactively
  perf            Performance benchmarks

  zt help <command>   Detailed help for a command
  zt --version        Print version

Common flags: --ci --profile <level> --all --focus <path> --since <git-ref> --filter <name> --lang <lang> -o <output> --verbose --check

ZPM (local package manager):

zpm init
zpm add <package>
zpm install

Ref: docs/reference/cli/zt.md · docs/reference/cli/zpm.md

Language Features

Types and values

  • optional<T> and result<T,E> with ? propagation
  • tuple<A, B, ...> lowered to generated C structs
  • trait, apply, and any<Trait> for dynamic dispatch
  • list<T>, map<K,V>, set<T> with generic runtime collections
  • Explicit type conversion via std.int, std.float, std.bool

Expressions and control flow

  • f"..." string interpolation
  • with expression for struct field update without mutation
  • for i in range(...) allocation-free C counter loop
  • match with case else exhaustiveness checking
  • using for scoped resource cleanup

Diagnostics and attributes

  • Structured diagnostics with stable codes
  • zt explain <code> for every diagnostic
  • attr deprecated(...), attr todo(...), attr skip(...), attr test(...)
  • Match exhaustiveness warnings
  • Naming convention readability warnings
  • Cognitive accessibility profiles: beginner, balanced, full

Toolchain

  • Single-file mode: zt run file.zt without a project
  • zt create scaffold for app and lib projects
  • zt fmt formatter with --check gate
  • zt clean removes the build output directory
  • zt summary shows project info and session context (FOCUS/NEXT anchors)
  • FFI 1.0 — call C from Zenith
  • Local ZPM MVP for package management
  • Local LSP / VS Code extension (beta)
  • ZDoc documentation format

Standard library (std.*):

text · bytes · io · fs · fs.path · net · http · json · encoding · hash · math · random · regex · format · collections · validate · test · os · time · debug · int · float · bool · lazy · concurrent · console

Runtime Model

Default model: non-atomic ARC, single-isolate.

  • Heap-managed values use reference counting.
  • Sharing values between threads requires explicit copy or transfer.
  • Reference cycles can leak memory in the alpha.
  • Raw-pointer and manual-memory surfaces are future scope.

Ref: runtime/c/README.md · language/spec/runtime-model.md

Examples

examples/hello-world
examples/structs-and-match
examples/optional-and-result
examples/multifile-imports
examples/std-json
examples/extern-c-puts

Ref: examples/README.md · language/spec/final-language-contract.md

Testing

# Full suite
python run_all_tests.py

# Quick gates
python build.py
./zt.exe check zenith.ztproj --all --ci
python run_suite.py smoke --no-perf

# Performance gates
tests/perf/gate_pr.ps1
tests/perf/gate_nightly.ps1

Documentation Map

Path Contents
docs/public/ User docs by section: get started, learn, language, stdlib, packages, licensing
docs/reference/language/ Types, modules, errors and language rules
docs/reference/grammar/ Syntax and grammar lookup
docs/reference/diagnostics/ Diagnostic lookup
docs/reference/cli/ zt and zpm reference
docs/reference/stdlib/modules.md Standard library index
language/spec/final-language-contract.md Final/current/future language contract
language/spec/language-reference.md Implementation-facing language reference
language/decisions/INDEX.md Decision log with status
docs/internal/planning/ Roadmaps and checklists
CHANGELOG.md Release history

Repository Layout

compiler/        frontend, semantic, IR, backend, driver
runtime/c/       C runtime and memory model
stdlib/          standard library and ZDoc sources
language/spec/   normative specification
language/decisions/ decisions with context and status
docs/public/     user-facing guides by section
docs/reference/  reference material
docs/internal/   plans, reports, governance
docs/generated/  durable generated documentation only
examples/        demonstration projects
tests/           behavior, semantic, runtime, fmt, LSP, perf suites
tools/           helper scripts
packages/        official packages (Borealis and others)

AI-Assisted Development

Zenith is developed with strong AI assistance. That is part of the study.

AI assists with documentation, test creation, inconsistency checks, and implementation speed. Language decisions, scope, validation gates, and project direction are human responsibilities. The decision log and specs exist to keep that boundary explicit.

License

Apache-2.0 OR MIT — choose either.

  • LICENSE · LICENSE-APACHE · LICENSE-MIT
  • CONTRIBUTING.md · TRADEMARK_POLICY.md

About

Zenith is a reading-first, AI-assisted programming language focused on explicit semantics, stable tooling, and cognitive accessibility.

Topics

Resources

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors