Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI / REPL

The ranty CLI runs inline code, files, or piped stdin. When no source is provided and stdin is a TTY, it starts the interactive REPL. Direct file execution accepts both .ranty and .rant source files.

Execution order

  1. --eval PROGRAM
  2. FILE
  3. piped stdin
  4. REPL

Flags

FlagDescription
-e, --evalRuns an inline program string.
-s, --seedSets the initial RNG seed as 1 to 16 hexadecimal digits, with an optional 0x prefix.
-b, --bench-modePrints compile and execution timing.
-W, --no-warningsSuppresses compiler warnings.
-D, --no-debugDisables debug symbol emission during compilation.

Exit codes

CodeMeaning
0Success.
64Invalid CLI usage, such as an invalid seed.
65Compilation failed.
66Input file not found.
70Runtime execution failed.

REPL behavior

The REPL keeps top-level definitions between lines and suppresses noisy unused-variable and unused-function warnings that would otherwise fire on every entry.

Examples

ranty --seed deadbeef --eval '[rand:1;6]'
ranty examples/helloworld.ranty
printf '"from stdin"' | ranty