示例#1
0
        public Function(string name, byte[] bytecode)
        {
            this.name = name;
            this.bytecode = new Bytecode(bytecode);

            //Console.WriteLine("Function bytecode:");
            //Console.WriteLine(String.Join(" ", bytecode));
        }
示例#2
0
 public void JumpTo(Bytecode bytecode)
 {
     bytecodeStack.Push(currentBytecode);
     currentBytecode = bytecode;
 }
示例#3
0
        // calling plain JumpTo goes back one bytecode. if there is no more bytecodes left, end the program
        public bool JumpTo()
        {
            if (!bytecodeStack.Any())
                return true;

            currentBytecode = bytecodeStack.Pop(); // take the previous
            return false;
        }
示例#4
0
        public void Load(CompiledProgram program)
        {
            stack = new Stack<object>(MaxStackSize);
            scope = new Scope(null);

            bytecodeStack = new Stack<Bytecode>();
            currentBytecode = program.GetBytecode();

            Console.WriteLine("Program loaded");
        }