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-devBuilding from Source
git clone https://github.com/qwetls/aha-lang.git
cd aha-lang
cargo build --releaseRunning the Compiler
cargo run --release -- --file example.ahaCLI Options
| Option | Description |
|---|---|
--file <path> | Source file to compile and execute |
--emit-ir <path> | Save the generated LLVM IR to a file |
--version | Print the compiler version |
--help | Show 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.ahaThe 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: 20What's Next
- Take the Language Tour to learn types, operators, and control flow
- Read about Functions and Strings
- Look under the hood in Architecture