go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

instructions.texi (4710B)


      1 @node instructions
      2 @chapter Instructions
      3 
      4 
      5 @section Data types
      6 
      7 
      8 @anchor{node_type}
      9 @subsection node
     10 
     11 A node name is a string.
     12 
     13 Both regular and special node names exist.
     14 
     15 @subsubsection Regular node 
     16 
     17 Must be one or more characters long.
     18 
     19 Starts with a 7-bit alphabetical character.
     20 
     21 The remainder of the string may contain 7-bit alphanumeric characters or underscore.
     22 
     23 
     24 @subsubsection Special node
     25 
     26 Special node names are a single character.
     27 
     28 See @ref{node_names, Node names} for details. 
     29 
     30 
     31 @subsection label
     32 
     33 Same rules as for @ref{symbol_type, symbol}.
     34 
     35 
     36 @subsection size
     37 
     38 Numerical value of any size.
     39 
     40 
     41 @subsection selector
     42 
     43 The selector @code{*} is used to catch any input.
     44 
     45 Apart from that, a valid selector is a string of 7-bit alphanumeric characters.
     46 
     47 
     48 @anchor{symbol_type}
     49 @subsection symbol
     50 
     51 Same rules as for @ref{node_type, regular node names}.
     52 
     53 
     54 @subsection signal
     55 
     56 Numerical value of any size.
     57 
     58 
     59 @subsection matchmode
     60 
     61 Binary numeric value, 0 or 1.
     62 
     63 
     64 @section Instruction list
     65 
     66 @subsection CATCH <node> <signal> <matchmode>
     67 
     68 Control flow using signal checking.
     69 
     70 If @code{matchmode} is 1, then jump to @code{node} if @code{signal} is @emph{set}.
     71 
     72 If @code{matchmode} is 0, then jump to @code{node} if @code{signal} is @emph{not set}.
     73 
     74 Existing bytecode in buffer is cleared before the jump.
     75 
     76 
     77 @subsection CROAK <signal> <matchmode>
     78 
     79 Clear state and restart execution from top if signal is matched.
     80 
     81 Signal match is the same as for @code{CATCH}.
     82 
     83 @subsection HALT
     84 
     85 Halt execution and yield control to client.
     86 
     87 Any remaining bytecode is kept in buffer. 
     88 
     89 
     90 @subsection INCMP <node> <selector>
     91 
     92 Compare registered input to @code{selector}.
     93 
     94 If match, it has the same side-effects as @code{MOVE}.
     95 
     96 In addition, any consecutive @code{INCMP} matches will be ignored until next @code{HALT} is encountered.
     97 
     98 
     99 @subsection LOAD <symbol> <size>
    100 
    101 Execute the code symbol @code{symbol} and cache the result.
    102 
    103 Result must be constrained to the given @code{size}.
    104 
    105 This is a noop if symbol has already been loaded in the current scope.
    106 
    107 
    108 @subsection MAP <symbol>
    109 
    110 Expose result from @code{symbol} previously loaded by @code{LOAD} to the renderer.
    111 
    112 
    113 @subsection MNEXT <label> <selector>
    114 
    115 Activate the "next" part of lateral navigation.
    116 
    117 Define how to display the menu choice for advancing to the next page.
    118 
    119 
    120 @subsection MOUT <label> <selector>
    121 
    122 Add menu entry.
    123 
    124 Each entry should have a corresponding `INCMP` with matching @code{selector}.
    125 
    126 Attempt to resolve @code{label} to a language-enabled string to use as menu title, or by default use the @code{label} directly.
    127 
    128 
    129 @subsection MOVE <node>
    130 
    131 Load bytecode and template corresponding to @code{node}.
    132 
    133 The loaded bytecode is appended to existing bytecode in buffer.
    134 
    135 Invalidates effects of all preceding @code{MAP} calls.
    136 
    137 
    138 @subsection MPREV <label> <selector>
    139 
    140 Activate the "previous" part of lateral navigation.
    141 
    142 Define how to display the menu choice for going back to the previous page.
    143 
    144 
    145 @subsection MSINK
    146 
    147 If set, the menu is defined as the multi-page content sink.
    148 
    149 Cannot be used with an active @code{MAP} of a symbol with @code{LOAD} size @code{0}.
    150 
    151 
    152 @subsection RELOAD <symbol>
    153 
    154 Execute a code symbol already loaded by @code{LOAD} and overwrite the existing cache with the new results.
    155 
    156 Constrained to the previously given size for the same symbol.
    157 
    158 
    159 
    160 @section Batch instructions
    161 
    162 Some convenience instructions are made available for defining menus.
    163 
    164 There instruction @strong{MUST} be used at the @emph{end} of the node's assembly code, as they expand to code on either side of a @code{HALT} instruction.
    165 
    166 @table @code
    167 @item DOWN <symbol> <selector> <label>
    168 Descend to next frame and move to @code{symbol}.
    169 @item UP <selector> <label>
    170 Return to the previous frame.
    171 @item NEXT <selector> <label>
    172 Activate and set @emph{next} menu option for browsing multiple-page renders.
    173 @item PREVIOUS <selector> <label>
    174 Activate and set @emph{previuos} menu option for browsing multiple-page renders.  (If @code{MNEXT}/@code{NEXT} has not been defined this will not be rendered).
    175 @end table
    176 
    177 
    178 @subsection Batch menu expansion
    179 
    180 @multitable @columnfractions .50 .50
    181 @headitem Batch instruction
    182 @tab Expanded instruction
    183 @item @example
    184 DOWN foo 0 to_foo
    185 @end example
    186 @tab @example
    187 MOUT to_foo 0
    188 HALT
    189 INCMP foo 0
    190 @end example
    191 @item @example
    192 UP 1 back
    193 @end example
    194 @tab @example
    195 MOUT back 1
    196 HALT
    197 INCMP _ 1
    198 @end example
    199 @item @example
    200 NEXT 2 fwd
    201 @end example
    202 @tab @example
    203 MNEXT fwd 2
    204 HALT
    205 INCMP > 2
    206 @end example
    207 @item @example
    208 PREVIOUS 3 back
    209 @end example
    210 @tab @example
    211 MPREV back 3
    212 HALT
    213 INCMP < 3
    214 @end example
    215 @item @example
    216 DOWN foo 0 to_foo
    217 UP 1 back
    218 @end example
    219 @tab @example
    220 MOUT to_foo 0
    221 MOUT back 1
    222 HALT
    223 INCMP foo 0
    224 INCMP _ 1
    225 @end example
    226 @end multitable