Linux Today: Linux News On Internet Time.





More on LinuxToday


A second order virtual machine with Falcon

Jul 07, 2009, 19:34 (0 Talkback[s])
(Other stories by Giancarlo Niccolai)

WEBINAR:
On-Demand

How to Help Your Business Become an AI Early Adopter


[ Thanks to steve hill for this link. ]

"Implementing commands

"So, a sequence can contain anything coming from the host virtual machine. This includes instances of classes, where we can easily specify the structure of a new command that we want our virtual machine to execute.

"We can define "a command" as an item with some parameters which does things on the virtual machine when running. Something like the following:

class Command( pcount )
   pcount = pcount

   function run( vm )
      raise CodeError( 0,
         "You should have re-implemented 'run'" )
   end
end

"For example, we can implement the commands 'say' 'copy' and 'remove' that simply map to the Falcon functions I used in the examples so far:"

Complete Story

Related Stories: