Esempio n. 1
0
        /// <summary>
        /// Starts executing all quadruples until all of them have been processed.
        /// </summary>
        public static async Task Execute()
        {
            Utilities.vmExecuting = true;
            quadruples            = QuadrupleManager.GetQuadruples();
            while (!endExecution)
            {
                int instructionToExecute = currentInstruction;
                await ExecuteInstruction();

                // increment current instruction counter only if we didn't do a jump
                if (instructionToExecute == currentInstruction)
                {
                    currentInstruction++;
                }
            }

            quadruples              = new List <Quadruple>();
            currentInstruction      = 0;
            endExecution            = false;
            savedInstructionPointer = new Stack <int>();
            localMemoryAllocations  = new Stack <int>();
            CallStack          = new Stack <Tuple <string, int> >();
            LastFunctionCalled = new Stack <Function>();
            funcToAdd          = new Stack <Tuple <string, int> >();
        }