Language
Expressions

Expressions

Atoms

Null

null
 

Boolean

true
 
false
 

Number

All numbers in Rimu are "Big" Decimals (opens in a new tab), not floats or integers.

10
 
10.99
 

String

"hello world"
 

Escape quotes within strings to represent them literally.

"they said \"hello world\""
 

Function

(a, b) => a + b
 

Identifier

Identifiers must conform to regex: ^[a-zA-Z_][a-zA-Z0-9_]*$

hello
 

Collections

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_done
 

Binary

+ (add)

Operands must be numbers, strings, or lists.

10 + 2
 
"hello" + "world"
 
[1, 2] + [3, 4]
 

- (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 % 2
 

Call

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.a
 

Get 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"