Common patterns
***************

Hello world
===========

     HALT

Will render a template without any external symbols and terminate execution immediately.

Handling menus and inputs
=========================

     MOUT to_foo 0
     MOUT to_bar 1
     MOUT upup 2
     HALT
     INCMP foo 0
     INCMP bar 1
     INCMP _ 2

Create three menu items, resolving the menu symbols to_foo, to_bar and upup respectively to translated text and pairing with the selectors.

Yield for client input. Then attempt to match input to selectors:

  * if selector is 0, execute node foo.

  * if selector is 1, execute node bar.

  * if selector is 2, execute previous node in stack.

Menu batch version
------------------

     DOWN foo 0 to_foo
     DOWN bar 1 to_bar
     UP 2 upup

This example produces exactly the same bytecode result as the previous example.

Signal flow control
===================

     LOAD foo 1
     CATCH bar 8 1
     MOVE baz

If loading the external symbol foo sets the flag 8, then immediately move to bar.

Otherwise, move to baz.

Multiple pages
==============

     LOAD foo 0
     MNEXT to_fwd 11
     MPREV to_back 22
     HALT
     INCMP > 11
     INCMP < 22

Load external symbol foo as a sink.

If content spans multiple pages, resolve to_fwd and to_back as labels for lateral navigation options in the menu.

Also handle the lateral navigation inputs.

Menu batch version
------------------

     LOAD foo 0
     NEXT 11 to_fwd
     PREVIOUS 22 to_back

This example produces exactly the same bytecode result as the previous example.

Multi-page menus
================

     MSINK
     MNEXT to_fwd 11
     MPREV to_back 22
     MOUT inky 0
     MOUT pinky 1
     MOUT blinky 2
     MOUT clyde 3
     MOUT tinkywinky 4
     MOUT dipsy 5
     MOUT lala 6
     MOUT pu 7
     HALT
     INCMP foo 0
     INCMP foo 1
     INCMP foo 2
     INCMP foo 3
     INCMP foo 4
     INCMP foo 5
     INCMP foo 6
     INCMP bar 7

Enable splitting menu over several pages, and route all valid inputs to the foo node, except for 7 which is routed to the bar node.

Menu batch version
------------------

     MSINK
     MNEXT to_fwd 11
     MPREV to_back 22
     DOWN foo 0 inky
     DOWN foo 1 pinky
     DOWN foo 2 blinky
     DOWN foo 3 clyde
     DOWN foo 4 tinkywinky
     DOWN foo 5 dipsy
     DOWN foo 6 lala
     DOWN bar 7 pu

This example produces exactly the same bytecode result as the previous example.

Default input handler
=====================

     MOUT to_foo 0
     HALT
     INCMP foo 0
     INCMP bar *

If input is 0, route to the foo. Any other input will route to the bar node.