Skip to content
code5717Public

About

statically-typed systems programming language

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

A7 compiler

A7 is a statically typed language with type inference, generics, and C-style syntax. The Python compiler emits Zig, and Zig builds the native executable. A7 is under development. See Status for current capabilities and gaps.

Quick start

Install Python 3.13 or newer, uv, and Zig 0.17.1. Put Zig on PATH for build and run. Native qualification targets Linux x86_64 with Python 3.13.

git clone https://github.com/code5717/a7-py.git
cd a7-py
uv sync
uv run a7 doctor
uv run a7 run examples/001_hello.a7

The hello example prints Hello, World!.

io :: import "std/io"

main :: fn() {
    io.println("Hello, World!")
}

Only compile and run A7 source you trust. Native executables run with the permissions of the host process. See the security policy.

Check, build and run

Task Command
Check a program without writing files or invoking Zig uv run a7 check examples/001_hello.a7
Get machine-readable diagnostics uv run a7 check examples/001_hello.a7 --format json
Check a library without a main entry point uv run a7 check --lib FILE
Build a native executable at ./hello uv run a7 build examples/001_hello.a7 --profile release --output hello
Build and run a temporary executable uv run a7 run examples/001_hello.a7
Emit Zig to examples/001_hello.zig uv run a7 examples/001_hello.a7
Inspect the compiler stages without writing files uv run a7 --mode pipeline --format json --timings examples/014_generics.a7
Report the toolchain and CLI capabilities as JSON uv run a7 doctor --format json
Print the installed compiler version uv run a7 --version

build defaults to ./<source-stem>. run starts the executable in the current directory and passes arguments after -- to the process. A7's main :: fn() takes no parameters and has no return value. --timings reports the wall time of each compiler stage and includes Zig for build and run.

doctor exits with code 2 when Zig is missing, its version differs, or the environment falls outside the qualification target. The JSON capability list is available even when Zig is missing.

Run uv run a7 --help for CLI options. The compiler guide covers modes, JSON diagnostics, and output files. uv run python main.py invokes the same CLI.

Build profiles

Use --profile with build or run, and --build-profile when emitting Zig.

Profile Zig mode Runtime checks
debug (default) Debug Enabled
release ReleaseSafe Enabled
fast ReleaseFast Zig safety checks disabled

fast can expose undefined behavior if compiler proofs miss an unsafe operation. See the safety contract for the guarantees and gaps that apply across profiles. --no-nonwrap disables the integer optimization that uses plain operators when the compiler proves the result fits.

Current language and limits

A7 supports explicit-width numbers, arrays, slices, structs, enums, unions, type aliases, functions, loops, match, and defer. Generics use $T type parameters and $N value parameters. Start with the language tour or browse the example index.

Source recursion is banned. The compiler rejects user variadic parameters and multi-declarations at semantic exit 6, and the parser cuts destructuring and multi-return forms at exit 5. Use a slice for a variable number of arguments or a named struct for multiple results. The specification covers generic constraints, pattern matching, and implementation limits for exact numeric evaluation and resource errors.

Contribute

Task Guide
Find source, tests, and documentation Repository documentation
Understand the compiler pipeline Architecture
Run compiler checks and package a release Release checklist
Build and verify the docs site Site README
Work in this checkout Repository instructions

Browse the documentation site or use the Markdown index for user and automation guides. Read the changelog for release changes.

About

statically-typed systems programming language

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages