A functional programming language with explicit types and tracked effects, designed for AI code generation.
Repository: https://github.com/PhilipLudington/Kira
- Pure by default - Functions are pure unless explicitly marked with
effect - Explicit types - No type inference; all types are visible and clear
- Tracked effects - IO, State, and Error effects are visible in function signatures
- Pattern matching - Full support for algebraic data types
- Generics - Explicit type parameters for polymorphic code
- Module system - Hierarchical modules with visibility control
- Zig (0.14.0 or later)
git clone https://github.com/PhilipLudington/Kira
cd Kira
zig buildThe executable will be at zig-out/bin/Kira.
zig build run -- examples/hello.ki
# or after building:
./zig-out/bin/Kira run examples/hello.kizig build run -- check examples/hello.kizig build run
# or
./zig-out/bin/KiraREPL commands:
:help- Show help:quit- Exit:type <expr>- Show expression type:load <file>- Load a .ki file:clear- Clear environment
zig build run -- --tokens examples/hello.ki # Show token stream
zig build run -- --ast examples/hello.ki # Show ASTeffect fn main() -> void {
std.io.println("Hello, Kira!")
}
let x: i32 = 42
let name: string = "Alice"
let pi: f64 = 3.14159
let active: bool = true
Pure functions (default):
fn add(a: i32, b: i32) -> i32 {
return a + b
}
fn factorial(n: i32) -> i32 {
if n <= 1 { return 1 }
return n * factorial(n - 1)
}
Effect functions (can perform I/O):
effect fn greet(name: string) -> void {
std.io.println("Hello, " + name + "!")
}
type Option[T] =
| Some(T)
| None
type List[T] =
| Cons(T, List[T])
| Nil
type Point = {
x: f64,
y: f64
}
fn describe(opt: Option[i32]) -> string {
match opt {
Some(n) if n > 0 => { return "positive" }
Some(n) if n < 0 => { return "negative" }
Some(_) => { return "zero" }
None => { return "nothing" }
}
}
fn map[T, U](list: List[T], f: fn(T) -> U) -> List[U] {
match list {
Nil => { return Nil }
Cons(head, tail) => { return Cons(f(head), map(tail, f)) }
}
}
| Type | Description |
|---|---|
i8, i16, i32, i64, i128 |
Signed integers |
u8, u16, u32, u64, u128 |
Unsigned integers |
f32, f64 |
Floating point |
bool |
Boolean |
char |
Character |
string |
String |
void |
Unit type |
std.io- Input/output operationsstd.list- List operations (map, filter, fold, etc.)std.option- Option type helpersstd.result- Result type helpersstd.string- String manipulationstd.fs- File system operations
The examples/ directory contains sample programs:
hello.ki- Hello worldfactorial.ki- Recursive functionsfibonacci.ki- Multiple recursion approachesbinary_tree.ki- Algebraic data typesoption_handling.ki- Option type usagequicksort.ki- Sorting algorithmscalculator.ki- Expression evaluationfizzbuzz.ki- Classic algorithm
Run an example:
zig build run -- examples/factorial.ki- Language Design - Complete language specification
- Tutorial - Step-by-step guide
- Standard Library - API reference
- Quick Reference - Cheat sheet for common patterns
- AI Agents Guide - Why Kira is designed for AI code generation
See CONTRIBUTING.md for guidelines on how to contribute to Kira.
- kira-http - HTTP client and server library for Kira
- kira-json - JSON parsing and serialization library for Kira
- kira-lpe - Logic Programming Engine implemented in Kira
- kira-pcl - Parser Combinator Library for building parsers in Kira
- kira-test - Testing framework for Kira
- Kira-Toolkit - Development standards and patterns for safe, consistent, and maintainable Kira code
- Kira-Reference - Hardened development standards and patterns for the Kira programming language
See LICENSE for details.