Getting Started

Build the AHA! compiler from source and run your first program

Getting Started

Prerequisites

  • Rust (stable toolchain)
  • LLVM 14 with Clang 14 and Polly

Ubuntu / Debian

sudo apt-get update
sudo apt-get install -y llvm-14-dev clang-14 libpolly-14-dev

Building from Source

git clone https://github.com/qwetls/aha-lang.git
cd aha-lang
cargo build --release

Running the Compiler

cargo run --release -- --file example.aha

CLI Options

OptionDescription
--file <path>Source file to compile and execute
--emit-ir <path>Save the generated LLVM IR to a file
--versionPrint the compiler version
--helpShow usage information

Your First Program

Create example.aha:

let x = 10;
let y = 20;

if x > y {
    x
} else {
    y
}

Run it:

cargo run --release -- --file example.aha

The compiler walks the full pipeline — lexing, parsing, LLVM code generation — and then executes the program through its built-in JIT:

--- AHA! COMPILER ---
Reading file: example.aha

[1] LEXING...
[2] PARSING...
Parsing successful!

[3] CODE GENERATION...
LLVM IR generated successfully!

--- LLVM IR OUTPUT ---
; ModuleID = 'aha_module'
...
----------------------

[4] EXECUTION (JIT)...
Program executed successfully. Result: 20

What's Next