Ejemplo n.º 1
0
        public ProgramState executeOneStep(ProgramState program)
        {
            if (program == null)
            {
                throw (new InterpreterException("error: no program to execute"));
            }

            ExecutionStack <Statement> executionStack = program.getExecutionStack();

            if (executionStack.isEmpty())
            {
                throw (new InterpreterException("\nerror: execution stack is empty"));
            }
            else
            {
                Statement statement = executionStack.pop();
                return(statement.execute(program));
            }
        }