Verified examples
The official compiler examples directory contains .srp files paired with expected .stdout files. These are compiler-owned fixtures, not invented syntax samples.
Current alpha.6 project tutorial
Follow the complete, verified two-file project and symbol-navigation lab. It recreates the published alpha.6 source under a real Scarp.project, checks symbols and references without executing, and confirms the exact interpreter output. The older examples below remain pinned to the alpha.1 baseline.
Learn from first program to compiler tooling
Start with the seven-stage, release-aware learning path, then return here for complete compiler-owned examples. Different stages use different published compiler versions; do not assume all historical examples work with the latest prerelease.
Hello, Scarp
Source: examples/hello.srp.
print("Hello from Scarp!");
Checked arithmetic
print(1 + 2 * 3); // 7
print((1 + 2) * 3); // 9
print(-7 / 2); // -3
Source: arithmetic fixture.
Functions and calls
funcra add(a: integer, b: integer) -> integer {
return a + b;
}
funcra square(value: integer) -> integer {
return value * value;
}
print(add(10, square(5))); // 35
Source: function fixture.
Module composition
Read the multi-file module demo alongside linear.srp and settings.srp.
scarp run examples/module_demo.srp
scarp check examples/module_demo.srp
The relative paths above assume you are at the compiler repository root or using its extracted release package. For a more extensive sample set, see the official example directory. The Scarp source interpreter is prerelease software and its examples are version-dependent.
Latest published alpha.2 examples
The newer v0.0.5-alpha.2 release examples and collections and learning tutorial add 12 separately pinned programs across the release, collection and multi-file module tutorial with checked sources and stdout, plus tested module text/JSON inspection. These do not change the older release baseline for the examples below.
Automatically checked documentation fixtures
The official examples above are also mirrored in the documentation repository's conformance fixtures. The CI conformance job checks out exactly the published compiler source commit, compiles that interpreter, and tests 11 .srp programs with check and byte-exact run output. It also performs a tokens smoke test. A changed example cannot pass merely because its code looks plausible.
For a learning path, start with the verified functions walkthrough, study counted and conditional loops, learn newlines and output streams, then continue with compiler-verified numerical vectors and the verified tiles tutorial, classification and probability tutorial, and three-file module tutorial. All 11 mirrored compiler programs now appear in bilingual, fixture-checked tutorials.