/*
 * ProgramNode.cpp
 *
 *  Created on: Nov 5, 2012
 *      Author: attero
 */

#include "ProgramNode.h"

ProgramNode::ProgramNode() {
	// TODO Auto-generated constructor stub

}

ProgramNode::~ProgramNode() {
	// TODO Auto-generated destructor stub
}

void ProgramNode::execute() {
	for (std::vector<ASTNode *>::iterator it = children.begin(); it!=children.end(); ++it) {
		   (*it)->execute();
		}
}

void ProgramNode::execute_last()
{
	children[children.size() -1]->execute();
}

std::string ProgramNode::debug()
{
	std::string debug_note = "Program started debugging\n";

	for (std::vector<ASTNode *>::iterator it = children.begin(); it!=children.end(); ++it) {
	    debug_note +=  (*it)->debug() + "\n";
	}
	debug_note += "END\n";
	return debug_note;
}
void ProgramNode::add_statement(ASTStatement * statement)
{
	children.push_back(statement);
}

