public void Execute(ExecutionNodes nodes, ref Memory memory) { foreach (ICommand command in commandList) { command.Execute(nodes, ref memory); } }
public void Execute(ExecutionNodes nodes, ref Memory memory) { ExecutionNode en; if (nodes.TryGetValue(Label, out en) == false) { throw new ArgumentException("Jump: Label " + Label + " does not exist."); } en.Execute(nodes, ref memory); }
public void Execute(ExecutionNodes nodes, ref Memory memory) { int rhv; if (memory.Local == null) { throw new InvalidOperationException("Sub: Local cannot be null."); } else { rhv = (int)memory.Local.GetValue(MemoryType.Int); } int lhv = (int)memory.Get(memoryIndex).GetValue(MemoryType.Int); memory.Local = new MemorySlot(MemoryType.Int, lhv - rhv); }
public void Execute(ExecutionNodes nodes, ref Memory memory) { int local; if (memory.Local == null) { throw new InvalidOperationException("BumpUp: Local cannot be null."); } else { local = (int)memory.Local.GetValue(MemoryType.Int); } int register = (int)memory.Get(memoryIndex).GetValue(MemoryType.Int); memory.Local = new MemorySlot(MemoryType.Int, local + 1); memory.Set(MemoryType.Int, register + 1, memoryIndex); }
public void Execute(ExecutionNodes nodes, ref Memory memory) { int local; if (memory.Local == null) { throw new InvalidOperationException("BumpDown: Local cannot be null."); } else { local = (int)memory.Local.GetValue(MemoryType.Int); } int register = (int)memory.Get(memoryIndex).GetValue(MemoryType.Int); memory.Local = new MemorySlot(MemoryType.Int, local - 1); memory.Set(MemoryType.Int, register - 1, memoryIndex); }
public void Execute(ExecutionNodes nodes, ref Memory memory) { ExecutionNode en; if (nodes.TryGetValue(Label, out en) == false) { throw new ArgumentException("JumpZ: Label " + Label + " does not exist."); } int? localMaybe = (int?)memory.Local.GetValue(MemoryType.Int); if (localMaybe.HasValue) { int local = localMaybe.GetValueOrDefault(); if (local == 0) { en.Execute(nodes, ref memory); } } }
public void Execute(ExecutionNodes nodes, ref Memory memory) { ExecutionNode en; if (nodes.TryGetValue(Label, out en) == false) { throw new ArgumentException("JumpN: Label " + Label + " does not exist."); } int?localMaybe = (int?)memory.Local.GetValue(MemoryType.Int); if (localMaybe.HasValue) { int local = localMaybe.GetValueOrDefault(); if (local < 0) { en.Execute(nodes, ref memory); } } }
public void Execute(ExecutionNodes nodes, ref Memory memory) { Console.Write("INBOX > "); string input = Console.ReadLine(); int intResult; char charResult; if (int.TryParse(input, out intResult)) { memory.Local = new MemorySlot(MemoryType.Int, intResult); } else if (char.TryParse(input, out charResult)) { memory.Local = new MemorySlot(MemoryType.Char, charResult); } else { throw new InvalidOperationException(string.Format("Inbox: Cannot parse `{0}`.", input)); } }
public void Execute(ExecutionNodes nodes, ref Memory memory) { memory.Set(memory.Local.Type, memory.Local.GetValue(memory.Local.Type), memoryIndex); }
public void Execute(ExecutionNodes nodes, ref Memory memory) { memory.Local = memory.Get(memoryIndex); }
public void Execute(ExecutionNodes nodes, ref Memory memory) { Console.WriteLine(string.Format("OUTBOX > {0}", memory.Local.GetValue(memory.Local.Type))); }
public HrmpProgram(ExecutionNode startNode) { this.startNode = startNode; executionNodes = new ExecutionNodes(); }