About this project
Xag is a compiled programming language built around high performance, helpful error messages, and Rust-style memory management. Every size must be explicitly declared—there is no bare `int` type. Programs are compiled ahead of time either to native code via LLVM or executed by one of two AOT interpreters.
The compiler is written in C++20 against LLVM's native C++ API, requiring LLVM 23 or newer, CMake, and Ninja. Source files use the `.xag` extension. The toolchain includes commands for lexing, parsing, type-checking, and IR inspection.
Three execution engines exist: a test interpreter (obviously correct, slow), a fast interpreter (flat-code optimized), and an AOT native backend. All three call a single shared runtime, so they agree on runtime behavior. When engines disagree, the project identifies which one is out of step.
Decimal arithmetic is rigorously validated: the software implementation is cross-checked against Python's `decimal` (libmpdec) across 400,000 cases, and against POWER hardware decimal units via QEMU emulation for 20,000 additional cases.
Unicode support follows UAX #29 in full, including grapheme cluster counting, against Unicode 17.0.0 tables. All 766 Unicode conformance cases are run in the test suite.
An oracle generator (`generator/`) writes random Xag programs and tests them across all engines to find discrepancies. The generator is written in Rust with no external dependencies.
License: Apache-2.0 WITH LLVM-exception. Use is free; modifying the compiler or runtime requires attribution under Apache terms.
Note: This is early work in progress—nothing is stable yet. Most code in the repository is AI-generated under the direction of the language designer.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.