Language
Blocks

Blocks

Rimu is structured as blocks similar to Yaml (opens in a new tab), with some important differences.

Expressions

Unlike Yaml, scalars (values) are Rimu expressions.

So this means Rimu is both more strict and more expressive:

Null

mikey: null
 

Boolean

nonsense: true
 

Number

bottles_of_beer_on_the_wall: 99
 

String

cat: "Charlie"
 

Function

add: (a, b) =>
  a + b
 

Collections

Objects

mikey:
  name: "Mikey"
  website: "https://mikey.nz"
 

Keys

Keys must either be:

Unquoted Key

Unquoted keys are identifiers and must conform to regex: ^[a-zA-Z_][a-zA-Z0-9_]*$.

Quoted Key

Quoted keys can be any valid Unicode.

"🙆": "okay!"
 

Lists

similar_projects:
  - "JSON-e"
  - "Nickel"
  - "Jsonnet"
 

Multi-line values

TODO

Operations

Function call

length
  - ["a", "b", "c"]
 

A block function call receives a block as input.

If the input block is a list, is assumed to be a list of arguments.

Otherwise, the input block is assumed to be the first and only argument.

if

apple:
  bottom:
    if 20 > 10
    then "jeans"
    else "trousers"
boots:
  if "a" == "a"
  then
    with: "fur"
  else
    without: "fur"
 

let

let
  add: (a, b) => a + b
  subtract: (a, b) =>
    a - b
in
  subtract
    - add(10, 20)
    - 30