Your First SP Program

In this tutorial, you will write a complete SP program, run it instantly in JIT mode, and build an optimized native executable.

1. Write the Code

Create a new file named hello.sp in your preferred editor:

hello.sp
1import std.io;
2
3fn main() -> void {
4 let greeting = "Hello, SP 1.0.0!";
5 println(greeting);
6}

2. Run Directly with `spc run`

The fastest way to test and execute your SP code during development is using spc run:

bash
1spc run hello.sp

Output:

Hello, SP 1.0.0!

3. Compile a Standalone Native Executable

To compile an optimized, standalone binary ready for deployment:

bash
1spc build hello.sp -o hello -O3
Optimization Flag
The -O3 flag instructs LLVM to enable full vectorization, loop unrolling, and inlining for maximum performance.