Advanced Hybrid Architecture
A fast, expressive, and modern programming language designed for building anything from web backends to game engines.
AHA! is designed from the ground up to deliver an outstanding developer experience:
- 🚀 High Performance: Compiles to LLVM IR for maximum machine code optimization, on par with C++.
- 🧠 Smart Type System: Static typing with automatic type inference. Safe from bugs, yet concise to write.
- 🔀 Safe Concurrency: Built-in Actor model for writing parallel code free from race conditions.
- 🛠️ Full Resource Control: Safe manual memory management with "Resource Lifetimes", without Garbage Collector overhead.
- 📦 Modern Ecosystem: Built on Rust, leveraging the powerful
Cargotoolchain.
- Rust (version 1.75 or later)
- LLVM 14 and supporting libraries
- Clang 14
# Update package list
sudo apt-get update
# Install LLVM, Clang, and development libraries
sudo apt-get install -y llvm-14-dev clang-14 libpolly-14-dev zlib1g-dev-
Clone the repository:
git clone https://github.com/ahalang-dev/aha-lang.git cd aha-lang -
Run the Compiler:
cargo run -- --file <filename>.aha
Create a file called example.aha:
let x = 10;
let y = 20;
if x > y {
x
} else {
y
}
Run it:
cargo run -- --file example.ahaExpected Output:
--- AHA! COMPILER v1.3 ---
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
The AHA! compiler is built with a modern, modular architecture:
Source Code → Lexer → Parser → Code Generator → LLVM Backend → Native Binary
- Lexer: Breaks source code into tokens.
- Parser: Transforms tokens into an Abstract Syntax Tree (AST) using a Pratt Parser.
- Code Generator: Translates the AST into LLVM Intermediate Representation (IR).
- LLVM Backend: Optimizes and compiles IR into native machine code.
AHA! is still in early development. Here is our plan:
- Milestone 1: Compiler Foundation
- Lexer & Parser
- Integer data type
- Arithmetic & Comparison expressions
- Conditional statements
if/else
- Milestone 2: Fundamental Features ✅
-
Booleandata type (codegen) - Operators
<=,>=,!=(fixed) -
whileloop ✅ -
forloop (parser + codegen) ✅ - Functions with parameters ✅
-
returnstatement ✅ - Prefix expressions
-x,!x✅ - Assignment
x = value✅ - Break & Continue ✅
- Variable scoping (block-level) ✅
-
- Milestone 3: Advanced Data Structures ✅
- String type (pointer-as-int, limited)
- Array (parser + codegen)
- Struct definitions (parser only)
- Field access (parser only)
- Milestone 4: Standard Library ✅
- print(int) — print integers
- print_str(string) — print strings
- abs(x) — absolute value
- min(a, b) — minimum
- max(a, b) — maximum
- Milestone 5: Tooling & Ecosystem ✅
- VS Code Extension (syntax highlighting)
- CLI improvements (--emit-ir, --version)
- Better error messages
- Multi-line comments
/* */✅
-
Milestone 6: Type System
- Type inference
- Type annotations
- Generics / Parametric types
-
Milestone 7: Resource Lifetimes ⭐
- Ownership semantics
- Borrow checking
- Automatic resource cleanup
-
Milestone 8: Concurrency
- Actor model
- Message passing
- Async/await
-
Milestone 9: Package Ecosystem
- Package manager (
aha install) - Module system
- Dependency resolution
- Package manager (
-
Milestone 10: Self-Hosting 🏆
- AHA! compiler written in AHA!
- Bootstrap process
- Production ready
We welcome contributions of all kinds! Whether it's reporting bugs, suggesting new features, or contributing code.
See CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License. See the LICENSE file for details.
We believe programming should be closer to the way humans think. AHA! aims to eliminate unnecessary boilerplate and complexity, allowing you to focus on the logic and solutions you're building.
Join us in creating the next generation of programming languages!