Syntax Cheatsheet

RSS is RustScript's native source language. This reference follows a Rust-like path from primitive schemas through inference, ownership, control flow, generics, callable values, closures, and modules. Every syntax topic includes highlighted RSS examples.

Types and values

State and expressions

Control and abstraction

  • Control Flow and Pattern Matching — statement and expression if, match, while, ranges, range-based array traversal, borrowed map iteration, break, and continue.
  • Functions, Generics, and Recursion — block and expression bodies, exports, forward calls, recursion, nested functions, generic parameters, and turbofish.
  • Callables and Closures — callable schemas, function values, higher-order functions, callable collections, closures, captures, returned callables, and shared state.

Programs and tokens

  • Modules, Imports, and Host Calls — source modules, aliases, relative paths, builtin and stdlib namespaces, host imports, and formatted output.
  • Lexical Structure — comments, identifiers, keywords, literals, delimiters, semicolons, trailing result expressions, and .rss files.

Callable catalogs

  • Builtins — generated RSS builtin namespace pages.
  • Stdlibs — generated standard-library module pages.

Language boundary

The pages in this branch describe native RSS syntax. Compatibility frontends lower JavaScript-, Lua-, and Python-like source into shared compiler IR; their surface syntax belongs to the corresponding frontend, not RSS.

fn identity<T>(value: T) -> T {
    value
}
let answer: int = identity::<int>(42);
let render: fn(string) -> string = identity;
answer;
render("rss");