Current Scarp compiler reference

Current published snapshot: v0.0.7-alpha.5, published November 29, 2026. This page describes verified current behavior, not a promise of stable syntax across future prereleases.

CLI and entrypoint selection

Command Current documented behavior
scarp version Reports the running Scarp interpreter version
scarp exec Uses a valid manifest in the working directory, else src/main.srp, else main.srp; an invalid manifest is an error
scarp exec FILE.srp Runs an explicitly chosen Scarp source file
scarp verify FILE.srp Performs static source and import verification without running program statements

scarp exec supports bounded interactive input when required by the program. It interprets .srp source; a general scarp compile command is not part of this prerelease.

Persistent fixed arrays

array_set(values, index, replacement) returns a new fixed-array snapshot with the same length and element type. The original and any earlier aliases remain unchanged. Out-of-bounds indices raise E0063. Successful replacements charge the cumulative array-allocation budget and may raise E0064. In-place indexed mutation is not supported.

Scarp
pure funcra replace_last(values: array<integer, 3>) -> array<integer, 3> {
    return array_set(values, 2, 100);
}

bind original = [array: 4, 8, 12];
bind updated = array_set(original, 1, 99);
print(original[1], updated[1], array_len(updated));

bind nested = [array: [array: "one"], [array: "two"]];
bind localized = array_set(nested, 0, [array: "नमस्ते"]);
print(nested[0][0], localized[0][0]);
print(replace_last(updated)[2]);
text
8 99 3
one नमस्ते
100

Fixed-array concatenation

array_concat(left, right) requires equal element types, returns a new array of the combined length, and leaves inputs unchanged. See examples.

Lifetime and memory constraints

Scarp Lifetime combines compiler-planned scope retirement with safe Rust shared immutable storage. User source does not need explicit free/borrow calls. In alpha.18, empty finite and integer numerical windows detach from a larger backing allocation; nonempty views can still retain the original storage. This is not a general cycle collector, an operating-system memory cap, or a guarantee of immediate memory return. The --max-vector-bytes budget is cumulative and --max-live-slots counts allocated frame slots, not process RAM.

Published decimal and tuple features

Alpha.20 supports exact decimal literals (0.1d + 0.2d is exactly 0.3), persistent replacement at a constant tuple index on mutable bindings, and lexicographic ordering of compatible numeric tuples. Unsuffixed binary64 float behavior is unchanged. See the language lesson.

Read the current type system guide for scalar, composite and nominal types with runnable examples.

Generics, strings and Lifetime

File-level funcra supports explicit ::<...> type arguments, contextual inference and generic Option/Result payloads. Numeric and Comparable constraints preserve concrete type rules. String concatenation +, repetition *, raw and multiline literals are interpreted; interpolation is not supported. Function completion retires unneeded values and transfers result ownership without duplicating it for contract evaluation. This is not a process RAM cap.

Generics and strings · Native aggregate locals.

Rust embedding and experimental native objects

Alpha.19 introduced checked named/exported callable handles, signature/effect-constrained slots and cumulative execution receipts. Alpha.20 extends host argument admission to strings inside composite values, counted by logical UTF-8 occurrence. These quotas do not bound total process memory.

The experimental native-object backend accepts pure integer functions, up to sixteen required arguments, and bounded nonrecursive direct calls within a file. The new CLI emits relocatable x86-64 ELF64 objects only. Work and call-stack bounds are checked; the ABI is experimental. See the native-object tutorial and tagged compiler contract.

Read the current release guide for array concatenation, integer reductions and native limitations.

What remains outside this compiler

ELF64 object emission is now exposed through an experimental CLI; C11 emission and checked aggregate layout planning remain Rust host APIs. Only the separate bounded alpha.5 native-exe command emits a Linux executable; earlier APIs are not general-purpose executable compilers. The native-exe subset excludes recursion, I/O, external calls, heap-backed data and general aggregates; the object API has separate bounded recursion support. Private flat integer/Boolean arrays, tuples and records are supported as bounded native stack locals. Scarp remains an experimental interpreter, with no stable compiler or standard-library compatibility promise.

Download and evidence

Use official downloads, the current installation guide, the current language lesson, and immutable compiler source. Archived versioned pages are retired from current documentation discovery, though their source and test evidence remain in Git.

Alpha.5: tensors and bounded Linux executables

tensor<float, ...> includes shape in the type. Immutable source tensors support checked indexing, broadcasting, batched matmul, gradients and bounded SGD/Adam/AdamW updates. Signed i8–i128 and unsigned u8–u128 require explicit checked conversions. scarp native-exe emits a Linux x86-64 executable for a bounded pure scalar subset only; it is not a general compiler. scarp exec remains interpreted.

Alpha.5 detailed lesson · Published release.

Search documentation

Tips: use "exact phrase", -exclude, title:term, body:term, or section:guide. Search stays on this device.