I took one of the smaller problems from the BASIC interpreter, sorting the 
stack, and posed it as a question on PerlMonks to see how a Mongolian Horde 
would handle the problem.  The results are at:

        http://www.perlmonks.org/index.pl?node_id=153974

Summary: the only apparent way to do this trick is with a variation of a 
bubble sort (which I already had) given that there's only one user stack 
and three stack instructions (save, restore, rotate_up).  A quicksort 
solution was posted, except that without being able to randomly address the 
stack it's nearly as bad as a bubblesort.

The sorts presented there *were* more efficient than mine, so I'll probably 
borrow the technique eventually.

Thought this might be of interest from a opcode-design standpoint.  Enjoy.

Reply via email to