go-vise

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

instructions.html (15173B)


      1 <!DOCTYPE html>
      2 <html>
      3 <!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
      4 <head>
      5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      6 <!-- Released 2023 under AGPL3 -->
      7 <title>instructions (vise)</title>
      8 
      9 <meta name="description" content="instructions (vise)">
     10 <meta name="keywords" content="instructions (vise)">
     11 <meta name="resource-type" content="document">
     12 <meta name="distribution" content="global">
     13 <meta name="Generator" content="makeinfo">
     14 <meta name="viewport" content="width=device-width,initial-scale=1">
     15 
     16 <link href="index.html" rel="start" title="Top">
     17 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
     18 <link href="index.html" rel="up" title="Top">
     19 <link href="navigation.html" rel="next" title="navigation">
     20 <link href="signals.html" rel="prev" title="signals">
     21 <style type="text/css">
     22 <!--
     23 a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
     24 div.example {margin-left: 3.2em}
     25 span:hover a.copiable-link {visibility: visible}
     26 -->
     27 </style>
     28 
     29 
     30 </head>
     31 
     32 <body lang="en">
     33 <div class="chapter-level-extent" id="instructions">
     34 <div class="nav-panel">
     35 <p>
     36 Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previous: <a href="signals.html" accesskey="p" rel="prev">Signal flags</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
     37 </div>
     38 <hr>
     39 <h2 class="chapter" id="Instructions"><span>5 Instructions<a class="copiable-link" href="#Instructions"> &para;</a></span></h2>
     40 
     41 
     42 <ul class="mini-toc">
     43 <li><a href="#Data-types" accesskey="1">Data types</a></li>
     44 <li><a href="#Instruction-list" accesskey="2">Instruction list</a></li>
     45 <li><a href="#Batch-instructions" accesskey="3">Batch instructions</a></li>
     46 </ul>
     47 <div class="section-level-extent" id="Data-types">
     48 <h3 class="section"><span>5.1 Data types<a class="copiable-link" href="#Data-types"> &para;</a></span></h3>
     49 
     50 
     51 <a class="anchor" id="node_005ftype"></a><ul class="mini-toc">
     52 <li><a href="#node" accesskey="1">node</a></li>
     53 <li><a href="#label" accesskey="2">label</a></li>
     54 <li><a href="#size" accesskey="3">size</a></li>
     55 <li><a href="#selector" accesskey="4">selector</a></li>
     56 <li><a href="#symbol" accesskey="5">symbol</a></li>
     57 <li><a href="#signal" accesskey="6">signal</a></li>
     58 <li><a href="#matchmode" accesskey="7">matchmode</a></li>
     59 </ul>
     60 <div class="subsection-level-extent" id="node">
     61 <h4 class="subsection"><span>5.1.1 node<a class="copiable-link" href="#node"> &para;</a></span></h4>
     62 
     63 <p>A node name is a string.
     64 </p>
     65 <p>Both regular and special node names exist.
     66 </p>
     67 <ul class="mini-toc">
     68 <li><a href="#Regular-node" accesskey="1">Regular node</a></li>
     69 <li><a href="#Special-node" accesskey="2">Special node</a></li>
     70 </ul>
     71 <div class="subsubsection-level-extent" id="Regular-node">
     72 <h4 class="subsubsection"><span>5.1.1.1 Regular node<a class="copiable-link" href="#Regular-node"> &para;</a></span></h4>
     73 
     74 <p>Must be one or more characters long.
     75 </p>
     76 <p>Starts with a 7-bit alphabetical character ([a-zA-Z]).
     77 </p>
     78 <p>The remainder of the string may contain 7-bit alphanumeric characters or underscore.
     79 </p>
     80 
     81 </div>
     82 <div class="subsubsection-level-extent" id="Special-node">
     83 <h4 class="subsubsection"><span>5.1.1.2 Special node<a class="copiable-link" href="#Special-node"> &para;</a></span></h4>
     84 
     85 <p>Special node names are a single character.
     86 </p>
     87 <p>See <a class="ref" href="navigation.html#node_005fnames">Node names</a> for details. 
     88 </p>
     89 
     90 </div>
     91 </div>
     92 <div class="subsection-level-extent" id="label">
     93 <h4 class="subsection"><span>5.1.2 label<a class="copiable-link" href="#label"> &para;</a></span></h4>
     94 
     95 <p>Same rules as for <a class="ref" href="#symbol_005ftype">symbol</a>.
     96 </p>
     97 
     98 </div>
     99 <div class="subsection-level-extent" id="size">
    100 <h4 class="subsection"><span>5.1.3 size<a class="copiable-link" href="#size"> &para;</a></span></h4>
    101 
    102 <p>Numerical value of any size.
    103 </p>
    104 
    105 </div>
    106 <div class="subsection-level-extent" id="selector">
    107 <h4 class="subsection"><span>5.1.4 selector<a class="copiable-link" href="#selector"> &para;</a></span></h4>
    108 
    109 <p>The selector <code class="code">*</code> is used to catch any input.
    110 </p>
    111 <p>Apart from that, a valid selector is a string of 7-bit alphanumeric characters.
    112 </p>
    113 
    114 <a class="anchor" id="symbol_005ftype"></a></div>
    115 <div class="subsection-level-extent" id="symbol">
    116 <h4 class="subsection"><span>5.1.5 symbol<a class="copiable-link" href="#symbol"> &para;</a></span></h4>
    117 
    118 <p>Same rules as for <a class="ref" href="#node_005ftype">regular node names</a>.
    119 </p>
    120 
    121 </div>
    122 <div class="subsection-level-extent" id="signal">
    123 <h4 class="subsection"><span>5.1.6 signal<a class="copiable-link" href="#signal"> &para;</a></span></h4>
    124 
    125 <p>Numerical value of any size.
    126 </p>
    127 
    128 </div>
    129 <div class="subsection-level-extent" id="matchmode">
    130 <h4 class="subsection"><span>5.1.7 matchmode<a class="copiable-link" href="#matchmode"> &para;</a></span></h4>
    131 
    132 <p>Binary numeric value, 0 or 1.
    133 </p>
    134 
    135 </div>
    136 </div>
    137 <div class="section-level-extent" id="Instruction-list">
    138 <h3 class="section"><span>5.2 Instruction list<a class="copiable-link" href="#Instruction-list"> &para;</a></span></h3>
    139 
    140 <ul class="mini-toc">
    141 <li><a href="#CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e" accesskey="1">CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;</a></li>
    142 <li><a href="#CROAK-_003csignal_003e-_003cmatchmode_003e" accesskey="2">CROAK &lt;signal&gt; &lt;matchmode&gt;</a></li>
    143 <li><a href="#HALT" accesskey="3">HALT</a></li>
    144 <li><a href="#INCMP-_003cnode_003e-_003cselector_003e" accesskey="4">INCMP &lt;node&gt; &lt;selector&gt;</a></li>
    145 <li><a href="#LOAD-_003csymbol_003e-_003csize_003e" accesskey="5">LOAD &lt;symbol&gt; &lt;size&gt;</a></li>
    146 <li><a href="#MAP-_003csymbol_003e" accesskey="6">MAP &lt;symbol&gt;</a></li>
    147 <li><a href="#MNEXT-_003clabel_003e-_003cselector_003e" accesskey="7">MNEXT &lt;label&gt; &lt;selector&gt;</a></li>
    148 <li><a href="#MOUT-_003clabel_003e-_003cselector_003e" accesskey="8">MOUT &lt;label&gt; &lt;selector&gt;</a></li>
    149 <li><a href="#MOVE-_003cnode_003e" accesskey="9">MOVE &lt;node&gt;</a></li>
    150 <li><a href="#MPREV-_003clabel_003e-_003cselector_003e">MPREV &lt;label&gt; &lt;selector&gt;</a></li>
    151 <li><a href="#MSINK">MSINK</a></li>
    152 <li><a href="#RELOAD-_003csymbol_003e">RELOAD &lt;symbol&gt;</a></li>
    153 </ul>
    154 <div class="subsection-level-extent" id="CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e">
    155 <h4 class="subsection"><span>5.2.1 CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;<a class="copiable-link" href="#CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e"> &para;</a></span></h4>
    156 
    157 <p>Control flow using signal checking.
    158 </p>
    159 <p>If <code class="code">matchmode</code> is 1, then jump to <code class="code">node</code> if <code class="code">signal</code> is <em class="emph">set</em>.
    160 </p>
    161 <p>If <code class="code">matchmode</code> is 0, then jump to <code class="code">node</code> if <code class="code">signal</code> is <em class="emph">not set</em>.
    162 </p>
    163 <p>Existing bytecode in buffer is cleared before the jump.
    164 </p>
    165 
    166 </div>
    167 <div class="subsection-level-extent" id="CROAK-_003csignal_003e-_003cmatchmode_003e">
    168 <h4 class="subsection"><span>5.2.2 CROAK &lt;signal&gt; &lt;matchmode&gt;<a class="copiable-link" href="#CROAK-_003csignal_003e-_003cmatchmode_003e"> &para;</a></span></h4>
    169 
    170 <p>Clear state and restart execution from top if signal is matched.
    171 </p>
    172 <p>Signal match is the same as for <code class="code">CATCH</code>.
    173 </p>
    174 <p>Existing bytecode in buffer is cleared before the jump.
    175 </p>
    176 
    177 </div>
    178 <div class="subsection-level-extent" id="HALT">
    179 <h4 class="subsection"><span>5.2.3 HALT<a class="copiable-link" href="#HALT"> &para;</a></span></h4>
    180 
    181 <p>Halt execution and yield control to client.
    182 </p>
    183 <p>Any remaining bytecode is kept in buffer. 
    184 </p>
    185 
    186 </div>
    187 <div class="subsection-level-extent" id="INCMP-_003cnode_003e-_003cselector_003e">
    188 <h4 class="subsection"><span>5.2.4 INCMP &lt;node&gt; &lt;selector&gt;<a class="copiable-link" href="#INCMP-_003cnode_003e-_003cselector_003e"> &para;</a></span></h4>
    189 
    190 <p>Compare registered input to <code class="code">selector</code>.
    191 </p>
    192 <p>If match, it has the same side-effects as <code class="code">MOVE</code>.
    193 </p>
    194 <p>In addition, any consecutive <code class="code">INCMP</code> matches will be ignored until next <code class="code">HALT</code> is encountered.
    195 </p>
    196 
    197 </div>
    198 <div class="subsection-level-extent" id="LOAD-_003csymbol_003e-_003csize_003e">
    199 <h4 class="subsection"><span>5.2.5 LOAD &lt;symbol&gt; &lt;size&gt;<a class="copiable-link" href="#LOAD-_003csymbol_003e-_003csize_003e"> &para;</a></span></h4>
    200 
    201 <p>Execute the code symbol <code class="code">symbol</code> and cache the result.
    202 </p>
    203 <p>Result must be constrained to the given <code class="code">size</code>.
    204 </p>
    205 <p>This is a noop if symbol has already been loaded in the current scope.
    206 </p>
    207 
    208 </div>
    209 <div class="subsection-level-extent" id="MAP-_003csymbol_003e">
    210 <h4 class="subsection"><span>5.2.6 MAP &lt;symbol&gt;<a class="copiable-link" href="#MAP-_003csymbol_003e"> &para;</a></span></h4>
    211 
    212 <p>Expose result from <code class="code">symbol</code> previously loaded by <code class="code">LOAD</code> to the renderer.
    213 </p>
    214 
    215 </div>
    216 <div class="subsection-level-extent" id="MNEXT-_003clabel_003e-_003cselector_003e">
    217 <h4 class="subsection"><span>5.2.7 MNEXT &lt;label&gt; &lt;selector&gt;<a class="copiable-link" href="#MNEXT-_003clabel_003e-_003cselector_003e"> &para;</a></span></h4>
    218 
    219 <p>Activate the &quot;next&quot; part of lateral navigation.
    220 </p>
    221 <p>Define how to display the menu choice for advancing to the next page.
    222 </p>
    223 
    224 </div>
    225 <div class="subsection-level-extent" id="MOUT-_003clabel_003e-_003cselector_003e">
    226 <h4 class="subsection"><span>5.2.8 MOUT &lt;label&gt; &lt;selector&gt;<a class="copiable-link" href="#MOUT-_003clabel_003e-_003cselector_003e"> &para;</a></span></h4>
    227 
    228 <p>Add menu entry.
    229 </p>
    230 <p>Each entry should have a corresponding &lsquo;INCMP&lsquo; with matching <code class="code">selector</code>.
    231 </p>
    232 <p>Attempt to resolve <code class="code">label</code> to a language-enabled string to use as menu title, or by default use the <code class="code">label</code> directly.
    233 </p>
    234 
    235 </div>
    236 <div class="subsection-level-extent" id="MOVE-_003cnode_003e">
    237 <h4 class="subsection"><span>5.2.9 MOVE &lt;node&gt;<a class="copiable-link" href="#MOVE-_003cnode_003e"> &para;</a></span></h4>
    238 
    239 <p>Load bytecode and template corresponding to <code class="code">node</code>.
    240 </p>
    241 <p>The loaded bytecode is appended to existing bytecode in buffer.
    242 </p>
    243 <p>Invalidates effects of all preceding <code class="code">MAP</code> calls.
    244 </p>
    245 
    246 </div>
    247 <div class="subsection-level-extent" id="MPREV-_003clabel_003e-_003cselector_003e">
    248 <h4 class="subsection"><span>5.2.10 MPREV &lt;label&gt; &lt;selector&gt;<a class="copiable-link" href="#MPREV-_003clabel_003e-_003cselector_003e"> &para;</a></span></h4>
    249 
    250 <p>Activate the &quot;previous&quot; part of lateral navigation.
    251 </p>
    252 <p>Define how to display the menu choice for going back to the previous page.
    253 </p>
    254 
    255 </div>
    256 <div class="subsection-level-extent" id="MSINK">
    257 <h4 class="subsection"><span>5.2.11 MSINK<a class="copiable-link" href="#MSINK"> &para;</a></span></h4>
    258 
    259 <p>If set, the menu is defined as the multi-page content sink.
    260 </p>
    261 <p>Cannot be used with an active <code class="code">MAP</code> of a symbol with <code class="code">LOAD</code> size <code class="code">0</code>.
    262 </p>
    263 
    264 </div>
    265 <div class="subsection-level-extent" id="RELOAD-_003csymbol_003e">
    266 <h4 class="subsection"><span>5.2.12 RELOAD &lt;symbol&gt;<a class="copiable-link" href="#RELOAD-_003csymbol_003e"> &para;</a></span></h4>
    267 
    268 <p>Execute a code symbol already loaded by <code class="code">LOAD</code> and overwrite the existing cache with the new results.
    269 </p>
    270 <p>Constrained to the previously given size for the same symbol.
    271 </p>
    272 
    273 
    274 </div>
    275 </div>
    276 <div class="section-level-extent" id="Batch-instructions">
    277 <h3 class="section"><span>5.3 Batch instructions<a class="copiable-link" href="#Batch-instructions"> &para;</a></span></h3>
    278 
    279 <p>Some convenience instructions are made available for defining menus.
    280 </p>
    281 <p>There instruction <strong class="strong">MUST</strong> be used at the <em class="emph">end</em> of the node&rsquo;s assembly code, as they expand to code on either side of a <code class="code">HALT</code> instruction.
    282 </p>
    283 <dl class="table">
    284 <dt><code class="code">DOWN &lt;symbol&gt; &lt;selector&gt; &lt;label&gt;</code></dt>
    285 <dd><p>Descend to next frame and move to <code class="code">symbol</code>.
    286 </p></dd>
    287 <dt><code class="code">UP &lt;selector&gt; &lt;label&gt;</code></dt>
    288 <dd><p>Return to the previous frame.
    289 </p></dd>
    290 <dt><code class="code">NEXT &lt;selector&gt; &lt;label&gt;</code></dt>
    291 <dd><p>Activate and set <em class="emph">next</em> menu option for browsing multiple-page renders.
    292 </p></dd>
    293 <dt><code class="code">PREVIOUS &lt;selector&gt; &lt;label&gt;</code></dt>
    294 <dd><p>Activate and set <em class="emph">previuos</em> menu option for browsing multiple-page renders.  (If <code class="code">MNEXT</code>/<code class="code">NEXT</code> has not been defined this will not be rendered).
    295 </p></dd>
    296 </dl>
    297 
    298 
    299 <ul class="mini-toc">
    300 <li><a href="#Batch-menu-expansion" accesskey="1">Batch menu expansion</a></li>
    301 </ul>
    302 <div class="subsection-level-extent" id="Batch-menu-expansion">
    303 <h4 class="subsection"><span>5.3.1 Batch menu expansion<a class="copiable-link" href="#Batch-menu-expansion"> &para;</a></span></h4>
    304 
    305 <table class="multitable">
    306 <thead><tr><th width="50%">Batch instruction</th><th width="50%">Expanded instruction</th></tr></thead>
    307 <tbody><tr><td width="50%"><div class="example">
    308 <pre class="example-preformatted">DOWN foo 0 to_foo
    309 </pre></div></td><td width="50%"><div class="example">
    310 <pre class="example-preformatted">MOUT to_foo 0
    311 HALT
    312 INCMP foo 0
    313 </pre></div></td></tr>
    314 <tr><td width="50%"><div class="example">
    315 <pre class="example-preformatted">UP 1 back
    316 </pre></div></td><td width="50%"><div class="example">
    317 <pre class="example-preformatted">MOUT back 1
    318 HALT
    319 INCMP _ 1
    320 </pre></div></td></tr>
    321 <tr><td width="50%"><div class="example">
    322 <pre class="example-preformatted">NEXT 2 fwd
    323 </pre></div></td><td width="50%"><div class="example">
    324 <pre class="example-preformatted">MNEXT fwd 2
    325 HALT
    326 INCMP &gt; 2
    327 </pre></div></td></tr>
    328 <tr><td width="50%"><div class="example">
    329 <pre class="example-preformatted">PREVIOUS 3 back
    330 </pre></div></td><td width="50%"><div class="example">
    331 <pre class="example-preformatted">MPREV back 3
    332 HALT
    333 INCMP &lt; 3
    334 </pre></div></td></tr>
    335 <tr><td width="50%"><div class="example">
    336 <pre class="example-preformatted">DOWN foo 0 to_foo
    337 UP 1 back
    338 </pre></div></td><td width="50%"><div class="example">
    339 <pre class="example-preformatted">MOUT to_foo 0
    340 MOUT back 1
    341 HALT
    342 INCMP foo 0
    343 INCMP _ 1
    344 </pre></div></td></tr>
    345 </tbody>
    346 </table>
    347 </div>
    348 </div>
    349 </div>
    350 <hr>
    351 <div class="nav-panel">
    352 <p>
    353 Next: <a href="navigation.html">Navigation</a>, Previous: <a href="signals.html">Signal flags</a>, Up: <a href="index.html">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
    354 </div>
    355 
    356 
    357 
    358 </body>
    359 </html>