Hadron
Pre-Alpha Development Stage
Code with Power and Simplicity
Hadron is a statically-typed, compiled systems language with manual memory management, designed for performance, clarity and modern tooling while staying close to the metal. It can target native platforms and the web, giving developers control without sacrificing safety.
Why Choose Hadron?
Simple and Intuitive Syntax
Write clean and readable code without sacrificing performance.
1
2
3
4
5
6
7
8
9
10
11
12
module main;
extern fx printf(fmt: ptr<u8>, ...) i32;
fx main() i32 {
printf("Hello, World!\n");
return 0;
}
// Adding two numbers
fx add(a: i32, b: i32) i32 {
return a + b;
}
Static Type System
Catch errors at compile-time, ensuring robust and reliable applications.
1
2
3
4
5
6
fx main() i32 {
val x: i32 = 10;
val y: ptr<u8> = "Hello";
// x = y // compile error: type mismatch
return 0;
}
Structs & Custom Types
Define custom data types with structs and group related logic into typed functions.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module main;
struct Point {
x: i32;
y: i32;
}
fx distance_sq(p: Point) i32 {
return p.x * p.x + p.y * p.y;
}
fx main() i32 {
val p: Point = Point { x = 3, y = 4 };
val d = distance_sq(p);
// d == 25
return 0;
}
Expressive Control Flow
Use if/else as expressions, C-style for loops, while,
and infinite loop with break/continue.
1
2
3
4
5
6
7
8
9
10
11
12
fx max(a: i32, b: i32) i32 {
return if (a > b) { a } else { b };
}
fx main() i32 {
var sum: i32 = 0;
for (var i: i32 = 0; i < 5; i += 1) {
sum += max(i, 2);
}
// sum == 2+2+2+3+4 == 13
return 0;
}