Expressions
Atoms
Null
nullBoolean
truefalseNumber
All numbers in Rimu are “Big” Decimals , not floats or integers.
1010.99Octal integers use the
0oprefix and accept digits0–7.
0o755String
"hello world"Escape quotes within strings to represent them literally.
"they said \"hello world\""Function
(a, b) => a + bIdentifier
Identifiers must conform to regex:
^[a-zA-Z_][a-zA-Z0-9_]*$
helloCollections
List
["hello", null, "world"]Object
Unquoted keys must conform to Identifier regex:
^[a-zA-Z_][a-zA-Z0-9_]*$Quoted keys can be any valid Unicode.
{ a: "apple", b: "bear" }{ "a": "apple", "b": "bear" }Operators
Unary
Operand must be a number.
- (negate)
-10! (not)
Operand must be a boolean.
!is_doneBinary
+ (add)
Operands must be numbers, strings, lists, or paths.
10 + 2"hello" + "world"[1, 2] + [3, 4]A path on the left and a string on the right extend the path. See
host_pathandtarget_path.
host_path("./dir") + "sub"target_path("/etc") + "/hosts"A string on the left and a path on the right concatenate as a plain string, dropping the path type — useful for embedding a path inside a non-path string (e.g. a podman volume entry).
"prefix:" + target_path("/etc")- (subtract)
Operands must be numbers.
10 - 2* (multiply)
Operands must be numbers.
10 * 2/ (divide)
Operands must be numbers.
10 / 2> (greater than)
Operands must be numbers.
10 > 2>= (greater than or equal)
Operands must be numbers.
10 >= 2< (less than)
Operands must be numbers.
10 < 2<= (less than or equal)
Operands must be numbers.
10 <= 2== (equal)
true == false!= (not equal)
true != false&& (and)
true && false|| (or)
true || false^ (xor)
Operands must be booleans.
true ^ false% (remainder)
Operands must be numbers.
10 % 2Call
Value being called must be a function.
add(1, 2)Get Index
Container must be list or string or object.
list[2]list[-2]string[2]object["a"]Get Key
Container must be object
object.aGet Slice
Container must be list or string.
list[2:5]string[2:5]Notes
Truthiness
Everything is truthy except false and null.
Orderedness
Only numbers are ordered.
No statements
Every expression is evaluated to a value.
No type coercion
No implicit type coercions.
For example, the following is an error:
2 + "pies"