Primitive & Compound Types

SP features a static, nominal type system with built-in primitive scalars and high-performance collection abstractions.

types.sp
1import std.io;
2
3fn main() -> void {
4 // Scalar Primitives
5 int a = 42;
6 double b = 3.14159;
7 bool isFast = true;
8 string text = "SP Systems";
9
10 // Arrays and Literals
11 Array<int> scores = [95, 88, 100];
12
13 println("Int: ${a}, Double: ${b}, Bool: ${isFast}");
14 println("Array size: ${scores.length()}");
15}

Primitive Types Table

TypeSize & RepresentationExample
int64-bit signed integer (i64)let x: int = 100;
double64-bit IEEE-754 float (f64)let d: double = 3.14;
bool1-bit boolean (i1)let flag: bool = true;
stringUTF-8 heap slice pointerlet s: string = "SP";
voidUnit type representing no valuefn exit() -> void