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;23fn main() -> void {4 // Scalar Primitives5 int a = 42;6 double b = 3.14159;7 bool isFast = true;8 string text = "SP Systems";910 // Arrays and Literals11 Array<int> scores = [95, 88, 100];1213 println("Int: ${a}, Double: ${b}, Bool: ${isFast}");14 println("Array size: ${scores.length()}");15}
Primitive Types Table
| Type | Size & Representation | Example |
|---|---|---|
| int | 64-bit signed integer (i64) | let x: int = 100; |
| double | 64-bit IEEE-754 float (f64) | let d: double = 3.14; |
| bool | 1-bit boolean (i1) | let flag: bool = true; |
| string | UTF-8 heap slice pointer | let s: string = "SP"; |
| void | Unit type representing no value | fn exit() -> void |