blue matrix

Hup, a scripting language

This is a stack.

1 2 3

And this is how you add 1 to each item of this stack.

1 2 3 + 1

The result of this expression is another stack.

2 3 4

There is no operator precedence. Instead, everything is left associative.

1 2 3 + 1 * 2

This expression means (1 2 3 + 1) * 2, which results in:

4 6 8

Now this is a term. Its predicate is the atom "a", and it has 2 arguments: the atom "b" and the atom "c".

a(b c)

When an expression is given in a compound term, the expression is first resolved, before the term receives the resulting stack items as arguments.

P(1 2 3 + 1 * 2)

This is equivalent to:

P(4 6 8)

We'll get back to terms in another post.


Now, this is a table.

[ ]

A table may have a name, a formula, and values obtained by evaluating the formula. The formula is preceded by equal "=" and each value is preceded by a vertical bar "|".

[ example = 1 2 3 + 1 * 2 | 4 | 6 | 8 ]

Whitespace characters are insignificant.

[
example
= 1 2 3 + 1 * 2
| 4
| 6
| 8
]

The formula is optional. A table without formula is a constant table.

[
some numbers
| 1
| 2
| 3
]

A table's formula can reference values from other tables. The names of referenced tables are enclosed in square brackets.

[
example
= [some numbers] + 1 * 2
| 4
| 6
| 8
]

When the values of a referenced table change, the values of the referencing tables are recalculated to reflect the changes. If [some numbers] becomes 10 20 30, then [example] will automatically be updated.

[ some numbers | 10 | 20 | 30 ]
[
example = [some numbers] + 1 * 2
| 22
| 42
| 62
]

Thus the network of tables is an event driven medium, through which mutations propagate.