Skip to content

Syntax Overview

ExtensionOutputDescription
.purus.jsStandard JavaScript
.cpurus.cjsCommonJS module
.mpurus.mjsES Module
-- This is a line comment
--- This is a
block comment ---

Strings use triple slashes ///:

const greeting be ///Hello, World///
EscapeResult
\nNewline
\tTab
\\Backslash
\//
\[[
\]]
const i be 42
const f be 3.14
const a be true
const b be false
const c be null
const d be nil -- alias for null
const e be undefined
const arr be [1, 2, 3]
const arr2 be [1; 2; 3] -- semicolons also work
const empty be []
const obj be [name be ///Alice///, age be 30]
const empty-obj be [be] -- empty object

Purus uses [] for everything — function calls, arrays, objects, and grouping. No () or {}.

Blocks are defined by indentation (2 spaces recommended):

if x gt 0
console.log[///positive///]
else
console.log[///non-positive///]

Identifiers can contain hyphens (-), which are converted to underscores in JavaScript output:

const my-variable be 42
-- compiles to: const my_variable = 42;