Verified examples
Small, focused Prismio 0.1 programs categorized by language feature and checked against the compiler.
Last verified
Examples in this section are complete programs designed to compile with Prismio 0.1.0. The documentation verification script extracts fences marked prismio-check: pass and compiles them with the selected local compiler.
Unlike a reference fragment, a verified example includes every required declaration and an entry main, uses no proposed syntax, and can be copied into one .psm file. Expected output or exit behavior is documented next to the program.
Browse by concept
- Control flow — range loops, conditions, and accumulation
- Owned data — a struct borrowed and consumed explicitly
- Optional links —
T?,none, andexpect
The first-program tutorial provides a slower walkthrough. The cookbook focuses on tasks that combine language and compiler/runtime behavior. Error pages contain deliberately invalid programs paired with corrections.
Verification contract
Invalid examples in the language and error references are separately marked prismio-check: fail; verification requires the compiler to reject them. Keep each example self-contained so readers, search engines, and AI systems can recover the required declarations without unrelated context.
The verifier proves acceptance or rejection by the selected local compiler. It does not automatically prove stdout text, performance, foreign ABI correctness, or a specific diagnostic message unless the surrounding test adds those assertions.
Maintainers should keep one main concept per example, prefer deterministic output, avoid external libraries, and link both to the governing reference page and from that page back to the example.
Run an example
Copy a program into a file such as example.psm, then use:
prismio run example.psmTo keep the native artifact:
prismio build example.psm -o exampleUse the documentation version badge and prismio --version together. An example from another language version can compile differently or use a feature currently marked Coming Soon.