Esempio n. 1
0
        public static void Run(string program, Func <int> read, Action <char> write, int memorySize = 30000)
        {
            var vm = new VirtualMachine(program, memorySize);

            BrainfuckBasicCommands.RegisterTo(vm, read, write);
            BrainfuckLoopCommands.RegisterTo(vm);
            vm.Run();
        }
        private IVirtualMachine Vm(string program, int memorySize = 10)
        {
            var vm = new VirtualMachine(program, memorySize);

            BrainfuckBasicCommands.RegisterTo(vm, () => - 1, c => { });
            BrainfuckLoopCommands.RegisterTo(vm);
            vm.Run();
            return(vm);
        }
Esempio n. 3
0
 public VmBuilder AddLoopCommands()
 {
     modifications.Add(delegate { BrainfuckLoopCommands.RegisterTo(vm); });
     return(this);
 }