Skip to content

Installation

Pluvial is implemented in C (C11) as a stack-based bytecode VM, following the architecture of Bob Nystrom’s Crafting Interpreters (clox). The compiler and runtime ship as a single binary, pluvial.

  • A C11 compiler. GCC or Clang is recommended: the dispatch loop uses the labels-as-values extension (computed-goto direct threading). Compilers without it (such as MSVC) fall back to a switch-based dispatcher, so the build stays portable.
  • The standard C library and math.h — the runtime uses pow() and fmod() for the ** and % operators.

Optional dependencies (for some standard-library modules)

Section titled “Optional dependencies (for some standard-library modules)”
ModuleDependencyNotes
std/httplibcurlLinked via curl-config --libs / --cflags. macOS uses the system libcurl.
std/regexlibpcre2 (libpcre2-8)Detected with pkg-config. Building with HAVE_PCRE2=0 falls back to error stubs.
pluvial build (AOT)LLVM (llc) and clangRequired only for ahead-of-time native compilation.

Build the runtime with -O2. The NaN-boxed value representation and the computed-goto dispatcher rely on the optimizer inlining a small set of static inline helpers; without -O2 those calls remain function calls and the optimizations do not pay off.

Per the language spec, a 100M tight arithmetic loop runs about 2.59× faster at -O2 than at -O0 (median 4.40s vs 11.40s) with byte-identical output.

Terminal window
pluvial # start the REPL (no arguments)
pluvial file.plu # compile and run file.plu

The .plu extension is a convention, not a requirement. The full set of subcommands and flags is documented in the CLI reference.

Pluvial follows the sysexits convention:

CodeMeaning
0Success
64Misuse of the CLI (no arguments / too many)
65Compile error (type error, syntax error, static error)
66Could not open or read the input file
70Runtime error (division by zero, stack overflow)