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:
- Strings must be wrapped in quotes, otherwise is assumed to be an identifier.
- No more implicit typing (aka the "Norway Problem" (opens in a new tab))
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
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