private void ExecuteInstruction(Instruction instruction) { switch (instruction.OpCode.Name) { case "ldc.i4": ProcessLdcI4(instruction); break; case "ldc.r4": ProcessLdcR4(instruction); break; case "add": ProcessArithmetic(Operation.Add); break; case "sub": ProcessArithmetic(Operation.Sub); break; case "mul": ProcessArithmetic(Operation.Mul); break; case "div": ProcessArithmetic(Operation.Div); break; case "ret": ProcessRet(); break; } }
private void ProcessLdcI4(Instruction inst) { Process.EvalStack.Push(new Symbol{Name = Guid.NewGuid().ToString(), Type = typeof(int), Value = inst.Value}); }