Goal: Understand what a Spanda program looks like and run your first one.
Example: examples/basics/01_minimal_robot.sd
Spanda is a language for autonomous systems — robots, drones, agents, and edge devices where sensors, AI, actuators, and safety rules belong in the source code, not scattered across scripts and config files.
A Spanda program describes a robot: what it can sense, what it can move, and what behaviors it runs.
module basics.minimal;
robot TutorialBot {
actuator wheels: DifferentialDrive;
behavior greet() {
wheels.stop();
}
}
| Piece | Meaning |
|---|---|
module |
Names this file in a multi-file project (optional for single-file demos) |
robot |
The autonomous system you are programming |
actuator wheels: DifferentialDrive |
A drive system the robot controls |
behavior greet() |
A named entry point the runtime can execute |
wheels.stop() |
A safe command sent to the actuator |
Spanda is not object-oriented in the Java sense. You do not subclass Robot. You declare
hardware and behaviors directly.
spanda check examples/basics/01_minimal_robot.sd
spanda run examples/basics/01_minimal_robot.sd
check — type-check without running. Catches unit errors, unsafe AI usage, and missing
symbols at compile time.run — execute against the simulated backend (no physical robot required).spanda init my_bot
cd my_bot
Edit src/main.sd with a robot block, then:
spanda check src/main.sd
spanda run src/main.sd
See getting-started.md for the full first-project walkthrough.
.sd files — Spanda source extension (think “Spanda definition”).robot { } is the top-level unit of autonomous logic.DifferentialDrive, RobotArm, Gripper, etc. The compiler knows
what commands are valid.spanda check in CI and before deploy.Create my_bot/src/main.sd with:
GreeterDifferentialDrive actuatorwave() that calls wheels.stop()Run spanda check and spanda run.