| Crates.io | ag-c |
| lib.rs | ag-c |
| version | 0.1.0 |
| created_at | 2025-10-09 21:18:10.671017+00 |
| updated_at | 2025-10-09 21:18:10.671017+00 |
| description | The ag language compiler - a Rust-inspired functional language |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1876190 |
| size | 356,081 |
ag is a Rust-inspired functional programming language that compiles to native machine code. The project emphasizes clarity, correctness, and learning through incremental development.
# Build the compiler
cargo build --release
# Compile an ag program (once implemented)
./target/release/ag examples/hello.ag -o hello
# View compilation stages
./target/release/ag examples/hello.ag --stage 1 # Lexer
./target/release/ag examples/hello.ag --stage 2 # Parser
| Phase | Feature | Version | Status |
|---|---|---|---|
| 0 | Foundation & Tooling | - | โ Complete |
| 1 | Lexical Analysis | 0.1.0 | โ Complete |
| 2 | Parsing & AST | 0.2.0 | โ Complete |
| 3 | Semantic Analysis | 0.3.0 | โ Complete |
| 4 | Conditionals | 0.4.0 | ๐ โณ In-Progress |
| 5 | Loops (Turing-Complete!) | 0.5.0 | ๐ Locked |
| 6 | Intermediate Representation | 0.6.0 | ๐ Locked |
| 7 | Code Generation | 0.7.0 | ๐ Locked |
| 8 | Standard Library | 0.8.0 | ๐ Locked |
| 9 | Optimizations | 0.9.0 | ๐ Locked |
| 10 | Advanced Features | 1.0.0 | ๐ Locked |
See ROADMAP.md for the complete development plan.
Here's what ag will look like (Phase 2+):
// Factorial function
fn factorial(n: i32) -> i32 {
let result = 1;
let i = 1;
while i <= n {
result = result * i;
i = i + 1;
}
return result;
}
fn main() -> i32 {
let x = factorial(5);
print_i32(x); // Phase 8: stdlib
return 0;
}
# Run all tests
cargo test
# Run tests for a specific phase
cargo test phase_01
# Run with verbose output
cargo test -- --nocapture
# Update snapshot tests
cargo insta review
ag-compiler/
โโโ src/ # Compiler implementation
โโโ tests/ # Test suites by phase
โโโ docs/ # Technical documentation
โโโ man/ # User manual
โโโ examples/ # Example programs
โโโ scripts/ # Build and documentation scripts
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Run clippy (linter)
cargo clippy
# Format code
cargo fmt
We welcome contributions! Please:
The ag compiler is designed as a learning project. Here are resources that inspired it:
Every feature comes with comprehensive tests. Tests accumulate across phases to ensure backward compatibility.
The language grows one feature at a time. Each phase is complete and working before moving forward.
Every compilation stage produces a human-readable visualization for debugging and learning.
Documentation is written as features are implemented and locked at phase completion.
Licensed under either of:
at your option.
Let's build a compiler together! ๐
For questions or discussions, open an issue on GitHub.