5 Instructions

5.1 Data types

5.1.1 node

A node name is a string.

Both regular and special node names exist.

5.1.1.1 Regular node

Must be one or more characters long.

Starts with a 7-bit alphabetical character.

The remainder of the string may contain 7-bit alphanumeric characters or underscore.

5.1.1.2 Special node

Special node names are a single character.

See Node names for details.

5.1.2 label

Same rules as for symbol.

5.1.3 size

Numerical value of any size.

5.1.4 selector

The selector * is used to catch any input.

Apart from that, a valid selector is a string of 7-bit alphanumeric characters.

5.1.5 symbol

Same rules as for regular node names.

5.1.6 signal

Numerical value of any size.

5.1.7 matchmode

Binary numeric value, 0 or 1.

5.2 Instruction list

5.2.1 CATCH <node> <signal> <matchmode>

Control flow using signal checking.

If matchmode is 1, then jump to node if signal is set.

If matchmode is 0, then jump to node if signal is not set.

Existing bytecode in buffer is cleared before the jump.

5.2.2 CROAK <signal> <matchmode>

Clear state and restart execution from top if signal is matched.

Signal match is the same as for CATCH.

5.2.3 HALT

Halt execution and yield control to client.

Any remaining bytecode is kept in buffer.

5.2.4 INCMP <node> <selector>

Compare registered input to selector.

If match, it has the same side-effects as MOVE.

In addition, any consecutive INCMP matches will be ignored until next HALT is encountered.

5.2.5 LOAD <symbol> <size>

Execute the code symbol symbol and cache the result.

Result must be constrained to the given size.

This is a noop if symbol has already been loaded in the current scope.

5.2.6 MAP <symbol>

Expose result from symbol previously loaded by LOAD to the renderer.

5.2.7 MNEXT <label> <selector>

Activate the "next" part of lateral navigation.

Define how to display the menu choice for advancing to the next page.

5.2.8 MOUT <label> <selector>

Add menu entry.

Each entry should have a corresponding ‘INCMP‘ with matching selector.

Attempt to resolve label to a language-enabled string to use as menu title, or by default use the label directly.

5.2.9 MOVE <node>

Load bytecode and template corresponding to node.

The loaded bytecode is appended to existing bytecode in buffer.

Invalidates effects of all preceding MAP calls.

5.2.10 MPREV <label> <selector>

Activate the "previous" part of lateral navigation.

Define how to display the menu choice for going back to the previous page.

5.2.11 MSINK

If set, the menu is defined as the multi-page content sink.

Cannot be used with an active MAP of a symbol with LOAD size 0.

5.2.12 RELOAD <symbol>

Execute a code symbol already loaded by LOAD and overwrite the existing cache with the new results.

Constrained to the previously given size for the same symbol.

5.3 Batch instructions

Some convenience instructions are made available for defining menus.

There instruction MUST be used at the end of the node’s assembly code, as they expand to code on either side of a HALT instruction.

DOWN <symbol> <selector> <label>

Descend to next frame and move to symbol.

UP <selector> <label>

Return to the previous frame.

NEXT <selector> <label>

Activate and set next menu option for browsing multiple-page renders.

PREVIOUS <selector> <label>

Activate and set previuos menu option for browsing multiple-page renders. (If MNEXT/NEXT has not been defined this will not be rendered).

5.3.1 Batch menu expansion

Batch instructionExpanded instruction
DOWN foo 0 to_foo
MOUT to_foo 0
HALT
INCMP foo 0
UP 1 back
MOUT back 1
HALT
INCMP _ 1
NEXT 2 fwd
MNEXT fwd 2
HALT
INCMP > 2
PREVIOUS 3 back
MPREV back 3
HALT
INCMP < 3
DOWN foo 0 to_foo
UP 1 back
MOUT to_foo 0
MOUT back 1
HALT
INCMP foo 0
INCMP _ 1