Spike is a purely object-oriented systems programming language engineered as a pragmatic alternative to Rust. Featuring deterministic thread-safe ARC, stack-allocated value structs, and transparent C ABI compatibility.
# Pure data struct (0 bytes vtable overhead)
struct CursorPos {
row: int
col: int = 0
}
# Behavioral class with hardware access
class VGADriver {
base_addr: usize
def VGADriver(addr: usize = 0xB8000) {
self.base_addr = addr
}
def write_char(pos: CursorPos, ch: u8, color: u8): void {
offset: usize = (pos.row * 80 + pos.col) * 2
ptr_write8(self.base_addr + offset, ch)
ptr_write8(self.base_addr + offset + 1, color)
}
}
class Syscall {
static def write(fd: int, buf: usize, count: usize): int {
res: int = 0
asm {
"syscall"
: "=a"(res)
: "a"(1), "D"(fd), "S"(buf), "d"(count)
: "rcx", "r11", "memory"
}
return res
}
}
class App {
static def main(): int {
msg: String = "Spike Pure OOP Running\n"
Syscall.write(1, msg.data as usize, msg.length)
return 0
}
}
Everything you need for kernels, drivers, and high-frequency user-space applications.
No loose standalone functions. All behavioral logic is strictly encapsulated inside classes and pure-data value structs.
Atomic reference counting with explicit disown and own ownership primitives for interrupt handlers and DMA ring buffers.
Top-level methods and functions emit clean, unmangled C symbols, making bidirectional C and Assembly interop completely seamless.
Structs are lightweight, plain-old-data (POD) value types allocated directly on the stack with zero vtable overhead.
Native raw pointers (*T), address-of (&), volatile MMIO intrinsics, and inline GNU assembly blocks.
Compile directly to raw flat binaries (.bin) or bootable ELF kernels without any standard library dependencies.
Modular Python-based tools designed to fit into your existing build pipelines.
Unified recursive descent lexer, parser, and C99/C11 code generator with pure OOP enforcement and lambda capture analysis.
One-step driver handling project resolution, C compilation, linker scripts, and flat .bin / .elf extraction.
Automated legacy C-to-Spike transpiler for converting C structs, drivers, and file systems into pure-OOP Spike code.
Standalone thread-safe runtime header (spike_rt.h) and engine (spike_rt.c) for freestanding and host targets.