Skip to Content
Like this project? Star on Github! ⭐
LanguageBlocks

Blocks

Rimu is structured as blocks similar to Yaml , with some important differences.

Comments

Anything from # to the end of a line is a comment and is ignored by the parser. Comments may appear on their own line or trail other content on the same line.

# this whole line is a comment mikey: # comments may also be indented name: "Mikey" # trailing comments are ok too

Expressions

Unlike Yaml, scalars (values) are Rimu expressions.

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

  • Strings must be wrapped in quotes, otherwise is assumed to be an identifier.
  • No more implicit typing (aka the “Norway Problem” )

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
Last updated on